graycoprops
R2026b灰度共生矩阵 (GLCM) 的属性
描述
根据灰度共生矩阵 stats = graycoprops(glcm,properties)glcm 计算 properties 中指定的统计量。
graycoprops 归一化灰度共生矩阵 (GLCM),使其元素之和等于 1。归一化 GLCM 中的每个元素 (r,c) 是图像中具有灰度值 r 和 c 的像素对在定义的空间关系下同时出现的概率。graycoprops 使用归一化 GLCM 计算 properties。
示例
创建简单的示例 GLCM。
glcm = [0 1 2 3;1 1 2 3;1 0 2 0;0 0 0 3]
glcm = 4×4
0 1 2 3
1 1 2 3
1 0 2 0
0 0 0 3
计算该 GLCM 的统计属性。
stats = graycoprops(glcm)
stats = struct with fields:
Contrast: 2.8947
Correlation: 0.0783
Energy: 0.1191
Homogeneity: 0.5658
将灰度图像读入工作区。
I = imread("circuit.tif");从图像创建两个灰度共生矩阵 (GLCM),指定不同偏移量。
glcm = graycomatrix(I,Offset=[2 0;0 2])
glcm =
glcm(:,:,1) =
14205 2107 126 0 0 0 0 0
2242 14052 3555 400 0 0 0 0
191 3579 7341 1505 37 0 0 0
0 683 1446 7184 1368 0 0 0
0 7 116 1502 10256 1124 0 0
0 0 0 2 1153 1435 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
glcm(:,:,2) =
13938 2615 204 4 0 0 0 0
2406 14062 3311 630 23 0 0 0
145 3184 7371 1650 133 0 0 0
2 371 1621 6905 1706 0 0 0
0 0 116 1477 9974 1173 0 0
0 0 0 1 1161 1417 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
从 GLCM 获取图像的对比度和同质性统计量。
stats = graycoprops(glcm,["contrast","homogeneity"])
stats = struct with fields:
Contrast: [0.3420 0.3567]
Homogeneity: [0.8567 0.8513]
输入参数
GLCM,指定为以下项之一。您可以使用 graycomatrix 函数创建一个 GLCM。
单个 GLCM 的由非负整数组成的 m×n 矩阵
p 个有效 GLCM 的由非负整数组成的 m×n×p 数组。
数据类型: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical
从 GLCM 派生的图像的统计属性,指定为以逗号分隔的字符串标量或字符向量列表、字符串标量或字符向量元胞数组、字符串数组、空格分隔的字符串标量或字符向量,或 "all"。您可以指定下表中列出的任何属性名称。
属性 | 描述 | 公式 |
|---|---|---|
| 返回图像中像素与其邻点在整个图像上的强度对比度量。 Range = [0 (size(GLCM,1)-1)^2] 对于常量图像,对比度为 0。 属性 Contrast 也称为方差和惯量。 | |
| 返回图像中像素与其邻点在整个图像上的相关性度量。
对于完全正相关或负相关的图像,相关性为 1 或 -1。对于常量图像,相关性为 | |
| 返回 GLCM 中平方元素的总和。 Range = [0 1] 对于常量图像,Energy 为 属性 Energy 也称为均匀性、能量均匀性和角度二阶矩。 | |
| 返回测量 GLCM 中的元素分布与 GLCM 对角线的接近程度的值。 Range = [0 1] 对于对角 GLCM,Homogeneity 为 1。 |
示例: "Contrast","Homogeneity" 将两个属性指定为以逗号分隔的字符串标量列表
示例: ["Contrast","Homogeneity"] 将两个属性指定为字符串数组
示例: {"Contrast","Homogeneity"} 将两个属性指定为字符串标量元胞数组
示例: "Contrast Homogeneity" 将两个属性指定为空格分隔的字符串标量
数据类型: char | string | cell
输出参量
从 GLCM 派生的统计量,以结构体形式返回,其字段由 properties 指定。每个字段包含一个 1×p 数组,其中 p 是 glcm 中灰度共生矩阵的数量。例如,如果 glcm 是一个 8×8×3 数组,properties 为 "Energy",则 stats 是包含字段 Energy 的结构体,该字段包含 1×3 数组。
扩展功能
版本历史记录
在 R2006a 之前推出现在 graycoprops 支持 C 代码生成(需要 MATLAB Coder)和 CUDA® 代码(需要 GPU Coder™)。
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)