在视觉测量中我们很会被毛刺问题困扰,产生干扰的因素很多,有打光问题和产品本生带毛刺,接下来给兄弟们带来两种去毛刺的方法。
第一种
read_image (Image1323153Ba0b96cf52f88f1, '1')
rgb1_to_gray (Image1323153Ba0b96cf52f88f1, GrayImage)
laplace_of_gauss (GrayImage, ImageLaplace, 0.5)
threshold_sub_pix (ImageLaplace, Border, 1)
select_obj (Border, ObjectSelected, 1)
smooth_contours_xld (ObjectSelected, SmoothedContours, 15)
get_contour_xld (SmoothedContours, Row1, Col1)
get_contour_xld (ObjectSelected, Row2, Col2)
*错误距离阈值
errdist:=0.5
distRow:= sqrt((Row1-Row2)*(Row1-Row2)+(Col1-Col2)*(Col1-Col2))
a:=find(distRow[>]errdist,1)
e:=Row2[a]
g:=Col2[a]
dev_display (Image1323153Ba0b96cf52f88f1)
gen_cross_contour_xld (Cross, e, g, 10, 0.785398)
运行结果
image.png