From: gavishna shah on
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
From: us on
"gavishna shah" <gavishna(a)yahoo.co.in> wrote in message <hv2ujj$88l$1(a)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