Rotate 3D (512*512*512 double) matrix

1 回表示 (過去 30 日間)
Yilong Zhang
Yilong Zhang 2022 年 2 月 28 日
コメント済み: Yilong Zhang 2022 年 3 月 1 日
Hi. I have a 3D matrix in double type (512*512*512 double) and I want to rotate 30 degree anticlockwise around central z-axis. Can anyone please give me an idea how to do this? Many thanks,
  1 件のコメント
Matt J
Matt J 2022 年 3 月 1 日
Where is the "central z-axis" in the coordinates of your 3D grid? Which way does it point?

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

採用された回答

Walter Roberson
Walter Roberson 2022 年 2 月 28 日
The easiest way is to slice it into panes and rotate each pane and reassemble.
  3 件のコメント
Walter Roberson
Walter Roberson 2022 年 3 月 1 日
for k=512:-1:1
newimg(k, :, :) = imrotate(squeeze(img(k, :, :), Angle)) ;
end
Yilong Zhang
Yilong Zhang 2022 年 3 月 1 日
Yes! it works. Thank you so much!

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

その他の回答 (1 件)

Matt J
Matt J 2022 年 3 月 1 日
編集済み: Matt J 2022 年 3 月 1 日
order=[3,1,2]; %example
A=permute(yourMatrix,order);
A=imrotate(A,30);
A=ipermute(A,order);
  1 件のコメント
Yilong Zhang
Yilong Zhang 2022 年 3 月 1 日
Thank you for your help,Matt. I have tried the code and it works well!

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

カテゴリ

Help Center および File ExchangeInteractions, Camera Views, and Lighting についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by