Hi, I want ask you why the size of graycomatrix 8 x 8 ? that size default 8 x 8 or how ?

1 次查看(过去 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

采纳的回答

Walter Roberson
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 个评论
Oman Wisni
Oman Wisni 2018-10-22
编辑:Oman Wisni 2018-10-22
Its okay sir, that formula I got from journal and the theory from haralick. Thanks for answers sir I already get the result and same with graycoprops () :)
sam alsalihy
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
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

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by