i have a problem with the intersection of binary images.

1 visualización (últimos 30 días)
charuleelaa vanilavarasu
charuleelaa vanilavarasu el 14 de Mzo. de 2016
Editada: charuleelaa vanilavarasu el 14 de Mzo. de 2016
I'm trying to implement the attached paper. But the output i'm getting after intersection is just a black image. I don't know what i'm doing wrong.Am i doing only the intersection wrong or everything else too?!can someone please help? here is the code:
A=imread('image\4.jpg');
figure,imshow(A);title('RGB Image');
%Represent the RGB image in [0 1] range
I=double(A)/255;
R=I(:,:,1); G=I(:,:,2); B=I(:,:,3);
%Hue
numi=1/2*((R-G)+(R-B));
denom=((R-G).^2+((R-B).*(G-B))).^0.5;
%To avoid divide by zero exception add a small number in the denominator
H=acosd(numi./(denom+0.000001));
%If B>G then H= 360-Theta
H(B>G)=360-H(B>G);
%Normalize to the range [0 1]
H=H/360;
%Saturation
S=1- (3./(sum(I,3)+0.000001)).*min(I,[],3);
%Intensity
I=sum(I,3)./3;
%HSI
HSI=zeros(size(A));
HSI(:,:,1)=H;
HSI(:,:,2)=S;
HSI(:,:,3)=I;
figure,imshow(HSI);title('HSI Image');
figure,imshow(H);title('hue component');
mis=I-S;
figure,imshow(mis);title('intensity-saturation');
red = A(:,:,1); % Red channel
green = A(:,:,2); % Green channel
blue = A(:,:,3); % Blue channel
a = zeros(size(A, 1), size(A, 2));
just_red = cat(3, red, a, a);
just_green = cat(3, a, green, a);
just_blue = cat(3, a, a, blue);
back_to_original_img = cat(3, red, green, blue);
figure, imshow(A), title('Original image')
%figure, imshow(just_red), title('Red channel')
%figure, imshow(just_green), title('Green channel')
figure, imshow(just_blue), title('Blue channel')
figure, imshow(back_to_original_img), title('Back to original image')
mgb=just_green - just_blue;
figure,imshow(mgb);title('green-blue');
l1 = graythresh(H);
B1 = im2bw(H,l1);
figure,imshow(B1);title('b1');
l2 = graythresh(just_blue);
B2 = im2bw(just_blue,l2);
figure,imshow(B2);title('b2');
l3 = graythresh(mis);
B3 = im2bw(mis,l3);
figure,imshow(B3);title('b3');
l4 = graythresh(mgb);
B4 = im2bw(mgb,l4);
figure,imshow(B4);title('b4');
Int1 = B1 & B2;
Int2 =B3 & B4;
Int3 =Int1 & Int2;
figure,imshow(Int3);title('result');

Respuestas (0)

Categorías

Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by