Interactively rotating images without changing viewpoint elevation?

3 ビュー (過去 30 日間)
Vlad Atanasiu
Vlad Atanasiu 2020 年 9 月 10 日
編集済み: Vlad Atanasiu 2020 年 9 月 12 日
I display an image on a figure and wish to rotate it interactively around the central pixel. For example, a document with text running horizontaly and vertically. When using rotate3d you usually change the viewpoint's both azimuth and elevation and the image will look as if it is displayed in 3D, you even can look at it from below. Therefore, I am looking at a method to keep elevation constant at 90°. Below is my code that doesn't work and the error message it generates.
function constrained3drotation
figure;
ax = axes;
I = imread('text.png');
imshow(I,'Parent',ax);
ax.Toolbar = [];
rotateObject = rotate3d(ax);
rotateObject.Enable = 'on';
rotateObject.ButtonDownFilter = @Constrain3dRotation;
rotateObject.UseLegacyExplorationModes = 'on';
function Constrain3dRotation(~,event)
event.Source.CurrentAxes.Toolbar = [];
axesAttitude = event.Source.CurrentAxes.View;
event.Source.CurrentAxes.View = [axesAttitude(1), 90];
end
end
% Warning: An error occurred during the mode callback.
% > In matlab.uitools.internal.uimode/modeWindowButtonDownFcn (line 100)
% In matlab.uitools.internal.uimode/modeControl>localModeWindowButtonDownFcn (line 152)

採用された回答

Vlad Atanasiu
Vlad Atanasiu 2020 年 9 月 12 日
編集済み: Vlad Atanasiu 2020 年 9 月 12 日
Solution: activate the camera toolbar with cameratoolbar, then use the Camera Roll tool to rotate the image in its own plane. Thank you!

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by