# How to rotate an image in Matlab

조회 수: 56(최근 30일)
Emir Mulic 2022년 5월 4일
편집: Image Analyst 2022년 5월 7일
For my class project I have to create an app which loads an image and allows you to change Red, blue, green colors and the brightness. I have sucessfully coded this app. Now I have to add a button which would allow me to rotate the image 90 degrees each time. The requirements is that I do not use any pre existing matlab functions, but have to create my own.
Would greatly appreciate any help on this. Thank you.

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

### 답변(4개)

J Chen 2022년 5월 4일
You basically read the image into a matrix, then change the array element to a different location (swich row to column, etc.)
##### 댓글 수: 1표시숨기기 없음
Emir Mulic 2022년 5월 4일
How would i store the image into an empty matrix. And then would I use some matrix transpose function ?

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

ac_bm_mat 2022년 5월 5일
편집: ac_bm_mat 2022년 5월 5일
Then operating with A matrix can give you 90 degree rotated image.
##### 댓글 수: 0표시숨기기 이전 댓글 수: -1

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

yanqi liu 2022년 5월 7일
yes，sir，may be rot90，such as
for i = 1 : 4
im = rot90(im, 1);
figure; imshow(im, []);
end
##### 댓글 수: 1표시숨기기 없음
Image Analyst 2022년 5월 7일
rot90 is a built in function, which he is not allowed to use.

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

Image Analyst 2022년 5월 7일
편집: Image Analyst 2022년 5월 7일
You can use the apostrophe operator '
yourImage = yourImage';
This transposes the matrix. To now get a mirror image you have to swap rows or columns.
You can use the rotation matrix: https://en.wikipedia.org/wiki/Rotation_matrix

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

### 범주

Find more on Image Processing and Computer Vision in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by