MATLAB: How to change the order of the Y axis and not flip the image

imageimage processing

I need to flip just the y axis and not the image itself. I'm using the image function to plot this image, however due to the way matlab reads images, it results in the Y axis being from top to bottom. I tried using (set(gca,'YDir','normal')) but this flips the image too. Is there a way to just flip the Yaxis? Any help would be appreciated.

Best Answer

You could try this:
I=imread('cameraman.tif');
figure;
subplot(1,2,1)
imshow(I);axis on
subplot(1,2,2)
I2=flipud(I)
imshow(I2);axis on
set(gca,'YDir','normal')