06-01-2025 09:00 PM
Hi everyone!
So I've been trying to save some camera data to AVI. The end goal here is to run the program, wait until the camera starts up, then hit the record button and start saving the video file to the chosen folder. I was a bit concerned that the VI was missing some frames while saving, so I put a overlay of the system time to the image, to see if there were any frames missing. While checking with a Logitech C920 webcam at 30 fps , it was working fine. However, while trying with a machine vision camera, which is my end goal, there seems to be a lot of frames missing in between. I used a LucidVision TRI050S-CC, Sony IMX264, 5.0MP, Color Camera acquired at 20 fps. I have attached the code below, also there are 2 subVI's , one to get the date/time stamp for file naming and the other to overlay the timestamp on the image. There's also a small case structure which creates a text file which contains a message to indicate that the file saving is completed. Any help would be appreciated! Thanks in advance.
06-02-2025 06:45 AM
You need to look into a producer consumer architecture. Have one loop that provides the data and one that processes the data. There are examples that you can go look at.
06-02-2025 07:21 AM
I had a producer-consumer style architecture which I had gotten from this forum. And it works perfectly fine for web cameras, but for machine vision cameras the AVI file is saved plays faster than usual. Which is why i switched to the current VI, which saves at the appropriate speed, but drops a few frames. I have attached the Producer-Consumer architecture VI below.
06-02-2025 07:42 AM
The c920 takes 800 x 600 pixels at 30 fps, so data comes in at 800 x 600 x 30 x 4 = 57.6 MB/s. What is the image size for your camera?
I recommend that you do not attempt to overlay text with images, especially if you are not simultaneously acquiring and processing+saving the images (using a Consumer/Producer design). Do you know about "buffers", and the importance of setting up multiple buffers for doing continuous video acquisition and processing?
Bob Schor
06-02-2025 07:59 AM
@Bob_Schor wrote:
The c920 takes 800 x 600 pixels at 30 fps, so data comes in at 800 x 600 x 30 x 4 = 57.6 MB/s. What is the image size for your camera?
I recommend that you do not attempt to overlay text with images, especially if you are not simultaneously acquiring and processing+saving the images (using a Consumer/Producer design). Do you know about "buffers", and the importance of setting up multiple buffers for doing continuous video acquisition and processing?
Bob Schor
As Bob mentions, the Image is a reference to a buffer. Create 2-3 of them and rotate which you use to take a picture. I had a similar problem in an old project and the issue was that i only used 1 reference and it got overwritten with a new picture before i could save it.