Blob Analysis --Blob 分析

http://www.cnblogs.com/xiaomaLV2/archive/2011/11/29/2267498.html

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

*中值濾波 濾波用的元素結構大小 21*21
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)
 
*做中值處理,31*31 較大所以較小的 亮度點就沒了
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)
 
 
常用的操作符:見Solution——guide 4.4

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值