How to rotate an image in Matlab
68 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(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.)
yanqi liu
2022-5-7
yes,sir,may be rot90,such as
im = imread('football.jpg');
for i = 1 : 4
im = rot90(im, 1);
figure; imshow(im, []);
end
1 个评论
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
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!