Zoom while image axis 'Clipping' is 'off'

6 views (last 30 days)
benju on 12 Oct 2016
I have a question about zooming images, which has been phrased very well on http://stackoverflow.com/questions/19488096 , but which has remained unanswered:
I try displaying image with non standard aspect ratio in my GUI. But when I zoom-in the image is clipped to the original axes position. I've managed to solve this problem by setting the 'Clipping' property to 'off'. But now for some reason the pan and zoom tools are only active while the mouse hovers over the initial position of the image (the position it had before I zoomed in).
Here is a piece of code for demonstration (I'm using Matlab 2011a, but also noticed the problem in other versions):
I = repmat(imread('cameraman.tif'), [1 20]);
(Just run those lines and try zooming in once or twice. The zoom/pan tools will only work in the area where the image initially was.)
Is there a way of zooming in without clipping the image, and yet getting the pan and zoom tools to work all over the enlarged image?

Answers (1)

Soma Ardhanareeswaran
Soma Ardhanareeswaran on 20 Oct 2016
In the case of 'imshow' there is an axes created to display the image which does not get affected by the clipping/panning that is performed. That is why the boundary for zoom and pan is confined to the original axes and not the zoomed image.
However, you can use 'imtool' to zoom/pan without clipping the image. Refer to - https://www.mathworks.com/help/images/ref/imtool.html

Community Treasure Hunt

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

Start Hunting!

Translated by