Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

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

1 visualizzazione (ultimi 30 giorni)
Meshooo
Meshooo il 28 Set 2016
Chiuso: MATLAB Answer Bot il 20 Ago 2021
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

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by