一、关于共生矩阵

如果不懂啥叫共生矩阵,将无法阅读该文。如果试图搞明白啥叫共生矩阵,请看我的另一篇博文,《hjalcon知识:共生矩阵》

本片介绍共生矩阵产生的其它属性:能量、相关性、同质性(同类性)、对比度。

halcon内关于共生矩阵有三个算子:

  • gen_cooc_matrix、
  • cooc_feature_matrix、
  • cooc_feature_image

三个算子的其关系如下图:

二、算子函数

cooc_feature_matrix(CoocMatrix : : : Energy, Correlation, Homogeneity, Contrast)

cooc_feature_matrix(

CoocMatrix

图标量输入,这里是共生矩阵
无图标输出
无控制量输入

Energy,

Correlation,

Homogeneity,

Contrast )

四个控制量,决定图像特征

三、特征的数学原理

该算子根据共现矩阵(CoocMatrix)计算能量(能量)、相关性(相关性)、局部同质性(同质性)和对比度(对比度)。

运算符cooc_feature_matrix根据以下公式计算由gen_cooc_matrix生成的输入矩阵中与参数LdGray和direction指示的方向矩阵相对应的部分的灰度值特征:

3.1 中间变量定义

width = 共生矩阵的宽度(灰度图像为8)

 = 共生矩阵的元素值

3.2 特征数学模型

1)能量

               计量图像的同质性,该值越大越不够同质

2)相关性

 相关与独立相反,该值越大越不独立

3)同质度

4)对比度

四、相关代码

* This example shows how to calculate co-occurrence matrices
* from given image regions and how to derive gray value features
* from these co-occurrence matrices.
dev_update_off ()
*
* Read in an image and open and prepare the output windows
read_image (Image, 'mreut')
dev_close_window ()
get_image_size (Image, Width, Height)
CoocWinSize := 320
Border := 10
dev_open_window (0, CoocWinSize + Border, Width, Height, 'black', WindowID)
set_display_font (WindowID, 16, 'mono', 'true', 'false')
dev_display (Image)
dev_set_draw ('margin')
dev_set_line_width (3)
*
dev_open_window (Height - CoocWinSize, 0, CoocWinSize, CoocWinSize, 'black', WindowID1)
set_display_font (WindowID1, 16, 'mono', 'true', 'false')
dev_set_lut ('temperature')
dev_set_draw ('margin')
dev_set_line_width (5)
dev_set_color ('yellow')
*
dev_open_window (0, Width + CoocWinSize + 2 * Border, CoocWinSize, CoocWinSize, 'black', WindowID2)
set_display_font (WindowID2, 16, 'mono', 'true', 'false')
dev_set_lut ('temperature')
dev_set_draw ('margin')
dev_set_line_width (5)
dev_set_color ('blue')
*
* Define the regions for which the co-occurance matrices will be calculated
gen_rectangle1 (Rectangle1, 350, 100, 450, 200)
gen_rectangle1 (Rectangle2, 100, 200, 200, 300)
inner_circle (Rectangle1, Row1, Column1, Radius1)
inner_circle (Rectangle2, Row2, Column2, Radius2)
*
* Loop over the four possible directions
for Direction := 0 to 135 by 45* * Calculate the co-occurrence matrices for the given regionsgen_cooc_matrix (Rectangle1, Image, Matrix1, 6, Direction)gen_cooc_matrix (Rectangle2, Image, Matrix2, 6, Direction)* * Calculate the gray value features from the co-occurance matricescooc_feature_matrix (Matrix1, Energy1, Correlation1, Homogeneity1, Contrast1)cooc_feature_matrix (Matrix2, Energy2, Correlation2, Homogeneity2, Contrast2)* * Display the resultsdev_set_window (WindowID)dev_display (Image)disp_message (WindowID, 'Direction: ' + Direction$'3d' + ' degrees', 'window', 260, 100, 'black', 'true')dev_set_color ('yellow')dev_display (Rectangle1)gen_arrow_contour_xld (Arrow1, Row1, Column1, Row1 - sin(rad(Direction)) * 0.9 * Radius1, Column1 + cos(rad(Direction)) * 0.9 * Radius1, 8, 8)dev_display (Arrow1)dev_set_color ('blue')dev_display (Rectangle2)gen_arrow_contour_xld (Arrow2, Row2, Column2, Row2 - sin(rad(Direction)) * 0.9 * Radius2, Column2 + cos(rad(Direction)) * 0.9 * Radius2, 8, 8)dev_display (Arrow2)* String := ['Energy: ','Correlation: ','Homogeneity: ','Contrast: ']dev_set_window (WindowID1)dev_display (Matrix1)get_domain (Matrix1, Domain)dev_display (Domain)disp_message (WindowID1, String$'-14s' + [Energy1,Correlation1,Homogeneity1,Contrast1]$'6.3f', 'window', 12, 12, 'white', 'false')* dev_set_window (WindowID2)dev_display (Matrix2)get_domain (Matrix2, Domain)dev_display (Domain)disp_message (WindowID2, String$'-14s' + [Energy2,Correlation2,Homogeneity2,Contrast2]$'6.3f', 'window', 12, 12, 'white', 'false')* if (Direction < 135)disp_continue_message (WindowID, 'black', 'true')stop ()endif
endfor

五、结果

halcon知识:图像纹理特征提取cooc_feature_matrix相关推荐

  1. 利用OpenCV实现图像纹理特征提取

    这个程序是简单地图像纹理特征提取,参考代码如下所示: IplImage * cvSampleImageTextureExtraction(IplImage* img,IplImage* dst){uc ...

  2. CS131专题-8:图像纹理

    目录 1 什么是图像纹理 1.1 不规则纹理 1.2 规则纹理 2 纹理描述(提取方法) 3 纹理滤波器组 4 一些滤波器提取的纹理效果 5 使用高维向量描述纹理 6 图像纹理提取的应用 应用1:图像 ...

  3. oc怎么添加win引导_OC图像纹理节点和透明贴图的使用方法

    [感谢关注,建议点亮星标★,早上7:30更文] 透明贴图在C4D中经常会用到,比如在物体上贴个图形,如上图所示,这在默认渲染器中操作比较简单,换到OC中,有的小伙伴会有些懵,所以写了这篇(基于OC3. ...

  4. 图像纹理合成_EnhanceNet:通过自动纹理合成实现单图像超分辨率

    图像纹理合成 In 在 背景 (Background) In Single Image Super-Resolution, objective metric-based (like Mean Squa ...

  5. python图像纹理提取_提取图像的颜色、纹理特征(传统算法)

    Python-Image-feature-extraction Python实现提取图像的纹理.颜色特征,包含快速灰度共现矩阵(GLCM).LBP特征.颜色矩.颜色直方图.1044197988/Pyt ...

  6. 灰度共生矩阵特征提取步骤_灰度共生矩阵纹理特征提取的Matlab实现

    灰度共生矩阵纹理特征提取的 Matlab 实现 焦蓬蓬 ; 郭依正 ; 刘丽娟 ; 卫星 [期刊名称] <计算机技术与发展> [年 ( 卷 ), 期] 2012(000)011 [摘要] ...

  7. 特征提取算法(1)——纹理特征提取算法LBP

    模式识别中进行匹配识别或者分类器分类识别时,判断的依据就是图像特征.用提取的特征表示整幅图像内容,根据特征匹配或者分类图像目标. 常见的特征提取算法主要分为以下3类: 基于颜色特征:如颜色直方图.颜色 ...

  8. LBP纹理特征提取学习笔记

    前言 LBP(Local Binary Pattern,局部二值模式)是一种用来描述图像局部纹理特征的算子:它具有旋转不变性和灰度不变性等显著的优点.它是首先由T. Ojala, M.Pietikäi ...

  9. 图像纹理特征(灰度共生矩阵等)解析和编程调用

    图像纹理特征  本文主要介绍医学影像领域常用到的基于图像灰度值变化所衍生出的各项纹理特征,理论部分主要参考了文献1,同时介绍了相关函数调用方式. 灰度共生矩阵  灰度共生矩阵2,Gray-Level ...

最新文章

  1. ListView 添加头部 和尾部 布局 (addHeaderView 和 addFooterView)
  2. Hulu直播服务难点解析(一):系统需求
  3. RabbitMQ基本概念(一)-RabbitMQ的优劣势及产生背景
  4. win8.1下无法运行vc++6.0的解决方法
  5. zabbix 监控 redis
  6. ASP.NET AJAX + JSON 实现对象调用
  7. halcon标定后改变世界坐标系参考点方法
  8. android swf游戏下载工具,安卓swf游戏播放器下载
  9. 软件构建--系统设计
  10. Android学习路线图
  11. ajax回调的data,。。。Ajax的回调函数function(data)中,data的返回类型。。。
  12. 如何恢复android误删的文件夹,如何恢复误删的android手机文件
  13. Sematic UI框架的学习-button样式(1)
  14. Red Giant VFX Suite for mac(电影级视觉特效插件)
  15. 谷歌,Google,Chrome,检查工具栏常用功能介绍
  16. perfectmoney php接口_兑换paypal PerfectMoney(转载)
  17. 编写MTK6737平台的GPIO驱动例程(三)
  18. 小学奥数公式大全 学习奥数必备“工具”
  19. 3DMAX解析愤怒的小鸟
  20. 致远互联:以数智化指引破局之道

热门文章

  1. 深度学习核心技术精讲100篇(二十八)-由浅入深概览机器学习优化算法
  2. 隐性语义索引(LSI)
  3. 信号处理频谱分析中,如何选择合适的窗函数
  4. 数据挖掘学习笔记之人工神经网络(二)
  5. 数据增强,将数据增强后保存到本地
  6. 深度学习100例-生成对抗网络(DCGAN)手写数字生成 | 第19天
  7. 数据分析系列:完善统计图(matplotlib)
  8. ARCGIS10.1 插值分析结果按指定多边形输出
  9. Elastic Search入门:架构说明及Docker方式体验
  10. 关于vs2010编译程序一闪就没的解决办法