Trouble with rotating an image and saving it with different rotation angles.

1 回表示 (過去 30 日間)
Aliyuda Ali
Aliyuda Ali 2020 年 3 月 29 日
コメント済み: Aliyuda Ali 2020 年 4 月 1 日
Hi,
I am trying to rotate an image and save a set of the rotated images with different rotation angles but having this error: "Unable to perform assignment because the left and right sides have a different number of elements". Below is the code I tried so far. Can someone extend a hand of help, please?
I = imread('shale.png');
a = 1:4:360;
for i = 1:length(a)
K(i) = imrotate(I,a(i),'bilinear','crop');
end

回答 (1 件)

MaryD
MaryD 2020 年 3 月 29 日
You should try
K(numberOfRowsInImage,numberOfColumnsInImage,i) = imrotate(I,a(i),'bilinear','crop')
K(i) is just vector of size i so you can not asign whole image in such vector.
  3 件のコメント
MaryD
MaryD 2020 年 3 月 29 日
ok i think i can see the problem. Your image is RGB image so it has size numOfRows x numOfColums x 3. Try this:
I = imread('shale.png');
a = 1:4:360;
for i = 1:length(a)
K(:,:,:,i) = imrotate(I,a(i),'bilinear','crop');
end
Aliyuda Ali
Aliyuda Ali 2020 年 4 月 1 日
Well, this does not too.

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

カテゴリ

Help Center および File ExchangeGeometric 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