필터 지우기
필터 지우기

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