QQ登录

只需一步,快速开始

halcon gen_cooc_matrix cooc_feature_image cooc_feature_matrix函数

[ 复制链接 ]
gen_cooc_matrix(Regions, Image : Matrix : LdGray, Direction : )
gen_cooc_matrix根据输入区域Regions确定灰度值i和j在某个方向上Direction (0, 45, 90, 135 degrees)相邻的频率。
将这个数字存储在(i,j)和(j,i)位置的共生矩阵中(矩阵对称)。
最后用元素个数来缩放矩阵。
LdGray表示要区分的灰度值的数量。
例程
read_image (Image, 'mreut')
dev_set_draw ('margin')
gen_rectangle1 (Rectangle1, 350, 100, 450, 200)
gen_rectangle1 (Rectangle2, 100, 200, 200, 300)
gen_cooc_matrix (Rectangle1, Image, Matrix1, 6, 0)
gen_cooc_matrix (Rectangle2, Image, Matrix2, 6, 0)

cooc_feature_image(Regions, Image : : LdGray, Direction : Energy, Correlation, Homogeneity, Contrast)
计算共现矩阵,得到其灰度值特征。
cooc_feature_image一般在gen_cooc_matrix和cooc_feature_matrix这后执行。
如果要连续计算共生矩阵的多个方向矩阵,则通过gen_cooc_matrix生成该矩阵,
然后再调用cooc_feature_matrix更为有效。
参数Direction 以角度或“平均值”传递邻域的方向。
在平均值的情况下,平均值是从四个方向计算出来的。
Regions为要检测的区域。
Image相应灰度值图像。
LdGray要估算的灰度值个数。
Direction矩阵计算的方向
Energy为输出的灰度值能量。
Correlation为输出的灰度值相关性。
Homogeneity为输出的灰度值局部相关性。
Contrast灰度值对比度
例程
read_image (Image, 'mreut')
dev_set_draw ('margin')
gen_rectangle1 (Rectangle1, 350, 100, 450, 200)
gen_rectangle1 (Rectangle2, 100, 200, 200, 300)
cooc_feature_image (Rectangle1, Image, 6, 0, Energy1, Correlation1, Homogenity1, Contrast1)
cooc_feature_image (Rectangle2, Image, 6, 0, Energy2, Correlation2, Homogenity2, Contrast2)

cooc_feature_matrix(CoocMatrix : : : Energy, Correlation, Homogeneity, Contrast)
函数从一个敬重 矩阵CoocMatrix 中计算能量(Energy)、相关性(Correlation)、局部均匀性(Homogeneity)和对比(Contrast)。
CoocMatrix 由gen_cooc_matrix生成。
例如
read_image (Image, 'mreut')
gen_rectangle1 (Rectangle1, 350, 100, 450, 200)
gen_rectangle1 (Rectangle2, 100, 200, 200, 300)
gen_cooc_matrix (Rectangle1, Image, Matrix1, 6, 0)
gen_cooc_matrix (Rectangle2, Image, Matrix2, 6, 0)
cooc_feature_matrix (Matrix1, Energy1, Correlation1, Homogeneity1, Contrast1)
cooc_feature_matrix (Matrix2, Energy2, Correlation2, Homogeneity2, Contrast2)





回复

使用道具 举报

快速回复 返回列表 客服中心 搜索