rotate image

조회 수: 2 (최근 30일)
Xianjie
Xianjie 2012년 5월 16일
When I create a image in matlab with rotate command. The image does not like the correct display. The tip is that the rotate changes the Xdata, Ydata, and Zdata properties of the appropriate graphics object. How can I control it? After I rotate the image, the y value will be the maximum, the shape is right. The maximum deformation is in the center of the plate, but the display is that the maximum (red region) is at the top of rotating plate. What's wrong? thank you
The simple example is as following:
x = (0:0.1:2);
y = (0:0.1:2);
X=ones(size(y))*x; Y=y*ones(size(x));
Z = sin(X).*sin(Y);
h = surf(X,Y,Z)
hold on
surf(X+2,Y,Z)
rotate(h,[0,1,0],90,[2,0,0])
  댓글 수: 2
Honglei Chen
Honglei Chen 2012년 5월 16일
Your code doesn't run, could you double check? Also please format the code.
Honglei Chen
Honglei Chen 2012년 5월 16일
I think you should use [X,Y] = meshgrid(x,y)

댓글을 달려면 로그인하십시오.

채택된 답변

Honglei Chen
Honglei Chen 2012년 5월 16일
The default coloring of surf is decided by Z axis value, so MATLAB is behaving as expected. If you want to preserve the original coloring, you need to set CData.
x = (0:0.1:2);
y = (0:0.1:2);
[X,Y] = meshgrid(x,y);
Z = sin(X).*sin(Y);
h = surf(X,Y,Z)
rotate(h,[0,1,0],90,[2,0,0])
set(h,'CData',Z)
  댓글 수: 1
Xianjie
Xianjie 2012년 5월 16일
Thank you very much

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by