XLD端点及XLD方向

XLD中点概念

若xld严格为直线状则中点近似默认在xld轮廓中心处,否则为转为region后的area_center中心

*xld线段的中点
dev_get_window (WindowHandle)
draw_xld (ContOut,WindowHandle , 'true', 'true', 'true', 'true')
*此时获取的xld的中点实际为xld转region后的中心
area_center_points_xld (ContOut, Area, Row, Column)
dev_set_color ('red')
gen_cross_contour_xld (Cross, Row, Column, 20, 0.785398)
gen_region_contour_xld (ContOut, Region, 'filled')
area_center (Region, Area1, Row1, Column1)
dev_set_color ('yellow')
gen_cross_contour_xld (Cross1, Row1, Column1, 20, 0.785398)

在这里插入图片描述
图中,绿色为xld轮廓,红色交叉点为当前轮廓的中心,可见area_center_points_xld (ContOut, Area, Row, Column)算子为轮廓首位相连行程区域后再计算的中心点。

XLD端点概念

*xld线段的端点获取

*方式1:获取xld轮廓点,通过元组下标获取端点
dev_get_window (WindowHandle)
dev_set_color ('blue')
draw_xld (ContOut,WindowHandle , 'true', 'true', 'true', 'true')
get_contour_xld (ContOut, Row, Col)
StartPointRow:=Row[0]
StartPointCol:=Col[0]
EndPointRow:=Row[|Row|-1]
EndPointCol:=Col[|Col|-1]

gen_cross_contour_xld (Cross1, StartPointRow, StartPointCol, 6, 0.785398)
gen_cross_contour_xld (Cross2, EndPointRow, EndPointCol, 6, 0.785398)

*方式2:xld轮廓转region,region提取骨架后取端点
gen_region_contour_xld (ContOut, Region, 'filled')
skeleton (Region, Skeleton)
*获取骨架端点
junctions_skeleton (Skeleton, EndPoints, JuncPoints)
get_region_points (EndPoints, Rows, Columns)

gen_cross_contour_xld (Cross3, Rows[0], Columns[0], 6, 0.785398)
gen_cross_contour_xld (Cross4, Rows[1], Columns[1], 6, 0.785398)

在这里插入图片描述
图中,绿色为xld轮廓,红色叉点为轮廓端点,两种获取方式只有精度差异。

XLD角度概念

*xld方向
*获取xld方向的几种方法
*以(256256)为中心点,分别向8个方向画射线
LineLength:=100
gen_empty_obj (lines)
for Index := 0 to 315 by 45
gen_region_line (RegionLines, 256, 256, 256+LineLength*sin(rad(Index)), 256+LineLength*cos(rad(Index)))
concat_obj (lines, RegionLines, lines)
endfor
stop()
count_obj (lines, Number)
*方式一:直接获取xld轮廓方向-(-3.14~3.14】与Orientation_region保持一致
gen_contour_region_xld (lines, Contours, 'border')
orientation_xld (Contours, Phi)

*方式二:通过拟合椭圆--1.571.57-与smallest_rectangle2保持一致都是使用反正切计算
elliptic_axis_xld (Contours, Ra, Rb, Phi1)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

火星wen

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值