Changing the CData on an RGB image to a greyscale image causes incorrect colours (shades of red). I'm assuming it's something to do with the colormap. Pseudocode of what I'm trying:
handle = imshow(RBGImage); % Shows up fine
greyscaleImage = rgb2gray(RGBImage);set(handles, 'CData', greyscaleImage); % Produces 'redscale' image
If I do it the other way round, replacing greyscale with RGB, it works fine.
I have tried colormap(fig, 'gray') but this produces a solid grey image during normal execution. Strangely if I step through the code it instead produces a greyscale image of the wrong hue. Just using imshow(greyscaleImage) works fine but I'm trying to prevent repeated imshow calls.
Best Answer