部分halcon函数整理版
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
halcon函数应用
1、read_image (Image, 'F:/image/001.bmp') 读入图像
2、threshold (Image, region, 100, 200) 阈值分割,获取区域
3、dev_close_window() 关闭当前图形窗口
4、dev_open_window (0, 0, 640, 480, 'black', WindowHandle) 打开一个新的图像窗口
5、decompose3 (Image, Red, Green, Blue) 三通道图像转换成三幅单通道图像
5.5、compose3(Red, Green, Blue, Image) 三幅单通道图像组合为三通道图像
6、connection (Region, ConnectedRegions) 将像素有相连的区域合并成一个元素element
7、count_obj(ConnectedRegions, Number) 计算元素element的个数
8、select_shape(Regions, SelectedRegions, Features, Operation, Min, Max)
select_shape (ConnectedRegions,SelectedRegions,['area','anisometry'], 'and', [500,1.0], [50000,1.7]) 连通域形状的选择
circularity:表示环状;充实度
roundness:圆度
9、dev_set_color('red') 设定输出的颜色
10、dev_set_draw ('margin') 或者dev_set_draw ('fill') 确定区域填充模式
11、get_image_size (Image, Width, Height) 得到图像的宽度和高度
12、get_image_pointer1 (Image_slanted, Pointer, Type, Width, Height) 设定Pointer 指向Image_slanted的起点位置。
13、dev_set_part (0, 0, Height-1, Width-1) 设定图像需要显示的范围
14、dev_display (Image_slanted) 显示图像
15、disp_continue_message(WindowHandle, 'blue', 'false') 等待用户操作是否继续stop ()
16、projective_trans_image (Image_slanted, Image_rectified, HomMat2D, 'bilinear', 'false', 'false') 将投影变换应用于一幅图像中。
17、dev_set_line_width (5) 为区域轮廓线设定线宽
18、disp_message (WindowHandle, 'Decoded string: ', 'window', -1, -1, 'black', 'true') 程序写一个文本信息
19、union_collinear_contours_xld 合并在同一直线的XLD
union_cocircular_contours_xld 合并在同圆的XLD
union_adjacent_contours_xld 合并邻近的XLD
20、fit_line_contour_xld 拟合直线
21、trans_from_rgb(Rimage,Gimage,Bimage,Image1,Image2,Image3,'hsv') rgb颜色空间图像转换到hsv颜色空间图像
22、trans_to_rgb(Image1,Image2,Image3,ImageRed,ImageGreen,ImageBlue,'hsv') hsv 颜色空间图像转换到rgb颜色空间图像
23、set_display_font (WindowID, 20, 'mono', 'true', 'false') 设置字体(bottle.hdev)
24、fill_up_shape (RawSegmentation, RemovedNoise, 'area', 1, 5) 根据给定的形状特征填补区域中的不足
25、opening_circle (RemovedNoise, ThickStructures, 2.5) 以半径为2.5像素先腐蚀再膨胀,开运算去除小区域。
26、fill_up (ThickStructures, Solid) 填补区域中的空洞
27、intersection (ConnectedPatterns, ThickStructures, NumberCandidates) 求两个区域的交集然后输出,求ConnectedPatterns区域和ThickStructures区域的交集,输出NumberCandidates
28、dev_set_shape ('rectangle1') 设置外接矩形
29、distance_lr (SelectedRegions, Row1, Col1, Row2, Col2, DistanceMin, DistanceMax) 计算直线和区域之间的距离,出现最小距离和最大距离
30、disp_line (WindowID, Row1, Col+100, Row2, Col) 绘制直线段(Col+100, Row1)为起点,(Col, Row2)为终点
30.5、disp_circle (WindowID, RowPoint, ColPoint, 10) 在指定点(ColPoint,RowPoint)绘制直接为10的圆
注意:y1 = Row1, x1 = Col+100. y2 = Row2, x2 = Col. 先y后x的值(distance_lr.hdev)
31、distance_pc (Hole, Row, Column, DistanceMin, DistanceMax) 计算点到轮廓之间的最大距离和最小距离,其中(Column, Row)为规定的点。
32、edges_sub_pix (Rim, Edges, 'lanser2', 0.3, 10, 40) 使用Deriche, Lanser, Shen, or Canny filters等算子提取精确的亚像素边缘。
33、sort_contours_xld (Holes, Holes, 'upper_left', 'true', 'row') 根据相对位置选择轮廓
34、smallest_circle_xld (Holes, Row, Column, Radius) 确定完整的圆
35、disp_cross (WindowID, Row[i-1], Column[i-1], 6, 0) 在指定点的位置绘制一个十字标记
36、get_region_contour (SelectedRegions, Rows, Columns) 访问一个已经确定区域