Zoom while image axis 'Clipping' is 'off'

5 次查看(过去 30 天)
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]);
figure,
h=imshow(I);
set(h,'Clipping','off')
(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?
"

回答(1 个)

Soma Ardhanareeswaran
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

类别

Help CenterFile Exchange 中查找有关 Data Exploration 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by