Hi, I want ask you why the size of graycomatrix 8 x 8 ? that size default 8 x 8 or how ?
5 次查看(过去 30 天)
显示 更早的评论
sir I example matrix gray = [0 1 2 2; 1 1 2 1; 1 0 2 0;]; but after I m=graycomatrix(gray); the result like this :
m =
0 0 0 0 0 0 0 2
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
2 0 0 0 0 0 0 5
0 个评论
采纳的回答
Walter Roberson
2018-10-16
It is because NumLevels defaults to 8
"Number of gray levels, specified as an integer. For example, if NumLevels is 8, graycomatrix scales the values in I so they are integers between 1 and 8. The number of gray-levels determines the size of the gray-level co-occurrence matrix (glcm)."
18 个评论
sam alsalihy
2020-5-16
it is by defalt the output scale to 8. It ismean that the value of input image will be converted from its range to the range between 0-8 then calculate the glcm matrix
for example if you set image pp=[1 2 5 4 7;5 4 2 5 3; 1 2 3 4 2;2 2 2 3 1 ]
and [GLCMS,SI] = graycomatrix(pp,'NumLevels',7,'G',[]) so the NumLevels=7 it s in the same range ofthe pp image thus will convert matrix SI
1 2 5 4 7
5 4 2 5 3
1 2 3 4 2
2 2 2 3 1
it mean same orginal image. but for example the NumLevels=10 it will convert to range 1-10, thus the SI matrix will be
更多回答(1 个)
sam alsalihy
2020-5-16
as the following
1 2 7 6 10
7 6 2 7 4
1 2 4 6 2
2 2 2 4 1
then the glcm matrix calculated from SI
1 2 3 4 5 6 7 8 9 10
1: 0 2 0 0 0 0 0 0 0 0
2: 0 2 0 2 0 0 2 0 0 0
3: 0 0 0 0 0 0 0 0 0 0
4: 1 0 0 0 0 1 0 0 0 0
5: 0 0 0 0 0 0 0 0 0 0
6: 0 2 0 0 0 0 0 0 0 1
7: 0 0 0 1 0 2 0 0 0 0
8: 0 0 0 0 0 0 0 0 0 0
9: 0 0 0 0 0 0 0 0 0 0
10: 0 0 0 0 0 0 0 0 0 0
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!