get_parallels_xld(Parallels : : : Row1, Col1, Length1, Phi1, Row2, Col2, Length2, Phi2)
计算第一个平行的XLD的以下值:
Row1, Col1, Length1, Phi1, 两平行线第一条两端点坐标与线长,线方向;
Row2, Col2, Length2, Phi2两平行线第二条两端点坐标与线长,线方向;
例程
read_image (Image, 'metal-parts/metal-parts-01')
threshold (Image, BrightRegion, 100, 255)
connection (BrightRegion, BrightRegions)
select_shape (BrightRegions, Nut, 'area', 'and', 500, 99999)
fill_up (Nut, NutFilled)
gen_contour_region_xld (NutFilled, NutContours, 'border')
segment_contours_xld (NutContours, LineSegments, 'lines', 5, 4, 2)
fit_line_contour_xld (LineSegments, 'tukey', -1, 0, 5, 2, RowBegin, ColBegin, RowEnd, ColEnd, Nr, Nc, Dist)
gen_empty_obj (Lines)
for I := 0 to |RowBegin| - 1 by 1
gen_contour_polygon_xld (Contour, [RowBegin[I],RowEnd[I]], [ColBegin[I],ColEnd[I]])
concat_obj (Lines, Contour, Lines)
endfor
gen_polygons_xld (Lines, Polygon, 'ramer', 2)
gen_parallels_xld (Polygon, ParallelLines, 50, 100, rad(10), 'true')
get_parallels_xld (ParallelLines, Row1, Col1, Length1, Phi1, Row2, Col2, Length2, Phi2)
gen_region_line (RegionLines, Row1[0], Col1[0], Row1[1], Col1[1])
gen_region_line (RegionLines1, Row2[0], Col2[0], Row2[1], Col2[1])
例程将一图像分割,提取XLD边缘,生成一对XLD类型平行线,
然后调用get_parallels_xld计算平行线的参数,
使用计算所得的参数生成两线段。
|