How to rotate an image along y-axis?

조회 수: 7 (최근 30일)
Geetika
Geetika 2014년 1월 21일
댓글: Image Analyst 2015년 2월 4일
I want to rotate an image along y-axis. I tried using 'rotate' command of MATLAB but could not succeed. Can anyone plz help?

답변 (2개)

Nitin
Nitin 2014년 1월 22일
Please try imrotate, you can find more information here
Alternatively, you can try flipdim or rot90
  댓글 수: 3
Kritika
Kritika 2015년 2월 4일
Hello,
I also have the same problem as of your.Hoping that you might have found some solution to this problem.So, Please share your solution with me. you can mail me at kritikamittal1991@gmail.com
Image Analyst
Image Analyst 2015년 2월 4일
See my answer below.

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


Image Analyst
Image Analyst 2015년 2월 4일
If you want rotation along the y axis instead of the z axis, then the image will appear foreshortened (narrower), thus the width is reduced. So you can simply use imresize() to calculate the new size. The new number of columns will be
theta = pi/12; % Whatever.
[rows, columns, numberOfColorChannels] = size(originalImage);
newColumns = columns * cos(theta);
rotatedImage = imresize(originalImage, [rows, newColumns]);
This will be like you're tilting the right edge of the image towards you as you look down along the z axis to it (looking at the image perpendicularly).
  댓글 수: 2
Geetika
Geetika 2015년 2월 4일
Thank you very much for your reply. But what if I rotate the image by pi/2 means 90 degrees. It will just return a column vector. How to visualize the new image?
Image Analyst
Image Analyst 2015년 2월 4일
Yes, if you rotate along the y axis, the image will rotate out of the plane and you will be looking at it "edge-on". It will be a column vector. Similarly if you rotate 90 degrees about the x axis, you will get a row vector. I don't know why you'd want to do that, but you can use imshow() to visualize the new edge-on image.

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

카테고리

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