Finding energy from co-occurrence matrix
I am trying to find energy of an image using co occurrence matrix. Is this code correct? Is the method of calculating gray level co occurrence matrix correct?
offsets = [ 0 1; -1 1; -1 0; -1 -1];
T(i).energy = 0; %initial energy of image (T(i)) is 0
Imag = T(i).data; %Reading image into Imag
glcm = graycomatrix(Imag,’Of’,offsets); %calculating gray level co-occurrence matrix
glcm
[r c] = size(glcm);
for ctr=1:1:r
for ctr2=1:1:c
T(i).energy = T(i).energy+(glcm(ctr,ctr)).^2;
end
end
fprintf(‘energy is %linn’,T(i).energy);I am trying to find energy of an image using co occurrence matrix. Is this code correct? Is the method of calculating gray level co occurrence matrix correct?
offsets = [ 0 1; -1 1; -1 0; -1 -1];
T(i).energy = 0; %initial energy of image (T(i)) is 0
Imag = T(i).data; %Reading image into Imag
glcm = graycomatrix(Imag,’Of’,offsets); %calculating gray level co-occurrence matrix
glcm
[r c] = size(glcm);
for ctr=1:1:r
for ctr2=1:1:c
T(i).energy = T(i).energy+(glcm(ctr,ctr)).^2;
end
end
fprintf(‘energy is %linn’,T(i).energy); I am trying to find energy of an image using co occurrence matrix. Is this code correct? Is the method of calculating gray level co occurrence matrix correct?
offsets = [ 0 1; -1 1; -1 0; -1 -1];
T(i).energy = 0; %initial energy of image (T(i)) is 0
Imag = T(i).data; %Reading image into Imag
glcm = graycomatrix(Imag,’Of’,offsets); %calculating gray level co-occurrence matrix
glcm
[r c] = size(glcm);
for ctr=1:1:r
for ctr2=1:1:c
T(i).energy = T(i).energy+(glcm(ctr,ctr)).^2;
end
end
fprintf(‘energy is %linn’,T(i).energy); regards MATLAB Answers — New Questions