Halcon的区域特征

当我们想要提取Region时,图像处理后,往往存在几个类似的Region,此时,需要根据Region的一些特殊特征,来选择指定的Region。

求Region指定特征值:region_features(Regions : : Features : Value)

根据特征值选择区域:select_shape(Regions : SelectedRegions : Features, Operation, Min, Max : )


Region特征一览:

特征备注
areaArea of the object对象的面积
rowRow index of the center中心点的行坐标
columnColumn index of the center中心点的列坐标
widthWidth of the region区域的宽度
heightHeight of the region区域的高度
row1Row index of upper left corner左上角行坐标
column1Column index of upper left corner左上角列坐标
row2Row index of lower right corner右下角行坐标
column2Column index of lower right corner右下角列坐标
circularityCircularity圆度0~1
compactnessCompactness紧密度0~1
contlengthTotal length of contour轮廓线总长
convexityConvexity凸性
rectangularityRectangularity矩形度0~1
raMain radius of the equivalent ellipse等效椭圆长轴半径长度
rbSecondary radius of the equivalent ellipse等效椭圆短轴半径长度
phiOrientation of the equivalent ellipse等效椭圆方向
anisometryAnisometry椭圆参数,Ra/Rb长轴与短轴的比值
bulkinessBulkiness椭圆参数,蓬松度π*Ra*Rb/A
struct_factorStructur Factor 椭圆参数,Anisometry*Bulkiness-1
outer_radiusRadius of smallest surrounding circle最小外接圆半径
inner_radiusRadius of largest inner circle最大内接圆半径
inner_widthWidth of the largest axis-parallel rectangle that fits into the region最大内接矩形宽度
inner_heightHeight of the largest axis-parallel rectangle that fits into the region最大内接矩形高度
dist_meanMean distance from the region border to the center区域边界到中心的平均距离
dist_deviationDeviation of the distance from the region border from the center区域边界到中心距离的偏差
roundnessRoundness圆度,与circularity计算方法不同
num_sidesNumber of polygon sides多边形边数
connect_numNumber of connection components连通数
holes_numNumber of holes区域内洞数
area_holesArea of the holes of the object所有洞的面积
max_diameterMaximum diameter of the region最大直径
orientationOrientation of the region区域方向
euler_numberEuler number欧拉数,即连通数和洞数的差
rect2_phiOrientation of the smallest surrounding rectangle最小外接矩形的方向
rect2_len1Half the length of the smallest surrounding rectangle最小外接矩形长度的一半??smallest_rectangle2
rect2_len2Half the width of the smallest surrounding rectangle最小外接矩形宽度的一半
moments_m11Geometric moments of the region几何矩
moments_m20Geometric moments of the region几何矩
moments_m02Geometric moments of the region几何矩
moments_iaGeometric moments of the region几何矩
moments_ibGeometric moments of the region几何矩
moments_m11_invarGeometric moments of the region几何矩
moments_m20_invarGeometric moments of the region几何矩
moments_m02_invarGeometric moments of the region几何矩
moments_phi1Geometric moments of the region几何矩
moments_phi2Geometric moments of the region几何矩
moments_m21Geometric moments of the region几何矩
moments_m12Geometric moments of the region几何矩
moments_m03Geometric moments of the region几何矩
moments_m30Geometric moments of the region几何矩
moments_m21_invarGeometric moments of the region几何矩
moments_m12_invarGeometric moments of the region几何矩
moments_m03_invarGeometric moments of the region几何矩
moments_m30_invarGeometric moments of the region几何矩
moments_i1Geometric moments of the region几何矩
moments_i2Geometric moments of the region几何矩
moments_i3Geometric moments of the region几何矩
moments_i4Geometric moments of the region几何矩
moments_psi1Geometric moments of the region几何矩
moments_psi2Geometric moments of the region几何矩
moments_psi3Geometric moments of the region几何矩
moments_psi4Geometric moments of the region几何矩

形状特征的数学描述如下:

1)圆度(Circularity) 
衡量一个形状接近圆的程度,取值为 [0, 1] 

image.png

另一种算法是,统计边界点到中心的距离,根据方差反映圆度

Halcon 对应上面两种思路有相应的算子:circularity、roundness

2)紧密度(Compactness) 
参考 wikipedia,衡量一个形状紧致程度,取值为 [0, 1],对于圆,紧密度为 1 

image.png

其中A为形状面积,i1i2为二阶矩:image.png

关于紧密度的一个比喻:用不同长度的绳子围成一个面积一定的区域,使用的绳子长度越短则紧密度越高。 
           又由于圆的边缘没有转角,很光滑,因此紧密度又称为粗糙度

Halcon 对应的算子为 compactness

3)矩形度(Rectangularity) 
参考《图像处理基本算法 形状特征》,衡量一个形状接近矩形的程度,取值为 [0, 1] 

image.png

其中A为形状面积,Er为最小外接矩阵面积

Halcon 对应算子为 rectangularity

4)凸性(Convexity) 

参考文献【1】(顺便推荐作者关于凸性的研究主页),凸性的计算有很多种方法。这里介绍两种,第二种(Halcon用的这种)更为常见

定义1:对于二维形状SS,在上面随机选择A、BA、B两个点,统计线段[AB][AB]上落在SS内的点的个数

定义2:对于二维形状SS,令CH(S)CH(S)为其最小外接凸形 

image.png

图1是CH(S)的一个示例

image.png

Halcon使用算子 convexity 计算凸率;使用 shape_trans 转换区域为凸包/最小外接圆/外接矩形

5)偏心率(Eccentricity) 
参考章毓晋的《图像工程》,介绍一种平移、旋转和尺度不变的算法

令三维形状的每个点坐标为(xi,yi,zi),每个点的质量(图像可以理解为灰度值)mi,有

image.png

image.png

Halcon 里是用其等效椭圆的长半轴除以短半轴计算的:eccentricity

6)蓬松度(Bulkiness) 
参考Halcon13的文档,感觉跟紧密度相反,圆为1,越松散值越大 

image.png

image.png

image.png

Halcon13文档里有以上特征的描述及图例


区域特征

1)区域面积 
就是像素点相加 
但区域一般是用形成编码表示,累加每行的行程就可以

2)区域中心 

image.png

3)区域几何矩 
几何矩具有旋转、尺度不变性,应用在形状分类上 

image.png

image.png

4)等效椭圆 
区域的方向和范围可以用等效椭圆来表示 
等效椭圆的中心与区域中心一致,长半轴r1、短半轴r2和相对于x轴的夹角θ由二阶矩算出 

image.png

Halcon里对应的算子为 elliptic_axis()

【1】J. Zunic, P.L. Rosin, “A New Convexity Measure for Polygons”, IEEE Transactions Pattern Analysis and Machine Intelligence, vol. 26, no. 7, pp. 923-934, 2004.


--------------------- 

作者:hackpig
来源:www.skcircle.com
版权声明:本文为博主原创文章,转载请附上博文链接!


本文出自勇哥的网站《少有人走的路》wwww.skcircle.com,转载请注明出处!讨论可扫码加群:

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

会员中心
搜索
«    2024年5月    »
12345
6789101112
13141516171819
20212223242526
2728293031
网站分类
标签列表
最新留言
    热门文章 | 热评文章 | 随机文章
文章归档
友情链接
  • 订阅本站的 RSS 2.0 新闻聚合
  • 扫描加本站机器视觉QQ群,验证答案为:halcon勇哥的机器视觉
  • 点击查阅微信群二维码
  • 扫描加勇哥的非标自动化群,验证答案:C#/C++/VB勇哥的非标自动化群
  • 扫描加站长微信:站长微信:abc496103864
  • 扫描加站长QQ:
  • 扫描赞赏本站:
  • 留言板:

Powered By Z-BlogPHP 1.7.2

Copyright Your skcircle.com Rights Reserved.

鄂ICP备18008319号


站长QQ:496103864 微信:abc496103864