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

1 Ansicht (letzte 30 Tage)
Yilong Zhang
Yilong Zhang am 28 Feb. 2022
Kommentiert: Yilong Zhang am 1 Mär. 2022
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 Kommentar
Matt J
Matt J am 1 Mär. 2022
Where is the "central z-axis" in the coordinates of your 3D grid? Which way does it point?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 28 Feb. 2022
The easiest way is to slice it into panes and rotate each pane and reassemble.
  3 Kommentare
Walter Roberson
Walter Roberson am 1 Mär. 2022
for k=512:-1:1
newimg(k, :, :) = imrotate(squeeze(img(k, :, :), Angle)) ;
end
Yilong Zhang
Yilong Zhang am 1 Mär. 2022
Yes! it works. Thank you so much!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Matt J
Matt J am 1 Mär. 2022
Bearbeitet: Matt J am 1 Mär. 2022
order=[3,1,2]; %example
A=permute(yourMatrix,order);
A=imrotate(A,30);
A=ipermute(A,order);
  1 Kommentar
Yilong Zhang
Yilong Zhang am 1 Mär. 2022
Thank you for your help,Matt. I have tried the code and it works well!

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Interactions, Camera Views, and Lighting finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by