The answer is NaN
Mostra commenti meno recenti
I don't know why the answer of this code is NaN. Help me please. thanks so much
for a = 01:20
filename = [num2str(a,'%02d') '_training' '.tif'];
img = imread(filename);
img1=imrotate(img,90,'bilinear');
C=rgb2gray(img1);
%co-occurrence matrix
glcm=graycomatrix(C,'GrayLimits',[0 255],'NumLevels',256,'Offset',[-1 -1]);
p=glcm/sum(glcm(:));
entropy=0;
for i=1:256
for j =1:256
entropy=entropy-p(i,j)*log2(p(i,j));
end
end
kq(a,:)=[entropy];
end
1 Commento
Matt J
il 25 Dic 2013
What variable represents "the answer"?
Risposta accettata
Più risposte (1)
Image Analyst
il 25 Dic 2013
Often a small number is added to values before taking log
smallNumber = 1; % % Whatever...
p(p==0) = smallNumber;
Now do your log.
1 Commento
Huy
il 26 Dic 2013
Categorie
Scopri di più su Texture Analysis in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!