Home > Archive > Matlab > April 2005 > Timeout error during getsnapshot()
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Timeout error during getsnapshot()
|
|
| Lee Wooan 2005-04-27, 9:01 am |
| Hi,
I would like to take one snapshot using the imaq toolbox, and I have
followed this example
<http://www.mathworks.com/support/so...olution=1-1CBPW>
However, when I tried to run the GUI attached at the end of this
solution, the following error occurred when I started then stopped
the running camera.
------[color=darkred]
??? A timeout occurred during GETSNAPSHOT.
Warning: The TimerFcn callback is being disabled.
To enable the callback, set the TimerFcn property.
------
After some fiddling with the program, it seems to me that I have
clicked on the "stop camera" button when matlab is actually inside
the getsnapshot() function. Since the camera has stopped running,
this function blocks(since it would not have received the whole
frame) and never returns. A timeout error occurs as the result. I
would like to ask if there is anything I can do so that my action of
clicking "stop camera" is processed NOT in parallel with the
getsnapshot function.
Thank you very much.
| |
| Dave Tarkowski 2005-04-27, 4:02 pm |
| It looks like the Image Acquisition Toolbox is not able to acquire an
image from the camera that you are using. What happens when you try to
bring up the preview window from the MATLAB command line? What hardware
are you using? What version of MATLAB are you using?
-Dave Tarkowski
On Wed, 27 Apr 2005 05:03:58 -0400, Lee Wooan wrote:
> Hi,
>
> I would like to take one snapshot using the imaq toolbox, and I have
> followed this example
>
> <http://www.mathworks.com/support/so...olution=1-1CBPW>
>
> However, when I tried to run the GUI attached at the end of this
> solution, the following error occurred when I started then stopped
> the running camera.
>
> ------
> ??? A timeout occurred during GETSNAPSHOT.
>
> Warning: The TimerFcn callback is being disabled.
> To enable the callback, set the TimerFcn property.
> ------
>
> After some fiddling with the program, it seems to me that I have
> clicked on the "stop camera" button when matlab is actually inside
> the getsnapshot() function. Since the camera has stopped running,
> this function blocks(since it would not have received the whole
> frame) and never returns. A timeout error occurs as the result. I
> would like to ask if there is anything I can do so that my action of
> clicking "stop camera" is processed NOT in parallel with the
> getsnapshot function.
>
> Thank you very much.
| |
| Lee Wooan 2005-04-27, 9:01 pm |
| Thanks for your reply
> It looks like the Image Acquisition Toolbox is not able to acquire
an image from the camera that you are using.
the getsnapshot function does acquire valid images that I can display
on an axes inside a GUI. However, it looks to me that the getsnapshot
function and the bottonClick_callback functions are running in
parallel, so that one does not stop the other. Or does this have
anything to do with eventqueue? (ie. there are enqueued but
unprocessed timer events when the camera is stopped. These are then
processed, but since the camera is stopped, the getsnapshot function
in the TimerFcn can not acquire data hence blocks -- I am only
guessing on the cause. Please excuse me if I am talking nonsense)
> What happens when you try to bring up the preview window from the
MATLAB command line?
I can see the preview window and myself being imaged
> What hardware are you using? What version of MATLAB are you using?
I am using a simple USB Creative WebCam. The version of Matlab I am
using is 7.0.1(R14) SP1
I have one more question regarding GUI design. I would like to stop
the camera from running when a 'stop camera' button is clicked, but
currently my GUI misses about 80% of the button click actions (ie. I
click on the stopCamera button, it is released automatically
regardless of how long I try to hold it down and the camera does not
stop running). The callback function I am using looks like the
following;
% --- Executes on button press in capImg_startStopCam.
function capImg_startStopCam_Callback(hObject, eventdata, handles)
% hObject handle to capImg_startStopCam (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
if ~isrunning(handles.video)
% Camera is off. Change button string and start camera.
set(handles.capImg_startStopCam,'String','Stop Camera');
start(handles.video);
else
% Camera is on. Stop camera and change button string.
set(handles.capImg_startStopCam,'String','Start Camera');
stop(handles.video);
end;
guidata(hObject, handles);
drawnow;
-----
Thanks!
Dave Tarkowski wrote:
>
>
> It looks like the Image Acquisition Toolbox is not able to acquire
> an
> image from the camera that you are using. What happens when you
> try to
> bring up the preview window from the MATLAB command line? What
> hardware
> are you using? What version of MATLAB are you using?
>
> -Dave Tarkowski
>
> On Wed, 27 Apr 2005 05:03:58 -0400, Lee Wooan wrote:
> have
this[color=darkred]
> stopped
have[color=darkred]
> inside
running,[color=darkred]
I[color=darkred]
action[color=darkred]
> of
>
|
|
|
|
|