Halcon线段延申为直线

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
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值