Azzera filtri
Azzera filtri

Updating Positions of ROI

7 visualizzazioni (ultimi 30 giorni)
Omer Akatekin
Omer Akatekin il 20 Mar 2021
Commentato: Omer Akatekin il 20 Mar 2021
Hi,
I would like to let user to draw line on image and after drawing is completed (resizing and moving line)
i would like to process position of line to determine length of line.
I = imread('File Path.jpeg');
imshow(I);
roi = drawline;
x = roi.Position;
listener(roi,'ROIMoved',@allevents);
function allevents(~,evt)
evname = evt.EventName;
if evname == 'ROIMoved'
a =evt.CurrentPosition
end
end
However when drawn line position is changed i could not get the evt.Current Position value into workspace .
  1 Commento
Omer Akatekin
Omer Akatekin il 20 Mar 2021
Well i found another solution:
Is it possible change ROIClicked to PressEnter ?
I = imread('*.jpeg');
imshow(I);
h = drawline;
pos = customWait(h);
function pos = customWait(hROI)
% Listen for mouse clicks on the ROI
l = addlistener(hROI,'ROIClicked',@clickCallback);
% Block program execution
uiwait;
% Remove listener
delete(l);
% Return the current position
pos = hROI.Position;
end
function clickCallback(~,evt)
if strcmp(evt.SelectionType,'double')
uiresume;
end
end

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by