12-07-2015 12:22 AM
Hi everyone!
I want to use LabVIEW to acquire and save images from my Basler camera.
The problem now is I need to acquire images with a high fps (say 50 fps), and save every acquired frame. But when I start saving images, the actual fps would be much lower than the fps I needed. The attachment is my VI. Does anyone have some good solutions to this problem?
12-07-2015 12:31 AM
12-07-2015 12:41 AM
Hi Mike,
The acquiring time could be around 10 secs, and the image format is PNG. I'm now looking at the answer of "Save Sequence Images with a given timing" and hope it could help.
Thank you
12-07-2015 01:34 AM - edited 12-07-2015 01:37 AM
I had a look at your VI. You use a producer/consumer pattern, which is good. However, I can see several possible problems, and one of them might be the cause of the problem what you see.
So I try to list what I see as problems/design flaws:
12-07-2015 09:26 AM
Another thing to think about is how many Camera Buffers you have. You need enough so that the Camera can fill the "next buffer" while you are trying to access the "last buffer". I've not tried writing multiple PNGs at 50 fps, but I've successfully saved AVIs at 30 fps from 24 cameras more-or-less simultaneously (I saved 10 second short videos when "interesting events" happened, which occurred asynchronously among the 24 stations. It was probably not the case that all 24 "fired" at once, but certainly all cameras were capturing video at 30 fps, and undoubtedly 2-4 video streams were being saved simultaneously).
Bob Schor
12-07-2015 09:36 AM
It will probably be a little faster if you don't display the image. What resolution are your images?
On your acquisition VI you have "Release previous" set to TRUE. If you are queuing up images to be saved, you probably want to set that to false. The biggest one will probably be to move the "begin acquisition" before the loop as suggested before.
Have you streamed this camera at 50fps in LabVIEW before, or is that just a goal?
12-07-2015 12:41 PM
I would say streaming to video file is faster than writing to PNGs. It does not require creating additional file on every step, also quality / size of images should be better. Is there a reason to work with PNGs, not video?
12-07-2015 02:15 PM
So the last two posts raise the question of how fast can one write PNGs. I'd also thought "Why not AVIs", but I didn't know if "information" was lost in going from PNGs to AVIs (like compression losses).
So I did a test. I opened a PNG as a U8, then (in a For loop) wrote 100 new PNGs called Test000 through Test099. Took 1.09 seconds, or about 90 frames/second. So, yes, it should be possible to save PNGs at 50 fps ...
Bob Schor
12-08-2015 09:11 AM
Thank you Blokk,
I have accepted your advices and now I have moved the Release the Queue VI to the outside of the consumer loop, so that I can save every buffered image even after I close the camera. The frame rate now could achieve the highest of the camera and I can save all the images.
But now the problem is I can't find a suitable way to stop the consumer loop (I want the loop to stop by itself after all the buffered images have been saved).
12-08-2015 09:18 AM
Thank you Alexander,
I saved to PNG file is because I want to deal with the images frame by frame. Is it possible to save as video file and then I can extract images from the video without losing any frame and the quality wont be degraded?