Continuous rotation of freehand object on matlab figure

3 次查看(过去 30 天)
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

回答(1 个)

Ananya Tewari
Ananya Tewari 2021-8-5
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!

Translated by