【发布时间】:2014-09-20 04:07:32
【问题描述】:
当我左键/右键单击图像上的某个点时,我想放大/缩小图像,但我不想使用放大镜进行放大/缩小。基本上,我需要一个我上面所说的脚本。我想出了以下脚本,但它只放大/缩小到中心而不是我点击的位置。
如果你问我为什么使用ginput 获得点击位置,答案是,我打算使用这个脚本来编辑二进制图像!我已经删除了与二进制图像编辑部分相对应的行以避免任何混淆。
hFi= figure; imshow(e);
button=0;
while button~=2
% Get the mouse position on the axes (needed for binary image editing) and button number
[y,x,button]=ginput(1);
% Get the mouse position on the figure
position=get(hFi,'CurrentPoint')
% Set 'CurrentPoint' to the mouse position that was just captured
set(hFi,'CurrentPoint',position)
% Determine if it is a zoom-in or zoom-out
if button==1
zoom(2);
elseif button==3
zoom(0.5);
end
end
我认为命令set() 在这里没有做任何事情,但我看到有人在论坛中建议。对不起,如果这看起来很愚蠢!
【问题讨论】:
标签: matlab zooming mouse ginput