Info
此问题已关闭。 请重新打开它进行编辑或回答。
show an image in an AXES a) without outlines and b) can be clicked using ButtonDownFcn
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!