Halcon Blob Analysis

Blob分析(Blob Analysis)是对图像中相同像素的连通域进行分析,该连通域称为Blob。Blob分析可为机器视觉应用提供图像中的斑点的数量、位置、形状和方向,还可以提供相关斑点间的拓扑结构。

4.1 Basic Concept

Blob分析主要分三部分:

在这里插入图片描述

4.2 Extended Concept

在这里插入图片描述

4.2.5 Extract Segmentation Parameters 获取分割参数

Instead of using fixed threshold values, they can be extracted dynamically for each image. One example
for this is a gray value histogram that has multiple peaks, one for each object class. Here, you can use
the operators gray_histo_abs and histo_to_thresh.

如果图像的前景和背景区域灰度值分布比较均匀,那么图像的灰度直方图具有明显的双峰。
我们可以通过图像的灰度直方图的谷底值来作为划分阈值。gray_histo_abs and histo_to_thresh.

在这里插入图片描述

4.2.6 Segment Image

For the segmentation various methods can be used. The most simple method is threshold, where one
or more gray value ranges that belong to the foreground objects are specified. Another very common
method is dyn_threshold. Here, a second image is passed as a reference. With this approach, a local
threshold instead of a global threshold is used. These local threshold values are stored in the reference
image. The reference image can either be static by taking a picture of the empty background or can be
determined dynamically with smoothing filters like mean_image.

dyn_threshold : Segment ->Thresthold->dyn_threshold 算子的例子很好的说明了。

4.2.7 Process Region

Once blob regions are segmented, it is often necessary to modify them, e.g., by suppressing small areas,
regions of a given orientation, or regions that are close to other regions. In this context, the morpho-
logical operators opening_circle and opening_rectangle1 are often used to suppress noise and
closing_circle and closing_rectangle1 to fill gaps.
Blobs with a specific feature can be selected with select_shape, select_shape_std, and se-
lect_shape_proto.

图像分割以后
opening_circle opening_rectangle1 用于消除噪点

closing_circle and closing_rectangle1 用于填充缺口

也可以根据特征选择,在halcon 可视化的 特征直方图中 有操作。

例子:solution_guide/basics/crystal.hdev
在这里插入图片描述

中值滤波 滤波用的元素结构大小 2121
mean_image(Image,ImageMean,21,21)
*两幅图像 比较后出来的的二值图 是要提取的物体
dyn_threshold(Image,ImageMean,RegionDynThresh,8,‘dark’)
connection(RegionDynThresh,ConnectedRegions)
*改变形状 为(convex)凸 形
shape_trans (ConnectedRegions, ConvexRegions, ‘convex’)
*选出面积大的
select_shape (ConvexRegions, LargeRegions, ‘area’, ‘and’, 600, 2000)

select_gray (LargeRegions, Image, Crystals, ‘entropy’, ‘and’, 1, 5.6)


例子:solution_guide/basics/atoms.hdev
在这里插入图片描述

gauss_image (Image, ImageGauss, 5)
watersheds (ImageGauss, Basins, Watersheds) *分水岭分割


  • -> skip regions at the border of the image 去掉四边

  • 以左上角列为基准,选取2–width-1 的列; 也就是说去掉了最左边的边框
    select_shape (Basins, SelectedRegions1, ‘column1’, ‘and’, 2, Width-1)

select_shape (SelectedRegions1, SelectedRegions2, ‘row1’, ‘and’, 2, Height-1)
select_shape (SelectedRegions2, SelectedRegions3, ‘column2’, ‘and’, 1, Width-3)
select_shape (SelectedRegions3, Inner, ‘row2’, ‘and’, 1, Height-3)

  • -> select irregularly shaped atoms 找到不规则的网格
    select_shape (Inner, Irregular, ‘compactness’, ‘and’, 1.45, 3)

例子:hdevelop/Applications/Measuring-2D/particle.hdev
在这里插入图片描述


*提取出白色的区域: 可以看出 分两部分:1.亮度大的大块区域 2.亮度小的小块区域


*二值化分割说大块的区域
threshold (Image, Large, 110, 255)

*做一下膨胀
dilation_circle (Large, LargeDilation, 7.5)

*取出LargeDilation之外的区域,这个区域包含有亮度较小的块
complement (LargeDilation, NotLarge)
reduce_domain (Image, NotLarge, ParticlesRed)

做中值处理,3131 较大所以较小的 亮度点就没了
mean_image (ParticlesRed, Mean, 31, 31)
*这两幅图做运算,就出来 亮度小的小块区域
dyn_threshold (ParticlesRed, Mean, SmallRaw, 3, ‘light’)
*再去小噪点 ok
opening_circle (SmallRaw, Small, 2.5)
connection (Small, SmallConnection)

例子:hdevelop/Applications/Measuring-2D/fin.hdev
在这里插入图片描述


*找出图片的毛刺


*二值化
bin_threshold (Fin, Dark)
*背景
difference (Fin, Dark, Background)
*填充背景图的缺口
closing_circle (Background, ClosedBackground, 250)
*两背景比较得出 毛刺区域
difference (ClosedBackground, Background, RegionDifference)
*消除小的噪点
opening_rectangle1 (RegionDifference, FinRegion, 5, 5)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值