当我们想要提取Region时,图像处理后,往往存在几个类似的Region,此时,需要根据Region的一些特殊特征,来选择指定的Region。
求Region指定特征值:region_features(Regions : : Features : Value)
根据特征值选择区域:select_shape(Regions : SelectedRegions : Features, Operation, Min, Max : )
Region特征一览:
特征 | 英 | 译 | 备注 |
area | Area of the object | 对象的面积 | |
row | Row index of the center | 中心点的行坐标 | |
column | Column index of the center | 中心点的列坐标 | |
width | Width of the region | 区域的宽度 | |
height | Height of the region | 区域的高度 | |
row1 | Row index of upper left corner | 左上角行坐标 | |
column1 | Column index of upper left corner | 左上角列坐标 | |
row2 | Row index of lower right corner | 右下角行坐标 | |
column2 | Column index of lower right corner | 右下角列坐标 | |
circularity | Circularity | 圆度 | 0~1 |
compactness | Compactness | 紧密度 | 0~1 |
contlength | Total length of contour | 轮廓线总长 | |
convexity | Convexity | 凸性 | |
rectangularity | Rectangularity | 矩形度 | 0~1 |
ra | Main radius of the equivalent ellipse | 等效椭圆长轴半径长度 | |
rb | Secondary radius of the equivalent ellipse | 等效椭圆短轴半径长度 | |
phi | Orientation of the equivalent ellipse | 等效椭圆方向 | |
anisometry | Anisometry | 椭圆参数,Ra/Rb长轴与短轴的比值 | |
bulkiness | Bulkiness | 椭圆参数,蓬松度π*Ra*Rb/A | |
struct_factor | Structur Factor | 椭圆参数,Anisometry*Bulkiness-1 | |
outer_radius | Radius of smallest surrounding circle | 最小外接圆半径 | |
inner_radius | Radius of largest inner circle | 最大内接圆半径 | |
inner_width | Width of the largest axis-parallel rectangle that fits into the region | 最大内接矩形宽度 | |
inner_height | Height of the largest axis-parallel rectangle that fits into the region | 最大内接矩形高度 | |
dist_mean | Mean distance from the region border to the center | 区域边界到中心的平均距离 | |
dist_deviation | Deviation of the distance from the region border from the center | 区域边界到中心距离的偏差 | |
roundness | Roundness | 圆度,与circularity计算方法不同 | |
num_sides | Number of polygon sides | 多边形边数 | |
connect_num | Number of connection components | 连通数 | |
holes_num | Number of holes | 区域内洞数 | |
area_holes | Area of the holes of the object | 所有洞的面积 | |
max_diameter | Maximum diameter of the region | 最大直径 | |
orientation | Orientation of the region | 区域方向 | |
euler_number | Euler number | 欧拉数,即连通数和洞数的差 | |
rect2_phi | Orientation of the smallest surrounding rectangle | 最小外接矩形的方向 | |
rect2_len1 | Half the length of the smallest surrounding rectangle | 最小外接矩形长度的一半?? | smallest_rectangle2 |
rect2_len2 | Half the width of the smallest surrounding rectangle | 最小外接矩形宽度的一半 | |
moments_m11 | Geometric moments of the region | 几何矩 | |
moments_m20 | Geometric moments of the region | 几何矩 | |
moments_m02 | Geometric moments of the region | 几何矩 | |
moments_ia | Geometric moments of the region | 几何矩 | |
moments_ib | Geometric moments of the region | 几何矩 | |
moments_m11_invar | Geometric moments of the region | 几何矩 | |
moments_m20_invar | Geometric moments of the region | 几何矩 | |
moments_m02_invar | Geometric moments of the region | 几何矩 | |
moments_phi1 | Geometric moments of the region | 几何矩 | |
moments_phi2 | Geometric moments of the region | 几何矩 | |
moments_m21 | Geometric moments of the region | 几何矩 | |
moments_m12 | Geometric moments of the region | 几何矩 | |
moments_m03 | Geometric moments of the region | 几何矩 | |
moments_m30 | Geometric moments of the region | 几何矩 | |
moments_m21_invar | Geometric moments of the region | 几何矩 | |
moments_m12_invar | Geometric moments of the region | 几何矩 | |
moments_m03_invar | Geometric moments of the region | 几何矩 | |
moments_m30_invar | Geometric moments of the region | 几何矩 | |
moments_i1 | Geometric moments of the region | 几何矩 | |
moments_i2 | Geometric moments of the region | 几何矩 | |
moments_i3 | Geometric moments of the region | 几何矩 | |
moments_i4 | Geometric moments of the region | 几何矩 | |
moments_psi1 | Geometric moments of the region | 几何矩 | |
moments_psi2 | Geometric moments of the region | 几何矩 | |
moments_psi3 | Geometric moments of the region | 几何矩 | |
moments_psi4 | Geometric moments of the region | 几何矩 |
形状特征的数学描述如下:
1)圆度(Circularity)
衡量一个形状接近圆的程度,取值为 [0, 1]
另一种算法是,统计边界点到中心的距离,根据方差反映圆度
Halcon 对应上面两种思路有相应的算子:circularity、roundness
2)紧密度(Compactness)
参考 wikipedia,衡量一个形状紧致程度,取值为 [0, 1],对于圆,紧密度为 1
其中为形状面积,和为二阶矩:
关于紧密度的一个比喻:用不同长度的绳子围成一个面积一定的区域,使用的绳子长度越短则紧密度越高。
又由于圆的边缘没有转角,很光滑,因此紧密度又称为粗糙度
Halcon 对应的算子为 compactness
3)矩形度(Rectangularity)
参考《图像处理基本算法 形状特征》,衡量一个形状接近矩形的程度,取值为 [0, 1]
其中为形状面积,为最小外接矩阵面积
Halcon 对应算子为 rectangularity
4)凸性(Convexity)
参考文献【1】(顺便推荐作者关于凸性的研究主页),凸性的计算有很多种方法。这里介绍两种,第二种(Halcon用的这种)更为常见
定义1:对于二维形状SS,在上面随机选择A、BA、B两个点,统计线段[AB][AB]上落在SS内的点的个数
定义2:对于二维形状SS,令CH(S)CH(S)为其最小外接凸形
图1是的一个示例
Halcon使用算子 convexity 计算凸率;使用 shape_trans 转换区域为凸包/最小外接圆/外接矩形
5)偏心率(Eccentricity)
参考章毓晋的《图像工程》,介绍一种平移、旋转和尺度不变的算法
令三维形状的每个点坐标为,每个点的质量(图像可以理解为灰度值),有
Halcon 里是用其等效椭圆的长半轴除以短半轴计算的:eccentricity
6)蓬松度(Bulkiness)
参考Halcon13的文档,感觉跟紧密度相反,圆为1,越松散值越大
Halcon13文档里有以上特征的描述及图例
区域特征
1)区域面积
就是像素点相加
但区域一般是用形成编码表示,累加每行的行程就可以
2)区域中心
3)区域几何矩
几何矩具有旋转、尺度不变性,应用在形状分类上
4)等效椭圆
区域的方向和范围可以用等效椭圆来表示
等效椭圆的中心与区域中心一致,长半轴、短半轴和相对于x轴的夹角由二阶矩算出
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
版权声明:本文为博主原创文章,转载请附上博文链接!

