Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

how to use GLCM to a special object that has been marked by bwlabel and Bounding Box?

1 vue (au cours des 30 derniers jours)
Nani Harniawati
Nani Harniawati le 20 Avr 2016
Clôturé : MATLAB Answer Bot le 20 Août 2021
please help me , how to use GLCM to a special object that has been marked by bwlabel and Bounding Box . I've tried with looping to find the area , perimeter , it managed to calculate each object , but the result is the same for GLCM value of each object. should be different for each object . Thank you very much
for k = 1 : length(st) thisBB = st(k).BoundingBox; rectangle('Position', [thisBB(1),thisBB(2),thisBB(3),thisBB(4)],... 'EdgeColor','r','LineWidth',2 )
GLCM = graycomatrix(BW,'Offset',[0 1; -1 1; -1 0; -1 -1]);
stats = graycoprops(GLCM,{'contrast','correlation','energy','homogeneity'});
Contrast= stats.Contrast;
Correlation = stats.Correlation;
Energy = stats.Energy;
Homogeneity = stats.Homogeneity;
data1{1,k} = Contrast(1);
data1{2,k} = Contrast(2);
data1{3,k} = Contrast(3);
data1{4,k} = Contrast(4);
data2{1,k} = Correlation(1);
data2{2,k} = Correlation(2);
data2{3,k} = Correlation(3);
data2{4,k} = Correlation(4);
data3{1,k} = Energy(1);
data3{2,k} = Energy(2);
data3{3,k} = Energy(3);
data3{4,k} = Energy(4);
data4{1,k} = Homogeneity(1);
data4{2,k} = Homogeneity(2);
data4{3,k} = Homogeneity(3);
data4{4,k} = Homogeneity(4);
data5{1,k} = mean(Contrast);
data5{2,k} = mean(Correlation);
data5{3,k} = mean(Energy);
data5{4,k} = mean(Homogeneity);
disp('===================================')
disp(strcat(['Object number = ', num2str(k)]))
disp(strcat(['Contrasrt = ',num2str(Contrast)]))
disp(strcat(['Correlation = ',num2str(Correlation)]))
disp(strcat(['Energy = ',num2str(Energy)]))
disp(strcat(['Homogeneity = ',num2str(Homogeneity)]))
end
=============================================================================================== result
=================================== Object number = 1 Contrasrt = 0.041167 0.059874 0.044501 0.058789 Correlation = 0.94909 0.92602 0.94497 0.92736 Energy = 0.98266 0.98226 0.98259 0.98228 Homogeneity = 0.99926 0.99893 0.99921 0.99895 =================================== Object number = 2 Contrasrt = 0.041167 0.059874 0.044501 0.058789 Correlation = 0.94909 0.92602 0.94497 0.92736 Energy = 0.98266 0.98226 0.98259 0.98228 Homogeneity = 0.99926 0.99893 0.99921 0.99895 =================================== Object number = 3 Contrasrt = 0.041167 0.059874 0.044501 0.058789 Correlation = 0.94909 0.92602 0.94497 0.92736 Energy = 0.98266 0.98226 0.98259 0.98228 Homogeneity = 0.99926 0.99893 0.99921 0.99895 . . . =================================== Object number = 26 Contrasrt = 0.041167 0.059874 0.044501 0.058789 Correlation = 0.94909 0.92602 0.94497 0.92736 Energy = 0.98266 0.98226 0.98259 0.98228 Homogeneity = 0.99926 0.99893 0.99921 0.99895

Réponses (0)

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by