Buttondownfcn callback on live video data (preview)

Hello,
I am currently trying to initiate a callback routine when the user presses on an axis that contains a live video stream, i.e.
frame = getsnapshot(handles.vidObj);
axes = imshow(frame, 'Parent', handles.axes_stream);
preview(handles.vidObj, axes); % assign vidObj to axes
However, I have not yet been able to achieve this despite looking at various discussions. I presume it is because the displayed video is stopping my mouse button being registered and the callback routine is not working.
Any help would be appreciated.

댓글 수: 1

Sam
Sam 2012년 11월 18일
Anyone? I'm starting to think that maybe it's not possible.

답변 (1개)

Sean de Wolski
Sean de Wolski 2012년 11월 16일

0 개 추천

I am guessing that preview is nullifying your ButtonDownFcn (just an educated guess though). Thus you would need to reinstate your ButtonDownFcn on the axes after calling preview.

댓글 수: 8

Hello, thanks for your input. I have already tried this but to no avail, i.e.
set(handles.axes_stream,'buttondownfcn',{@axes_Callback, handles});
This is set after:
preview(handles.vidObj, axes); % assign vidObj to axes
Is the axes' 'Hittest' turned off?
You may want to check this.
get(ax,'hittest');
And look in the documentation for axes properties for a more thorough explanation of why.
Hello,
I have set hittest off:
set(handles.axes_stream,'Hittest','off');
And have checked that it is off using breakpoints in the program. I still cannot get the callback function to initiate when clicking on the axes.
Well I would guess that is the issue - you want the 'HitTest' to be on :).
If the axes can't become the current object, it's ButtonDownFcn will never fire...
Sam
Sam 2012년 11월 22일
Hello,
I have tried this but the ButtonDownFcn is still not firing. :'( I guess I will have to rethink my strategy. Thanks for your input guys!
Sam, if your license's SMS is current, please contact Technical Support.
Image Analyst
Image Analyst 2012년 11월 26일
편집: Image Analyst 2012년 11월 26일
I haven't tried clicking on the live video axes. Would clicking on a button be an acceptable workaround? Because I know I can click on buttons while I have a live image in an axes, and it does the callback operations just fine.
Sam
Sam 2012년 11월 26일
I will contact Technical Support and see what they have to say and report back. For now, I will use buttons to provide the necessary functionality.
Cheers everyone!

이 질문은 마감되었습니다.

질문:

Sam
2012년 11월 16일

마감:

2021년 8월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by