标签:col rect alc bsp ros distance ict rectangle measure
read_image(Image,'C:/Users/研发/Pictures/Saved Pictures/qq.bmp')dev_set_draw ('margin')
get_image_size(Image, Width, Height)
Row:=[479,479,479,479,479]
Col:=[450,455,460,465,470]
RowAfter:=[]
ColAfter:=[]
RowSelect:=[]
ColSelect:=[]
for Index:=0 to 4 by 1
gen_measure_rectangle2(Row[Index],Col[Index],rad(-90), 20, 2, Width, Height, 'nearest_neighbor', MeasureHandle)
gen_rectangle2(Rectangle,Row[Index],Col[Index],rad(-90), 20, 2)
measure_pos (Image, MeasureHandle, 3, 30, 'positive', 'first', RowEdge, ColumnEdge, Amplitude, Distance)
gen_cross_contour_xld(Cross, RowEdge, ColumnEdge, 6, 0.785398)
RowAfter[Index]:=RowEdge
ColAfter[Index]:=ColumnEdge
endfor
*所有点拟合直线
gen_contour_polygon_xld(Contour,RowAfter,ColAfter)
fit_line_contour_xld(Contour, 'tukey', -1, 0, 5, 2, RowBegin, ColBegin, RowEnd, ColEnd, Nr, Nc, Dist)
gen_contour_polygon_xld (ContourD, [RowBegin,RowEnd], [ColBegin,ColEnd])
distance_pl(RowAfter,ColAfter,RowBegin,ColBegin,RowEnd,ColEnd,Distance1)
i:=0
for Index:=0 to 4 by 1
if(Distance1[Index]<0.4)
RowSelect[i]:=RowAfter[Index]
ColSelect[i]:=ColAfter[Index]
i:=i+1
endif
endfor
dev_set_color('green')
*筛选后的点再拟合直线
gen_contour_polygon_xld(Contour1,RowSelect,ColSelect)
fit_line_contour_xld(Contour1, 'tukey', -1, 0, 5, 2, RowBegin1, ColBegin1, RowEnd1, ColEnd1, Nr, Nc, Dist)
gen_contour_polygon_xld (ContourRet, [RowBegin1,RowEnd1], [ColBegin1,ColEnd1])
标签:col rect alc bsp ros distance ict rectangle measure
原文地址:http://blog.51cto.com/green906/2156893