How to delete a ROI after having drawn a new one
6 views (last 30 days)
Show older comments
Hello all.
In my program I create a square roi using imrect and impoly, the user has to position, resize and roate it on the image as he sees fit, but when the user resizes and rotate the roi a new one is created... Im having problems erasing the old one from the image. Does anybody has an idea how could I do that?
I already tried a function from Image Analyst -
function ClearLinesFromAxes()
axesHandlesToChildObjects = findobj(gca, 'Type', 'line');
if ~isempty(axesHandlesToChildObjects)
delete(axesHandlesToChildObjects);
end
return; % from ClearLinesFromAxes
but it clears all the image and I already have some other plots on it that shouldn't be erased...
and tried also - set(ROI_Q,'Visible','off')
Thanks
0 Comments
Accepted Answer
Matt Kindig
on 25 Feb 2013
Probably the most robust way is to save the handles to imrect/impoly and then delete just that object. Something like this:
hrect = imrect(IMG) % your imrect code here
hpoly = impoly(IMG) % your impoly code here
%and then later when you want to delete it:
delete(hrect);
delete(hpoly);
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!