The function flipdim
will work for N-D matrices, whereas the functions flipud
and fliplr
only work for 2-D matrices:
img = imread('peppers.png'); %# Load a sample image
imgMirror = flipdim(img,2); %# Flips the columns, making a mirror image
imgUpsideDown = flipdim(img,1); %# Flips the rows, making an upside-down image
NOTE: In more recent versions of MATLAB (R2013b and newer), the function flip
is now recommended instead of flipdim
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…