alternative to using preview with logging to memory to avoid dropped frames

3 views (last 30 days)
I would like to capture a gigE camera data stream that is 14 bit and save it to a hardrive. my current method drops a frame every now and then, like 1 per second or so. I have found that preview with logging=disk works great but saves AVIs that are 8 bit. I would really like preview to show the image with agc ( so i can see what is happening) and save it as 14 bit without the agc applied ( so it can be post processed later). I am close to having this work by saving a stacked tiff, but still suffer from a dropped frame every now and then. The loop below is the fastest I think I can go, but I am blind because there is no display and there is still a dropped frame every now and then. Here i am writing a stacked tiff, maybe some other format would be faster? image sizes can be 640x480 to hd format
while ishandle(hh)
img = getsnapshot(vid);

Answers (1)

Bego on 16 Sep 2016
Hi Gerard!
I'm working on something similar. Yesteday I precisely asked a question in Maltab Answers about this situation. Although I haven't been given a working solution I think I'm close to it.
Have you seen the example ' myCameraGUI.m ' provided by the MathWorks Support Team? Well if you give it a look, you could re-use the strategy of having a GUI with an axes component, in which you constantly view the camera's acquisition.
On the other hand, have you tried using function peekdata() to save individual frames as they are acquired? = 1; = fps;
%Once all desired frames are acquired, video input will stop = numberofFramesToAquire;
....%Additional video input configuration
sample_frame = peekdata(obj,1);
This way by using peekdata(), information will still be on the buffer and at the very end of the acquisition you can write it all down using:
videodata = getdata(
Hope this helps.

Community Treasure Hunt

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

Start Hunting!