首页 > 其他 > 详细

意外-矩形变成xld后将成为4条线段,圆只是1条线段

时间:2020-06-02 17:13:30      阅读:55      评论:0      收藏:0      [点我收藏+]

read_image (Image, ‘D:/Project/PC_视觉类/视库/样图/二维测量例子2.png‘)
threshold_sub_pix (Image, Border, 128)
dev_get_window (WindowHandle)

segment_contours_xld (Border, ContoursSplit, ‘lines_circles‘, 5, 4, 2)

count_obj (ContoursSplit, Number)

for Index := 1 to Number by 1
select_obj (ContoursSplit, ObjectSelected, Index)
get_contour_global_attrib_xld (ObjectSelected, ‘cont_approx‘, Attrib)   //注意:自动带出来的好像不是cont_approx

dev_clear_window ()
if(Attrib == -1)
fit_line_contour_xld (ObjectSelected, ‘tukey‘, -1, 0, 5, 2, RowBegin, ColBegin, RowEnd, ColEnd, Nr, Nc, Dist)
disp_line (WindowHandle, RowBegin, ColBegin, RowEnd, ColEnd)
endif

if(Attrib ==1)
fit_circle_contour_xld (ObjectSelected, ‘algebraic‘, -1, 0, 0, 3, 2, Row, Column, Radius, StartPhi, EndPhi, PointOrder)
gen_circle (Circle, Row, Column, Radius)
endif
stop ()
endfor

技术分享图片

 

意外-矩形变成xld后将成为4条线段,圆只是1条线段

原文:https://www.cnblogs.com/dingyd/p/13031137.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!