xor example not working

  • Follow


Kindly tell me why the original image is not coming with this code. The resulting image receive is yellowish in color,instead of being similar to the image Img_new

Img=imread(‘lena_color.tif’);
Img_new=rgb2gray(img);
Send=zeroes(size(Img_new);
Receive= zeroes(size(Img_new);
Mask= rand(size(Img_new);
for i=1 :256
for j=1:256
Send(i,j)=xor( Img_new(i,j),mask(i,j));
end
end

image(send);
imshow(send);


for i=1 :256
for j=1:256
receive(i,j)=xor( send(i,j),mask(i,j));
End
End

image(receive);
imshow(receive);

Also will the for loop be in this way if i dont convert to gray and work directly with RGB
for i= 1: size(ilena_color,1)
for j=1:size(lena_color,2);
for k=1:size(lena_color.3)

send(i,j,k)= xor(img(i,j,k),mask(i,j,k);
end
end
end


Plz help
0
Reply gavishna 6/13/2010 3:48:03 PM

"gavishna shah" <gavishna@yahoo.co.in> wrote in message <hv2ujj$88l$1@fred.mathworks.com>...
> Kindly tell me why the original image is not coming with this code. The resulting image receive is yellowish in color,instead of being similar to the image Img_new

> for i=1 :256
> for j=1:256
> receive(i,j)=xor( send(i,j),mask(i,j));
> End
> End

a hint:
- carefully look at this, again

     help xor;

- also note: XOR is fully vectorized, hence, your loop can be converted into

     rec=xor(snd,msk);

us
0
Reply us 6/13/2010 3:58:03 PM


1 Replies
396 Views

(page loaded in 0.04 seconds)

Similiar Articles:













7/21/2012 10:49:11 PM


Reply: