Clear Filters
Clear Filters

Info

This question is closed. Reopen it to edit or answer.

please provide with the color identification base paper for the following code

2 views (last 30 days)
a=0;
b=0;
c=0;
p=0;
p1=0;
I=imread('E:\projectimages\imgs\clg.jpg')
imshow(I)
fnam=imread('E:\projectimages\imgs\clg.jpg');
figure,imshow(fnam)
for mm = 1:size(fnam,1)
for nn = 1:size(fnam,2)
if (fnam(mm,nn,2)) > fnam(mm,nn,1) && (fnam(mm,nn,2)) > fnam(mm,nn,3)
fnam(mm,nn,1) = fnam(mm,nn,1);
fnam(mm,nn,2) = fnam(mm,nn,2);
fnam(mm,nn,3) = fnam(mm,nn,3);
a=a+1;
%
else
fnam(mm,nn,1) = 0;
fnam(mm,nn,2) = 0;
fnam(mm,nn,3) = 0;
b=b+1;
end
end
end
p = a / (a + b);
p1 = p * 100;
imshow(fnam);
a = sprintf('Vegetation Pixel Count= %3d',a);
b = sprintf('Non Vegetation Pixel count= %3d',b);
c = sprintf('Percentage of area of veg is %3f %',p1);
msgbox(a);
msgbox(b);
msgbox(c);

Answers (1)

Walter Roberson
Walter Roberson on 23 Mar 2017
There is no "paper" for that. The code just extracts the pixels for which the green component is greater than the red or blue, and calls those pixels "vegetation". That is not a robust way to calculate vegetation. For one thing, it leaves out all brown, but a lot of wood is brown.

This question is closed.

Community Treasure Hunt

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

Start Hunting!