Halcon图像预处理与形态学(形态学)

1. 腐蚀和膨胀

1.1 定义

腐蚀的作用是消除物体边界点,膨胀是把图像周围的北京店合并到物体中。
对于二值图像来说:

  • 膨胀:增加元素
  • 腐蚀:减少元素
  • 闭运算:先膨胀后腐蚀
  • 开运算:先腐蚀后膨胀
  • 减少或断开像素:用腐蚀或开运算
  • 增加或连接像素:用膨胀或闭运算

1.2 算子

腐蚀
erosion1(Region, StructElement : RegionErosion : Iterations : )
Erode a region.
erosion2(Region, StructElement : RegionErosion : Row, Column, Iterations : )
Erode a region (using a reference point). 用参考点
erosion_circle(Region : RegionErosion : Radius : )
Erode a region with a circular structuring element.
erosion_rectangle1(Region : RegionErosion : Width, Height : )
Erode a region with a rectangular structuring element.

膨胀
dilation1(Region, StructElement : RegionDilation : Iterations : )
Dilate a region.
dilation2(Region, StructElement : RegionDilation : Row, Column, Iterations : )
Dilate a region (using a reference point).
dilation_circle(Region : RegionDilation : Radius : )
Dilate a region with a circular structuring element.
dilation_rectangle1(Region : RegionDilation : Width, Height : )
Dilate a region with a rectangular structuring element.

2. 开运算和闭运算

opening(Region, StructElement : RegionOpening : : )
opening_circle(Region : RegionOpening : Radius : )
opening_rectangle1(Region : RegionOpening : Width, Height : )

closing(Region, StructElement : RegionClosing : : )
closing_circle(Region : RegionClosing : Radius : )
closing_rectangle1(Region : RegionClosing : Width, Height : )

3. 骨架

骨架是指图像中央的骨骼部分,是描述图像几何拓扑性质的重要特征。

3.1 junctions_skeleton / split_skeleton_lines

junctions_skeleton(Region : EndPoints, JuncPoints : : )
Find junctions and end points in a skeleton. 连接点和终点
split_skeleton_lines(SkeletonRegion : : MaxDistance : BeginRow, BeginCol, EndRow, EndCol)
Split lines represented by one pixel wide, non-branching lines.

read_image (Image, 'clip')
threshold (Image, Region, 0, 80)
connection (Region, ConnectedRegions)
select_shape (ConnectedRegions, SelectedRegions, 'rect2_len1', 'and', 67.4, 128.66)
*计算骨骼
skeleton (SelectedRegions, Skeleton)
*计算骨骼的端点和关节点
junctions_skeleton (Skeleton, EndPoints, JuncPoints)
*从骨骼中去除关节点,把骨骼分割成单像素宽度、无分支区域
difference (Skeleton, JuncPoints, RegionDifference)
connection (RegionDifference, ConnectedRegions1)
select_shape (ConnectedRegions1, SelectedRegions1, 'area', 'and', 10, 99999)
*把区域分割成直线段区域,输出近似直线的起点和终点坐标
split_skeleton_lines (SelectedRegions1, 5, BeginRow, BeginCol, EndRow, EndCol)
dev_display (Image)
dev_set_colored (6)
split_skeleton_region (SelectedRegions1, RegionLines, 3)

骨骼

3.2 split_skeleton_region

split_skeleton_region(SkeletonRegion : RegionLines : MaxDistance : )
Split lines represented by one pixel wide, non-branching regions.
功能:把骨骼分割为多条宽度为一个像素、无分支的直线

read_image(Image,'clip')
threshold (Image, Region, 0, 80)
connection (Region, ConnectedRegions)
skeleton (ConnectedRegions, Skeleton)
junctions_skeleton (Skeleton, EndPoints, JuncPoints)
difference (Skeleton, JuncPoints, RegionDifference)
connection (RegionDifference, ConnectedRegions1)
select_shape (ConnectedRegions1, SelectedRegions, 'area', 'and', 10, 99999)
split_skeleton_lines (SelectedRegions, 3, BeginRow, BeginCol, EndRow, EndCol)
dev_display (Image)
dev_set_colored (6)
split_skeleton_region (SelectedRegions, RegionLines, 3)

在这里插入图片描述

3.3 gen_contours_skeleton_xld

gen_contours_skeleton_xld(Skeleton : Contours : Length, Mode : )
Convert a skeleton into XLD contours.

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

MechMaster

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

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

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

打赏作者

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

抵扣说明:

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

余额充值