halcon rectangle2的四个顶点并生成矩形

 

*rectangle2的四个顶点
read_image (Image2020090611045988id1, 'C:/Users/ytg18/Desktop/2020090611045988ID1.bmp')
get_image_size (Image2020090611045988id1, Width, Height)
dev_set_draw ('margin')
gen_rectangle2 (Rectangle,  Height/2, Width/2,0, Height/3, Width/4)
reduce_domain (Image2020090611045988id1, Rectangle, ImageReduced)
binary_threshold (ImageReduced, Region, 'max_separability', 'dark', UsedThreshold)
connection (Region, ConnectedRegions)
select_shape_std (ConnectedRegions, SelectedRegions, 'max_area', 70)
smallest_rectangle2 (SelectedRegions, Row16, Column16, Phi3, Length1, Length2)
dev_set_color('red')
tuple_cos (Phi3, Cos)
tuple_sin (Phi3, Sin)
dev_set_color('red')
a:= -Length1*Cos - Length2*Sin
b := -Length1*Sin + Length2*Cos
gen_cross_contour_xld(Cross1, Row16-b,  Column16+a, 56, Phi3)
gen_rectangle2 (Rectangle1, Row16-b, Column16+a, Phi3, Length1/3, Length2/2)
c := Length1*Cos - Length2*Sin
d := Length1*Sin + Length2*Cos
gen_cross_contour_xld(Cross2, Row16-d, Column16+c, 56, Phi3)
gen_rectangle2 (Rectangle2, Row16-d, Column16+c, Phi3, Length1/3, Length2/2)
e:= Length1*Cos + Length2*Sin
f := Length1*Sin - Length2*Cos
gen_cross_contour_xld(Cross3, Row16-f, Column16+e, 56, Phi3)
 gen_rectangle2 (Rectangle2, Row16-f, Column16+e, Phi3, Length1/3, Length2/2)
g := -Length1*Cos + Length2*Sin
h := -Length1*Sin - Length2*Cos
gen_cross_contour_xld(Cross4, Row16-h, Column16+g, 56, Phi3)
 gen_rectangle2 (Rectangle2, Row16-h, Column16+g, Phi3, Length1/3, Length2/2)

 

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值