i have a code of H,I,S to find out greenness, but iam not getting the fully greenish portion, instead displayig the gray portion and even if the trees are dry....please provide me the code
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
clc
clear all
close all
%Tree Crown Detection and Delineation in High Resolution RS Image
F=imread('E:\projectimages\AU.jpg');
imshow(F);
title('Input image');
F=im2double(F);
r=F(:,:,1);
g=F(:,:,2);
b=F(:,:,3);
th=acos((0.5*((r-g)+(r-b)))./((sqrt((r-g).^2+(r-b).*(g-b)))+eps));
H=th;
H(b>g)=2*pi-H(b>g);
H=H/(2*pi);
figure,imshow(H);
title HUE
S=1-3.*(min(min(r,g),b))./(r+g+b+eps);
figure,imshow(S);
title SATURATION
I=(r+g+b)/3;
figure,imshow(I);
title INTENSITY
hsi=cat(3,H,S,I);
figure,imshow(hsi);
title HSI
%GAUSSIAN FILTERING
h = fspecial('gaussian', [11,11], 2);
I1 = imfilter(hsi,h);
figure,imshow(I1);
title('STAGE-A Filtered image');
%STAGE - C
HE=H*2*pi;
HE=histeq(HE);
figure,imshow(HE);
title HISTOGRAMEQUALIZATION;
HE=HE/(2*pi);
SE=histeq(S);
figure,imshow(SE);
title HISTOGRAMEQUALIZATION;
IE=histeq(I);
figure,imshow(IE);
title HISTOGRAMEQUALIZATION;
D = (SE-IE);
figure,imshow(D);
title('STAGE-D Normalized difference image');
[m,n] = size(SE);
E = zeros(m,n);
for i = 1:m
for j = 1:n
if D(i,j) > 0
E(i,j) = 1;
else
E(i,j) = 0;
end
end
end
figure,imshow(E);
title('STAGE-E CANDITATE REGIONS');
%
cc1 = bwconncomp(E);
stats = regionprops(cc1, 'Area');
idx1 = find([stats.Area] > 25000);
BW4 = ismember(labelmatrix(cc1), idx1);
figure,imshow(BW4);
title('TREE');
G = edge(BW4,'sobel');
figure,imshow(G);
title('CROWNS');
[a,b] = find(G==1);
figure,imshow(F);hold on;
for i =1:length(a)
plot(b(i),a(i),'y-');hold on;
end
title('Delineation result');
1 Kommentar
kowshik Thopalli
am 5 Mär. 2017
can you post the pictures so that we can understand what is happening. Also please provide your gmap2 image else we will not be able to reproduce your results.
Antworten (0)
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!