Why is metadata from getsnapshot empty?

I am using the image acquisition toolbox to capture video from a Logitech C920 USB webcam with the 'winvideo' adaptor.
I'm trying to acquire and process time-stamped images in an infinite loop. My current method (below) is based on the second approach in demoimaq_GetSnapshot.m to achieve a high frame rate. The problem I'm having is that the metadata output when I call getsnapshot is empty, and so I am missing the timestamp for the snapshot. My current best guess is that it's something to do with the video adaptor configuration?
I've also tried peekdata, but it also doesn't seem to return time-stamps. getdata definitely returns time stamps but I'm unsure how to use it with a manual trigger, it seems more suited to a single acquisition to me?
Any thoughts/guidance would be much appreciated.
>> vidL=videoinput('winvideo',1,'MJPG_1920x1080');
>> triggerconfig(vidL, 'manual');
>> start(vidL)
>> [snapshotL,metaL] = getsnapshot(vidL);
>> metaL
metaL =
struct with no fields.

4 Comments

Do you find any solution. I also met this problem
What metadata were you expecting? It just returns the pixel values. You can add in anything else that you know and want to save with the image.
I donot know what's your meaning. But I find the function is [frame, metadata] = getsnapshot(obj) returns metadata, a 1-by-1 array of structures. This structure contains information about the corresponding frame. The metadata structure contains the field AbsTime, which is the absolute time the frame was acquired, expressed as a time vector. In addition to that field, some adaptors may choose to add other adaptor-specific metadata as well.
So I expect the metadata contain the time stamp...
I don't know who adds that in. Sounds like the Mathworks but the documentation also says that additional metadata may be provided by the manufacturer of the camera. So contact your camera manufacturer and ask them what metadata they think should be returned. If they say they get the absolute time from MATLAB but then throw it away and don't return it, then you can add it back in for the now function;
metaL.AbsTime = now();

Sign in to comment.

Answers (2)

I don't know. I never tried. Of course you can get the current time with the now() function.

1 Comment

Thanks. Yes I suppose now would give a good estimate as long as getsnapshot doesn't take too long to run.

Sign in to comment.

Hi.
I have exactly the same problem: metadata is empty. I am using a frame grabber manufactured by "the imaging source".
Could you find a solution?
Thanks

Asked:

on 1 Apr 2016

Commented:

on 16 Jul 2017

Community Treasure Hunt

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

Start Hunting!