IMAGE1
IMAGE2
理想的图片
我正在使用功能flipud
和rot90
将 IMAGE1 旋转为 IMAGE2 ,如下所示:
IMAGE2=rot90(flipud(IMAGE1));
然而,不知何故,我没有得到理想的图像所需的结果。谁能找出原因?请忽略期望图像中的侧面图例剪切。
答案 0 :(得分:1)
以下是2D数组的示例(请参阅注释)
%# create a 2D array (3x3, but it'll work for 50x50 as well)
m = magic(3)
m =
8 1 6
3 5 7
4 9 2
%# flip, then rotate, but rotate clockwise, hence the -1
rot90(flipud(m),-1)
ans =
8 3 4
1 5 9
6 7 2
%# Note that this is the same as taking the transpose
m'
ans =
8 3 4
1 5 9
6 7 2