首页 > 其他分享 >HALCON 杂记

HALCON 杂记

时间:2024-01-23 11:23:34浏览次数:21  
标签:image object dev HALCON 杂记 model 3d 3D

1.emphasize — Enhance contrast of the image.   增强图像对比度

  emphasize(Image : ImageEmphasize : MaskWidth, MaskHeight, Factor : ) 

 

read_image(Image,'mreut')
dev_display (Image)
*手动划区域 draw_region(Region,WindowHandle) reduce_domain(Image,Region,Mask) emphasize(Mask,Sharp,7,7,2.0) dev_display (Sharp)

 2.draw_region — Interactive drawing of a closed region   手动画一个封闭任意区域

3.set_rgb( : : WindowHandle, Red, Green, Blue : )   rgb值来设置颜色

4.harmonic_interpolation — Perform a harmonic interpolation on an image region.   

 

 5.gen_binocular_rectification_map  -----Generate transformation maps that describe the mapping of the images of a binocular camera pair to a common rectified image plane.

 

* Set internal and external stereo parameters.
* Note that, typically, these values are the result of a prior
* calibration.
gen_cam_par_area_scan_division (0.01, -665, 5.2e-006, 5.2e-006, \
                                622, 517, 1280, 1024, CamParam1)
gen_cam_par_area_scan_division (0.01, -731, 5.2e-006, 5.2e-006, \
                                654, 519, 1280, 1024, CamParam2)
create_pose (0.1535,-0.0037,0.0447,0.17,319.84,359.89, \
             'Rp+T', 'gba', 'point', RelPose)

* Compute the mapping for rectified images.
gen_binocular_rectification_map (Map1, Map2, CamParam1, CamParam2, \
                                 RelPose, 1,'viewing_direction', 'bilinear',\
                                 CamParamRect1, CamParamRect2, \
                                 CamPoseRect1, CamPoseRect2, \
                                 RelPoseRect)

* Compute the disparities in online images.
while (1)
  grab_image_async (Image1, AcqHandle1, -1)
  map_image (Image1, Map1, ImageMapped1)

  grab_image_async (Image2, AcqHandle2, -1)
  map_image (Image2, Map2, ImageMapped2)

  binocular_disparity(ImageMapped1, ImageMapped2, Disparity, Score, \
                      'sad', 11, 11, 20, -40, 20, 2, 25, \
                      'left_right_check', 'interpolation')
endwhile

6.binocular_disparity — Compute the disparities of a rectified image pair using correlation techniques.

 

 7.binocular_distance — Compute the distance values for a rectified stereo image pair using correlation techniques.

使用相关技术计算校正立体图像对的距离值。

8.disparity_image_to_xyz — Transform a disparity image into 3D points in a rectified stereo system.   

将视差图像转换为校正立体系统中的 3D 点。

9.xyz_attrib_to_object_model_3d — Transform 3D points from images to a 3D object model, and add extended attributes to the points of the object model. 

将 3D 点从图像转换为 3D 对象模型,并向对象模型的点添加扩展属性。

xyz_attrib_to_object_model_3d (X, Y, Z, ImageRGB, ['&red', '&green', '&blue'], ObjectModel3D)
prepare_object_model_3d (ObjectModel3D, 'segmentation', 'true', [], [])
visualize_object_model_3d (WindowHandle, ObjectModel3D, [], [], ['red_channel_attrib', 'green_channel_attrib', 'blue_channel_attrib'], ['&red', '&green', '&blue'], [], [], [], PoseOut)

10.prepare_object_model_3d — Prepare a 3D object model for a certain operation.

* This example program shows the usage of the procedure
* xyz_attrib_to_object_model_3d.
* It can be used to create 3D object models from X, Y and Z images,
* and simultaneously attach attributes to every point.
*
* Initialization
dev_update_off ()
dev_close_window ()
*
* Read the digital surface model.
read_image (Z, 'mreut_dgm_2.0.tif')
get_image_size (Z, Width, Height)
*
* Read image that contains the gray values that will be added
* to the 3D object model as attribute.
read_image (AerialImage, 'mreut4_3.png')
*
* Generate a label image with a second attribute.
* In this case, we label different terrain types very simply,
* just for demonstration purposes.
auto_threshold (AerialImage, Regions, 4)
region_to_label (Regions, LabelImage, 'byte', Width, Height)
*
* Create a multichannel image from both attribute images.
compose2 (AerialImage, LabelImage, MultiChannelAttribImage)
*
* Create images that contain X and Y coordinates in a regular grid.
* For a simple gray ramp, the input parameters of
* gen_image_surface_first_order are very simple:
GroundResolution := 2.0
gen_image_surface_first_order (X, 'real', 0, GroundResolution, 0, 0, 0, Width, Height)
gen_image_surface_first_order (Y, 'real', -GroundResolution, 0, 0, 0, 0, Width, Height)
*
* The following procedure creates a 3D object model from
* the X, Y and Z image and adds the information contained
* in the attribute image to each point.
AttribName := ['&gray','&terrain']
xyz_attrib_to_object_model_3d (X, Y, Z, MultiChannelAttribImage, AttribName, ObjectModel3D)
*
* Display results
*
dev_open_window (Height / 2, 0, Width / 2, Height / 2, 'black', WindowHandle1)
dev_set_part (0, 0, Height - 1, Width - 1)
set_display_font (WindowHandle1, 16, 'mono', 'true', 'false')
dev_set_color (['red','green','blue'])
dev_set_draw ('fill')
dev_display (Regions)
disp_message (WindowHandle1, 'Terrain types', 'window', 12, 12, 'black', 'true')
*
dev_open_window (0, 0, Width / 2, Height / 2, 'black', WindowHandle2)
set_display_font (WindowHandle2, 16, 'mono', 'true', 'false')
dev_display (AerialImage)
disp_message (WindowHandle2, 'Aerial image', 'window', 12, 12, 'black', 'true')
*
dev_open_window (0, Width / 2 + 8, Width, Height, 'gray', WindowHandle3)
set_display_font (WindowHandle3, 16, 'mono', 'true', 'false')
dev_display (Z)
*
disp_message (WindowHandle3, 'Digital surface model', 'window', 12, 12, 'black', 'true')
disp_continue_message (WindowHandle3, 'black', 'true')
stop ()
*
* Perform fast triangulation of the object model for better visualization.
prepare_object_model_3d (ObjectModel3D, 'segmentation', 'true', [], [])
* Visualize 3d object model interactively
create_pose (-620, -85, 17000, 135, 2, 10, 'Rp+T', 'gba', 'point', Pose)
Instructions := 'Rotate: Left button'
Instructions[1] := 'Zoom: Shift + left button'
Instructions[2] := 'Move: Ctrl + left button'
visualize_object_model_3d (WindowHandle3, ObjectModel3D, [], Pose, ['color_attrib','color_attrib_start','color_attrib_end'], ['&gray',0,255], ['Created 3D model','Attribute used for visualization: \'&gray\''], [], Instructions, PoseOut)
visualize_object_model_3d (WindowHandle3, ObjectModel3D, [], PoseOut, ['color_attrib','lut'], ['&terrain','color1'], ['Created 3D model','Attribute used for visualization: \'&terrain\''], [], Instructions, PoseOut)
disp_end_of_program_message (WindowHandle3, 'black', 'true')

11.get_domain — Get the domain of an image.    输入图像转为一个区域

The operator get_domain returns the definition domains of all input images as a region.

12.complement — Return the complement of a region.   返回一个区域的补集

13.full_domain — Expand the domain of an image to maximum.

将映像的域扩展到最大

 

标签:image,object,dev,HALCON,杂记,model,3d,3D
From: https://www.cnblogs.com/echo-efun/p/17974203

相关文章

  • halcon 双目相机标定
    *Applicationprogramtodemonstratethecalibrationof*abinocularstereosystemusingtheoperators*find_caltab,find_marks_and_pose,andbinocular_calibration.**Asanalternative,acalibrationdatamodelcouldbeused.*Pleaserefertotheex......
  • halcon #正则表达式
    此处提供了正则表达式语法的摘要。基本上正则表达式中的每个字符都表示要匹配的文本,除了以下具有特殊含义的符号(所描述的语法与Perl兼容):^匹配字符串的开头$匹配字符串末尾(允许使用尾随换行符).匹配除换行符以外的任何字符[...]匹配括号中列出的任何字符文本......
  • halcon中的tuple用法
    a:=[-10,100,130]t:=[-0.5,0.5,1]tuple_abs(a,Abs)*计算一个元组的绝对值*[10,100,130]tuple_acos(t,ACos)*计算一个元组的反余弦*参数1:输入元组。限制:-1<=t<=1*[2.0944,1.0472,0.0]tuple_add(a,t,Sum)*两个元组相加*[-10.5,100.5,131]tuple_asin......
  • 『周记』2024第二周杂记
    『周记』2024第二周杂记 这一周我的命运微妙地发生了改变……!签证在12号通过了! 总结本周的主旋律是解决杂事,以及拖到最后终于完成了最后那个(其实不大的)大作业。解决了一些关于交换的杂事,比如机票、租房和订手机卡(实在太感动了之前看中的那个厅卧还在……)钩针进步神速,已......
  • 集训杂记-省选篇
    12/3来到了衡实。要先找回代码的感觉……做一做联赛T4吧。12/4被卡常了。我不做了。学网络流去。最小割一直不太清楚这个东西是干什么的……果然需要多做一些题掌握一些模型?另外割成两块不是指彻底变成两块,而是源点和汇点之间不可达。做了两个题,感觉好魔幻啊。还是说......
  • 【四大力学杂记】统计力学概要——叩开多体系统之门
    这篇笔记是清华大学统计物理I的期末总结,是笔者于期中和同学集体复习前后总结笔记的大范围扩写,基本上覆盖了统计物理的大部分内容。当然因为篇幅和精力问题,笔者只有可能在部分内容上加以深化。虽然说是一篇基本的知识总结,但笔者仍然希望能够在平凡的复习内容中增加一些不同的理解......
  • halcon 标定
    1.标定板类型  a.Calibrationplatewithhexagonallyarrangedmarks  带有六边形排列标记的校准板    b.Calibrationplatewithrectangularlyarrangedmarks  带有矩形排列标记的校准板 2.标定过程a.准备校准输入数据1.create_calib_data ......
  • Halcon 相机外部参数标定例程一(camera_calibration_external.hdev)
    1.create_calib_data—CreateaHALCONcalibrationdatamodel  创建一个HALCON校准数据模型2.read_cam_par—Readinternalcameraparametersfromafile  从文件中读取相机内部参数  3.set_calib_data_cam_param—Settypeandinitialparametersofa......
  • Halcon threshold_sub_pix (Operator)
    read_image(Image,'fabrik')threshold_sub_pix(Image,Border,35)dev_display(Border)Image是输入的原始图像,Threshold是设定的阈值,Width和Height是像素值计算区域的大小,ThresholdedRegion是经过分割后得到的二值化结果。在对图像进行二值化处理时,threshold_sub_pix函数会对每个像......
  • WPF Halcon机器视觉和运动控制软件通用框架,插件式开发,开箱即用 仅供学习!
    点我下载,仅供个人学习使用参考easyvision开发,集成几十个软件算子此版本以添加ui设计器。具体功能如上所示,可以自定义变量,写c#脚本,自定义流程,包含了halcon脚本和封装的算子,可自定义ui,通过插件形式开发很方便拓展自己的功能。......