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