I am having trouble converting an indexed image to RGB and then back from RGB to an indexed image. For some reason, the result is different from the original. I am doing steganography so it can't work if the data is changed. This is my code and this is the sample image:
[J map]=imread('RoFox.gif');[rows cols color nframe]=size(J);for frame = 1:nframe Jrgb(:,:,:,frame)=ind2rgb(J(:,:,1,frame),map); Jind(:,:,1,frame)=rgb2ind(Jrgb(:,:,:,frame),map);endfor frame = 1:nframe isequal(Jind(:,:,1,frame),J(:,:,1,frame))end
This image has no transparancy and the colormap is unique. Variables J and Jind are supposed to be equal. Why are they being detected as being different?
Best Answer