Figure zoom-in by mouse scroll is disabled after ROI is drawn

3 views (last 30 days)
figure;imshow(imread('pout.tif'));
Normally, I can use mouse scroll to zoom-in and zoom-out. But, if I draw ROI,
imrect();
The zoom-in by mouse scroll is disabled. I have to click the "+" icon on the top right to enable zoom in.
Although the newer drawrectangle() is not affected by this, I have to use old way imrect() because a lot of dependency. Is there any way to avoid this?

Answers (1)

Rahul
Rahul on 27 Feb 2023
An "imrect" object encapsulates an interactive rectangle over an image. You can adjust the size and position of the rectangle by using the mouse. The rectangle also has a context menu that controls aspects of its appearance and behavior.
However, starting in R2018b, a new set of ROI objects replaces the existing set of ROI objects. The new objects provide more functional capabilities, such as face color transparency. The new classes also support events that you can use to respond to changes in your ROI such as moving or being clicked. The mouse functionality is disabled as soon as the "imrect" object is created. Hence, the mouse properties such as zooming in/out is not allowed. As you can alter the position as well as height-width of the rectangle in "imrect", clicking option is available. Hence, you can use interactive pane given in the top-right corner but scolling operation is disabled. This issue is alleviated in "drawrectangle".

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!