Info

This question is closed. Reopen it to edit or answer.

How to show the zoom arround the mouse in subfigure window?

1 view (last 30 days)
Dear all,
I want to have a figure with two subfigures such that in one subfigure the input image is shown, while in the other subfigure a live zoom is shown at the mouse position.
I am using this code but seems I don't have a correct control of the subfigure handles.
I = imread('cameraman.tif');
handleIN = subplot(1, 2, 1);
imshow(I);
pointersize = 30;
handles.side_pointer = scatter(nan, nan, pointersize, 'y', 'Marker', '*');
C = get (handleIN, 'CurrentPoint');
X = C(1,1);
Y = C(1,2);
[H W] = size(I);
if X>W;
X = W-(2*W);
end
if Y>H;
Y= H-(2*H);
end
%zoom around the mouse
zoomwidth = 100;
xleft = max(0, X-zoomwidth/2);
ybot = max(0, Y-zoomwidth/2);
hold on
handle = subplot(1, 2, 2);
set(handle,'HandleVisibility','ON');
set(handle, 'XLim', [xleft xleft+zoomwidth], 'YLim', [ybot ybot+zoomwidth]);
imshow(I)
hold off
drawnow();
Any idea how to make it works?
Best, Meshoo

Answers (0)

Community Treasure Hunt

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

Start Hunting!