MATLAB Answers

Continuous rotation of freehand object on matlab figure

1 view (last 30 days)
Nikan Fakhari
Nikan Fakhari on 2 Aug 2021
Answered: Ananya Tewari on 5 Aug 2021
Hi there,
I have displayed a ROI on the figure using freehand function and now I want the program to puase and wait for me to continously roate this object on my figure and after Im satisfied with the location excetue the program and get the new postion of object.
I know how to perform this on a rectangle object, but having difficulty with freehand.
Can anyone help me with this?
Nikan

Answers (1)

Ananya Tewari
Ananya Tewari on 5 Aug 2021
Hi,
The drawfreehand function provides the functionality of moving/dragging and editing the ROI that you created. Setting the Name-Value argument of 'FaceSelectable' as true would allow you to move the ROI as per your wish. The wait function will pause the code until the ROI edits are completed, double-click the ROI object to resume. Here is an example for the same.
imshow(imread('yellowlily.jpg'))
h = drawfreehand;
h.FaceAlpha = 1;
h.FaceSelectable = true;
wait(h);
% Once edited the ROI Double-click to proceed
% To get the Position of the ROI
roi_position = h.Position;

Community Treasure Hunt

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

Start Hunting!