フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

show an image in an AXES a) without outlines and b) can be clicked using ButtonDownFcn

1 回表示 (過去 30 日間)
Salad Box
Salad Box 2018 年 4 月 26 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hi, I would like to show an image in the axes in the GUI to achieve two things: a) the image showed has no outlines if I use the command 'image()' rather than 'imshow'; b) the ButtonDownFcn can be activated when I click on the image.
I have two different approaches to achieve a), however these two different approaches one can also achieve b) while the other could not achieve b). I would like to find out why.
Approach 1:
RGB = imread('picture1.jpg');
h = image(RGB);
set(handles.axes1,'xtick',[]);set(handles,axes1,'ytick',[]);* % remove the xtick and ytick
set(handles.axes1,'xcolor,[0.3 0.3 0.3]),set(handles.axes1,'ycolor',[0.3 0.3 0.3]); % set the xcolor and ycolor the same as the background color.
set(h,'hittest','off');
set(handles.axes1,'ButtonDownFcn',@click);
Approach 2:
RGB = imread('picture1.jpg');
set(handles.axes1,'Visible','off','NextPlot','add');
h = image(RGB,'Parent',handles.axes1);
set(h,'hittest','off');
set(handles.axes1,'ButtonDownFcn',@click);
Now both approach 1 and 2 can achieve a) while approach 1 can also achieve b) but approach 2 can't achieve b). In another word, code written in approach 2 does not respond to click, why?
Would anyone know what happened here?
Many thanks!

回答 (0 件)

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by