gen_contour_polygon


bb:=90
tuple_rad (bb, Rad)
threshold (Image, Region, 87, 255)
connection (Region, ConnectedRegions)
select_shape (ConnectedRegions, SelectedRegions, 'area', 'and', 140400, 295000)
region_features (SelectedRegions, 'area', Value)
region_
gen_contour_region_xld (SelectedRegions, Contours, 'border')
fit_rectangle2_contour_xld (Contours, 'tukey', -1, 0, 2, 3, 1, Row3, Column3, Phi2, Length11, Length21, PointOrder)
gen_region_contour_xld (Contours, Region2, 'filled')
tuple_length(Row3,Length)
for Index := 0 to Length-1 by 1
dev_display (Image)
Length1:= Length11[Index]
Length2:=Length21[Index]
Phi1:=Phi2[Index]
if(abs(deg(Phi2[Index]))>45)
    Phi1:=rad(deg(Phi2[Index])-90*(Phi2[Index]/abs(Phi2[Index])))
    Tmp:=Length11[Index]
    Length1:= Length21[Index]
    Length2:=Tmp
endif
tuple_sin (Phi1, Sin)
tuple_cos (Phi1, Cos)
*左上角
TopLeft_X := -Length1*Cos - Length2*Sin
TopLeft_Y := -Length1*Sin + Length2*Cos
TopLeft_Row := Row3[Index] - TopLeft_Y 
TopLeft_Col := Column3[Index] + TopLeft_X 

*右上角
TopRight_X := Length1*Cos - Length2*Sin
TopRight_Y := Length1*Sin + Length2*Cos
TopRight_Row := Row3[Index] - TopRight_Y 
TopRight_Col := Column3[Index] + TopRight_X 

*右下角
LowerRight_X := Length1*Cos + Length2*Sin
LowerRight_Y := Length1*Sin - Length2*Cos
LowerRight_Row := Row3[Index] - LowerRight_Y 
LowerRight_Col := Column3[Index] + LowerRight_X 
 
*左下角
LowerLeft_X := -Length1*Cos + Length2*Sin
LowerLeft_Y := -Length1*Sin - Length2*Cos
LowerLeft_Row := Row3[Index] - LowerLeft_Y 
LowerLeft_Col := Column3[Index] + LowerLeft_X 
row:=[TopLeft_Row,TopRight_Row,LowerRight_Row,LowerLeft_Row,TopLeft_Row]
col:=[TopLeft_Col,TopRight_Col,LowerRight_Col,LowerLeft_Col,TopLeft_Col]
gen_contour_polygon_rounded_xld (Contour, [TopLeft_Row,TopRight_Row,LowerRight_Row,LowerLeft_Row,TopLeft_Row], [TopLeft_Col,TopRight_Col,LowerRight_Col,LowerLeft_Col,TopLeft_Col], [0,0,0,85,0], 1)
gen_region_contour_xld (Contour, Region1, 'filled')
difference (Region2, Region1, RegionDifference)
connection (RegionDifference, ConnectedRegions1)
select_shape (ConnectedRegions1, SelectedRegions1, 'area', 'and', 1000, 99999)
wait_seconds (6)
endfor
 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值