Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
saving an image

Subject: saving an image

From: Alex

Date: 29 Sep, 2010 13:59:22

Message: 1 of 3

Hi,

I am trying to save one image from video stream that I have from my camera.
here is my code:
////////////////////////////////////////////////////

function imagesaving
vid=videoinput('avtmatlabadaptor_r2009a',1,'F0M5_Mono8_640x480');
triggerconfig(vid,'manual');
set(vid,'FramesPerTrigger',1);
start(vid);
im=getdata(vid,1);
figure,imshow(im);
imwrite(im,'C:\Documents and Settings\mlm-ad\Desktop\M files\newimg.jpg','jpg')
end

this what I got after some secs:

/////////////////////////////////////////////////////
Error event occurred at 15:31:39 for video input object: F0M5_Mono8_640x480-avtmatlabadaptor_r2009a-1.
GETDATA timed out before FRAMES were available.
??? Error using ==> imaqdevice.getdata at 153
GETDATA timed out before FRAMES were available.

Error in ==> imagesaving at 7
im=getdata(vid,1);


I wonder how could I solve this problem. I would be grateful for your help.

Alex

Subject: saving an image

From: David Young

Date: 29 Sep, 2010 14:57:05

Message: 2 of 3

If you really just want one image from the camera, perhaps it's worth trying getsnapshot.

Otherwise, what you need to do is put the call to getdata into a callback function and register this with the video object. Then it will get called when a frame is ready. See the examples in the Image Acquisition Toolbox documentation.

Subject: saving an image

From: Alex

Date: 30 Sep, 2010 14:30:08

Message: 3 of 3

David Thanks for the hints it was helpful.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us