read_image (Image33, 'E:/Halcon数据/资源图片/33.png')
get_image_size (Image33, Width, Height)
for Index := 0 to 50 by 1
*线
RowBegin:=500+Index
ColBegin:=100
RowEnd:=500-Index
ColEnd:=500
gen_contour_polygon_xld (Contour2, [RowBegin,RowEnd], [ColBegin,ColEnd])
RowLine1:=RowBegin
RowLine2:=RowEnd
ColLine1:=ColBegin
ColLine2:=ColEnd
LineParam1:=[]
ChaR:=RowLine2-RowLine1
ChaC:=ColLine2-ColLine1
if(ChaR=0 or ChaC=0 )
if (ChaR=0)
LineParam1:=[RowLine1,RowLine1,0,Width]
elseif (ChaC=0)
LineParam1:=[0,ColLine1,Height,ColLine1]
endif
else
k11:=(RowLine2-RowLine1)*1.0/(ColLine2-ColLine1)
tuple_real (k11, k1)
b1:=RowLine2-k1*ColLine2
angle_lx (RowLine1, ColLine1, RowLine2, ColLine2, Angle)
C1:=1
R1:=k1*C1+b1
C2:=Width-1
R2:=k1*C2+b1
LineParam1:=[R1,R2,C1,C2]
endif
gen_contour_polygon_xld (Contour1, [LineParam1[0],LineParam1[1]], [LineParam1[2],LineParam1[3]])
wait_seconds (1)
dev_display (Contour1)
endfor