1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > HALCON_XLD轮廓算子_二

HALCON_XLD轮廓算子_二

时间:2021-05-28 05:22:44

相关推荐

HALCON_XLD轮廓算子_二

boundary

boundary (RegionTrans, RegionBorder, 'inner')

边界,输出结果是 regin区域

原始

效果

算子使用

regiongrowing

**基于区域生长的图像分割

regiongrowing

检测这种缺陷

在边缘的缺陷,但是边缘太细小了

这种情况下 使用二值化的方式,不好把刀具的缺口给拉出来,或者把刀具整个从图像中拉出来。

**基于区域生长的图像分割

regiongrowing (Image, Regions, 3, 3, 6, 10000)

threshold_sub_pix

亚像素阈值

threshold_sub_pix (ImageReduced, Border, 80)select_shape_xld (Border, SelectedXLD, ['contlength','outer_radius'], 'and', [70,15], [99999,99999])segment_contours_xld (SelectedXLD, ContoursSplit, 'lines_circles', 4, 2, 2)select_shape_xld (ContoursSplit, SelectedXLD3, ['outer_radius','contlength'], 'and', [15,30], [45,99999])

reduce_domain (ImageGray, Circle, ImageReduced)edges_sub_pix(ImageReduced, Edges, 'canny', 1, 20, 40)select_contours_xld(Edges, SelectedContours, \'contour_length',20, 200, -0.5, 0.5)*二值化找出目标区域* binary_threshold ( ImageReduced, Region, 'max_separability', 'light', UsedThreshold)* segment_contours_xld (Edges, ContoursSplit, 'lines_circles', 5, 4, 2)*将共圆上的轮廓连接起来** 参数 0.9 最大弧度差, 0.5 最大重叠角度, 0.5最大切角, ** 参数 200 最大距离, 50最大半径差, 50 最大中心距离, ** 参数 'true' 合并小轮廓, 1 迭代次数union_cocircular_contours_xld (SelectedContours, \UnionContours, 0.9, 0.5, 0.5, \200, 50, 50, 'true', 1)**合并共线XLD轮廓* union_collinear_contours_xld (UnionContours, \UnionContours1, 10, 1, 2, 0.1, \'attr_keep')**创建多边形XLD轮廓**gen_contour_polygon_xld (Contour, [0,1,2,2,2], [0,0,0,1,2])*获取轮廓的长度length_xld (UnionContours, Length)tuple_length(Length, Number)*对长度数值进行降序排列,并获取数值最大的长度值* select_obj (UnionContours, LongestContour, sort_index(Length)[|Length|-1]+1)tuple_sort_index(Length,indice)longgest_circle:=Length[indice[Number-1]]* select_obj (UnionContours, LongestContour, sort_index(Length)[|Length|-1]+1)select_obj (UnionContours, LongestContour, indice[Number-1]+1)*对最大的轮廓进行拟合圆操作fit_circle_contour_xld (LongestContour, 'ahuber', -1, 0, 0, 3, 2, Row, Column, Radius, StartPhi, EndPhi, PointOrder)*生成拟合圆dev_clear_window()dev_display(Image)gen_circle (Circle, Row, Column, Radius)*对拟合圆进行膨胀运算

这个 XLD轮廓拟合椭圆

**XLD轮廓拟合椭圆** 参数 'fitzgibbon' 对椭圆拟合算法, -1 最大点数, 0 最大封闭距离, ** 参数 0 夹点, 200 tab个数, 3 迭代次数,2 裁剪因子,** 以下参数为输出元素** 参数 Row, Column 椭圆中心坐标, Phi 主轴线方向角度** 参数 Radius1, Radius2 长短半轴的长度,** 参数 StartPhi, EndPhi 开始和结束角度, PointOrder 点顺序fit_ellipse_contour_xld (Contour, 'fitzgibbon', -1, 0, 0, 200, \3, 2, Row, Column, Phi, Radius1, Radius2,\StartPhi, EndPhi, PointOrder)**创建椭圆XLD轮廓 ** 参数 0 起点角度, 6.28318 终点角度, 'positive' 方向, 1.5分辨率gen_ellipse_contour_xld(ContEllipse, Row, Column, Phi, Radius1, Radius2,\0, 6.28318, 'positive', 1.5)

由区域生成轮廓

gen_contour_region_xld (SelectedRegions, Contours, 'border')

XLD轮廓的特征提取,按照角度

* OrientationRef := 20* OrientationTolerance := 15at_num_mix:=rad([OrientationRef,OrientationRef - 180]) - rad(OrientationTolerance)at_num_max:=rad([OrientationRef,OrientationRef - 180]) + rad(OrientationTolerance)select_shape_xld (ContoursSplit, SelectedXLD, ['orientation_points','orientation_points'],\'or', at_num_mix,at_num_max)

看这三条线 与水平线的夹角

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。