Filter löschen
Filter löschen

rotating image using app designer

28 Ansichten (letzte 30 Tage)
Lesly
Lesly am 17 Apr. 2024 um 1:20
Beantwortet: Image Analyst am 17 Apr. 2024 um 4:01
Hello, I need some help in rotating an image when using a buttom to rotate. I know that I have to use imrotate but im am not sure where to go from here.
% Button pushed function: RotateButton
function rotate(app, event)
app.img2 = imrotate(app.img, 90);
imshow(app.img2);
end
end
this is what I have so far, img is for the orginal image use.

Antworten (1)

Image Analyst
Image Analyst am 17 Apr. 2024 um 4:01
Assuming you have an image variable, not a widget on the UI, called app.img, it should work. But I don't know what app.img is. Did you assign an image as a new field of the app structure? If so that should work. But if img is the name of an axes control that you placed on the UI window that would not work. You would need to get your actual image variable and rotate it and then display it. Something like
rgbImage = imread('peppers.png');
rgbImage = imrotate(rgbImage, 90); % Rotate it and put it back in the same variable.
imshow(rgbImage, 'Parent', app.img); % Display it in the "img" axes control on the GUI.

Community Treasure Hunt

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

Start Hunting!

Translated by