halcon数据类型: A. object 图形参数(图像image、区域region、轮廓xld) 图像image: 1.通道 count_channels(image1,Channels) 2.大小 get_image_size(image1,Width,Height) 3.类型 get_image_type(image1,Type) 4.灰度值:像素光强弱的表示(行列位置的) 获取: get_grayval(image1,10,10,Grayval) 改变: set_grayval(image1,10,10,100) 区域region: region of interst A. 创建规则区域,比如矩形、圆形 gen_rectangle1(ROI_0,140,939,307,307) gen_circle(ROI_0,140,939,307,307) B .创建不规则区域 gen_region_points (ROI_0,140,939,307,307) 轮廓xld : 创建轮廓 gen_circle_contour_xld(ContCircle,200,200,100.5,0,6.28,'positive',1) B. Control 控制参数(int、double、string)
区域操作: *提取所有回形针并结算角度 read_image(Image,'clip') *1.图像二值化 被选中的是1 没选中的是0 threshold (Image, Regions, 10, 84) *2.连通分割 connection (Regions, ConnectedRegions) count_obj (ConnectedRegions, Number) area_center (ConnectedRegions, Area, Row, Column) select_shape (ConnectedRegions, SelectedRegions, 'column', 'and', 79.82, 1000) count_obj (ConnectedRegions, Number) * 形态学变换 边缘有阴影可以进行腐蚀 *3.占用面积 fill_up (SelectedRegions, RegionFillUp) *3.1.腐蚀 erosion_rectangle1 (RegionFillUp, RegionErosion, 1, 1) *3.2.膨胀 dilation_rectangle1 (RegionErosion, RegionDilation, 1, 1) count_obj (ConnectedRegions, Number) *合并 union1 (RegionDilation, RegionUnion) union2 (RegionDilation, Regions, RegionUnion1) *减操作 difference (RegionUnion1, SelectedRegions, RegionDifference) *相交 intersection (RegionDifference, RegionErosion, RegionIntersection) *补集 complement (ConnectedRegions, RegionComplement) *区域转换 求最小外接椭圆 select_obj (SelectedRegions, ObjectSelected, 1) shape_trans (ObjectSelected, RegionTrans, 'convex')
本文来自博客园,作者:董锡振,转载请注明原文链接:https://www.cnblogs.com/dongxizhen/p/16963559.html