fit_line_contour_xld.hdev
fit_line_contour_xld(Contours : : Algorithm, MaxNumPoints, ClippingEndPoints, Iterations, ClippingFactor : RowBegin, ColBegin, RowEnd, ColEnd, Nr, Nc, Dist)
參數說明:
1 Contours 輸入的輪廓
2 Algorithm 拟合直線算法
'regression' 标準的最小二乘拟合; 最簡單,但是受離群點的影響比較大,魯棒性不強。
'huber' 權重最小二乘拟合,通過Huber方法減小離群點的影響
'tukey' 權重最小二乘拟合,通過Tukey方法減小離群點的影響【預設】
'drop':權重的最小二乘法拟合,異常值的影響被消除【平頂】
'gauss':權重的最小二乘法拟合,異常值的影響被減小基于最逼近線上的所有其輪廓點的平均值和距離标準方差【高斯】
參數清單:
MaxNumPoints(in):用于計算的最大輪廓點個數
ClippingEndPoints(in):在逼近過程中被忽略的開始及末尾點個數
Iterations(in):疊代的最大次數
ClippingFactor(in):消除異常值的裁剪因子,即削波系數,用于消除異常值,預設2.0
RowBegin(out):線段開始點的行坐标
ColBegin(out):線段開始的列坐标
RowEnd(out):線段結尾的行坐标
ColEnd(out):線段結尾的列坐标
Nr(out):線參數:法向量的行坐标
Nc(out):法向量的列坐标
Dist(out):原點到該線的距離
ClippingFactor控制被弱化的異常值個數,值越小,越多異常值被檢測到。
最小拟合一條線的必要輪廓點個數是2,是以,一條輪廓線點個數至少是2+2*ClippingEndPoints
可能前置項:
gen_contours_skeleton_xld, lines_gauss, lines_facet, edges_sub_pix, smooth_contours_xld
可能後置項:
disp_line, select_lines, line_orientation
可替代項:
regress_contours_xld, get_regress_params_xld
read_image (Image, 'mreut')
edges_sub_pix (Image, Edges, 'lanser2', 0.5, 20, 40)
gen_polygons_xld (Edges, Polygons, 'ramer', 2)
split_contours_xld (Polygons, Contours, 'polygon', 1, 5)
fit_line_contour_xld (Contours, 'regression', -1, 0, 5, 2, RowBegin, \
ColBegin, RowEnd, ColEnd, Nr, Nc, Dist)
read_image (Image, 'C:/Users/Administrator/Desktop/1.png')
threshold (Image, Regions, 0, 112)
skeleton(Regions,TriangleSkeleton)
gen_contours_skeleton_xld(TriangleSkeleton,TriangleContours,1,'filter')
segment_contours_xld(TriangleContours,ContoursSplit,'lines_circles', 5, 4, 2)
select_contours_xld(ContoursSplit,SelectedContours, 'contour_length',100, 999, -0.5, 0.5)
fit_line_contour_xld (SelectedContours, 'tukey', -1, 10, 5, 2, RowBegin, ColBegin, RowEnd, ColEnd, Nr, Nc, Dist)
*計算三個夾角
angle_ll (RowBegin[0], ColBegin[0], RowEnd[0], ColEnd[0], RowBegin[1], ColBegin[1], RowEnd[1], ColEnd[1], Angle1)
angle_ll (RowBegin[0], ColBegin[0], RowEnd[0], ColEnd[0], RowBegin[2], ColBegin[2], RowEnd[2], ColEnd[2], Angle2)
angle_ll (RowBegin[1], ColBegin[1], RowEnd[1], ColEnd[1], RowBegin[2], ColBegin[2], RowEnd[2], ColEnd[2], Angle3)
Angle1:=abs(deg(Angle1))
Angle2:=abs(deg(Angle2))
Angle3:=abs(deg(Angle3))
dev_display (Image)
dev_display (SelectedContours)
disp_message (3600, '角度:' + Angle1 + '°、 ' + Angle2 + '°、 ' + Angle3 + '°', 'image', 20, 20, 'red', 'true')
fit_circle_contour_xld.hdev
fit_circle_contour_xld
參數Algorithm的可選項解釋如下:
algebraic:這種方法減少了輪廓點與結果圓之間的代數距離
ahuber:類似于algebraic,輪廓點被權重以減小異常值的影響基于方法Huber
atukey:類似于algebraic,輪廓點被權重以減小異常值的影響基于方法Tukey
geometric:該法減少了輪廓點與結果圓之間的幾何距離,該法被統計是最優的,但占用很多計算時間。如果輪廓點被噪聲幹擾嚴重,可以考慮使用該方法。
geohuber:類似于geometric,輪廓點被權重以減小異常值的影響基于方法Huber
geotukey:類似于geometric,輪廓點被權重以減小異常值的影響基于方法Tukey
fit_ellipse_contour_xld.hdev
fit_ellipse_tooth_rim_xld.hdev
fit_rectangle2_contour_xld.hdev
---
鳥叔封裝的halcon rake卡直線 spoke卡圓工具(開源版) v1.3 20190527
提示資訊 - Halcon視覺之家 - 51Halcon專注于機器視覺技術