フィルターのクリア

How to rotate an image in Matlab

51 ビュー (過去 30 日間)
Emir Mulic
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
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
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
ac_bm_mat 2022 年 5 月 5 日
編集済み: ac_bm_mat 2022 年 5 月 5 日
A = imread('ngc6543a.jpg');
You may use imread to read an image to a matrix.
Then operating with A matrix can give you 90 degree rotated image.

yanqi liu
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
Image Analyst 2022 年 5 月 7 日
rot90 is a built in function, which he is not allowed to use.

サインインしてコメントする。


Image Analyst
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

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by