halcon分别求取Region区域顶点和最高点

阅读: 评论:0

halcon分别求取Region区域顶点和最高点

halcon分别求取Region区域顶点和最高点

Word编辑器可以生成很多形状,举例七角星

 求顶点和最高点的源码如下:

*求取区域顶点,方法1
dev_close_window()
read_image (Image1, 'testpic/求取区域顶点.png')
dev_open_window_fit_image (Image1, 0, 0, -1, -1, WindowHandle)
points_foerstner (Image1, 1, 2, 3, 200, 0.3, 'gauss', 'false', RowJunctions, ColumnJunctions, CoRRJunctions, CoRCJunctions, CoCCJunctions, RowArea, ColumnArea, CoRRArea, CoRCArea, CoCCArea)
dev_display (Image1)
for Index := 0 to |RowJunctions|-1 by 1disp_cross (WindowHandle, RowJunctions[Index], ColumnJunctions[Index], 50, 0)
endfor
stop()*求取区域顶点,方法2
*五角星的顶点,直接补个外凸多边形,拿多边形的内边界和五角星取交集
invert_image (Image1, ImageInvert)
threshold (ImageInvert, Region, 128, 255)
shape_trans (Region, RegionTrans, 'convex')
boundary (RegionTrans, RegionBorder, 'inner')
intersection (RegionBorder, Region, RegionIntersection)
connection (RegionIntersection, ConnectedRegions)
area_center (ConnectedRegions, Area, Row, Column)
dev_display (Image1)
for Index := 0 to |Row|-1 by 1disp_cross (WindowHandle, Row, Column, 50, 0)
endfor
stop()*给你一个region,怎样得出区域的最高点
invert_image (Image1, ImageInvert)
threshold (ImageInvert, Region, 128, 255)
shape_trans (Region, RegionTrans, 'rectangle1')
move_region (RegionTrans, RegionMoved, 1, 0)
difference (Region, RegionMoved, RegionDifference)
area_center (RegionDifference, Area, Row, Column)
dev_display (Image1)
disp_cross (WindowHandle, Row, Column, 50, 0)
stop()

 效果图:

各个顶点

最高点 

本文发布于:2024-02-04 15:51:05,感谢您对本站的认可!

本文链接:https://www.4u4v.net/it/170710954756836.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

上一篇:
下一篇:UE4材质07
标签:最高点   顶点   求取   区域   halcon
留言与评论(共有 0 条评论)
   
验证码:

Copyright ©2019-2022 Comsenz Inc.Powered by ©

网站地图1 网站地图2 网站地图3 网站地图4 网站地图5 网站地图6 网站地图7 网站地图8 网站地图9 网站地图10 网站地图11 网站地图12 网站地图13 网站地图14 网站地图15 网站地图16 网站地图17 网站地图18 网站地图19 网站地图20 网站地图21 网站地图22/a> 网站地图23