Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

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

조회 수: 1 (최근 30일)
Meshooo
Meshooo 2016년 9월 28일
마감: MATLAB Answer Bot 2021년 8월 20일
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

답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by