HALCON形状匹配

* This example program shows the creation of shape models
* from XLD contours.
* In this example, the possibility to create a shape model from
* XLD contours is used to incorporate knowledge about the
* object's geometry. The objective is to find the four medium-sized
* holes. It is known that these holes are circular and that they have
* the same size.
* To use this knowledge, the holes are extracted from the image.
* Then, circles are fitted into the contours that represent the holes.
* In the next step, one circular XLD contour is created using the
* mean radius of the four fitted circles. Finally, this XLD contour is
* used to create the shape model.
* 
* In the second part of the example program, we use the additionally
* available knowledge that the circles are arranged in a square.
* Therefore, we create four circular contours arranged in a square
* that has the same size as the quadrilateral enclosed by the extracted
* circles. These contours are used as input for the shape model creation.
* 
* Read the image of the brake disc and determine the size of the holes.
read_image (Image, 'brake_disk/brake_disk_part_01')
dev_update_off ()
dev_close_window ()
dev_open_window_fit_image (Image, 0, 0, 640, 640, WindowHandle)
set_display_font (WindowHandle, 16, 'mono', 'true', 'false')
dev_set_color ('lime green')
dev_set_line_width (3)
binary_threshold (Image, Region, 'smooth_histo', 'light', UsedThreshold)
connection (Region, Holes)
select_shape (Holes, SmallHoles, 'area', 'and', 5000, 10000)
boundary (SmallHoles, RegionBorder, 'inner_filled')
dilation_circle (RegionBorder, RegionBorderDilation, 3.5)
union1 (RegionBorderDilation, ROI)
reduce_domain (Image, ROI, ImageReduced)
edges_sub_pix (ImageReduced, Edges, 'canny', 0.5, 20, 40)
fit_circle_contour_xld (Edges, 'algebraic', -1, 0, 0, 3, 2, RowCenter, ColumnCenter, Radius, StartPhi, EndPhi, PointOrder)
dev_display (Image)
dev_display (Edges)
disp_message (WindowHandle, 'Extracted edges', 'window', -1, -1, 'lime green', 'false')
disp
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值