フィルターのクリア

ButtonDownFcn for axes not working.

5 ビュー (過去 30 日間)
ImageProcessor
ImageProcessor 2016 年 4 月 1 日
コメント済み: ImageProcessor 2016 年 4 月 4 日
Hi everyone, i have two axes, axes1 and axes2. axes1 contains an image, and axes2 is empty. I want the axes1 image to get copied on axes2, when i click axes1 image body. I tried the following:
set(handles.axes1,'ButtonDownFcn',{@copyImg,img});
function copyImg(img)
axes(handles.axes2);
imshow(img);
end
But no response when I click the image. What am I doing wrong ? Any help would be appreciated. Thanks in advance !

採用された回答

Walter Roberson
Walter Roberson 2016 年 4 月 1 日
The image is absorbing the clicks. You need to turn off its Hittest property if you are using R2014a or earlier, and for R2014b or later, turn off its PickableParts property.
  3 件のコメント
Image Analyst
Image Analyst 2016 年 4 月 2 日
No - you don't turn the hittest off for the axes, you turn it off for the image. Get the handle to the image from imshow():
hImage = imshow(.....
set(hImage, 'hittest', 'off');
or something like that. (I didn't test it).
Alternatively you'd have to set up a callback for the image itself, and have the image callback do what you're having the axes callback do now, but that's a lot less straightforward.
ImageProcessor
ImageProcessor 2016 年 4 月 4 日
Thank you ! It worked !

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by