LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Optimize Camera Speed (fps)

Solved!
Go to solution

Good afternoon,

 

So, I am relatively new to Labview. I have a code to take images and save it to a specific folder. The camera operates at 60 Hz but when I use this Labview program it operates at about 7 fps. I've tried lowering the amount of programs in the while loop and made most settings establish prior to it running, however, it's only improved to the 7 fps. The program does not have to do any processing (yet), simply take and store the images as fast as possible. 

If its necessary to have the images saving in a binary file to make the program reach closer to 60 fps, that may work. I've developed multiple versions of this code to run Binary and AVI but would greatly like to optimize this version specifically to simplify later processing. 

Thank you for your time and consideration into helping solve this!

Sorry I cannot post the Zip yet, the work is in progress within the lab I work for.

 

- Isaac

0 Kudos
Message 1 of 24
(4,574 Views)

How many images are you going to take?

What the image size/type?

Save to jpg might be faster.

Are you using a SSD hard drive?

 

George Zou
0 Kudos
Message 2 of 24
(4,564 Views)

I am finding that the camera im using actually caps at 35 fps, which I can purchase a new one later. The program is still only operating at 7 fps though, if I can get it to 35, then we can purchase a new camera. The goal though: I'm wanting to be able to capture up to 60 frames per second and allow the program to run for 20 seconds as a time max, 4 seconds minimum. 

Later Id like to develop a buffer to run the program for up to 5 minutes and take pictures as a sensor gets triggered. 
 
The JPGs saving right now are 3.25 MB, 2448x2048 Pixels, 8 bit depth. I am using the Basler ace acA2440-35um.
 
Currently the images are saving onto the Local Fixed computer drive.
 
Thank you for looking into this!
0 Kudos
Message 3 of 24
(4,532 Views)

If you are taking finite number of images, with a large buffer, you can separate acquisition loop and the saving loop.

If your OS is 64bit, try LabVIEW 64 bit, so that you can take advantage of RAM > 4GB.

Stream to disk:

http://www.ni.com/example/14173/en/

 

George Zou
0 Kudos
Message 4 of 24
(4,527 Views)

Do the camera create the jpg or are you sending raw data to the computer and compress it there? The raw data is 15Mb/image, so how is it connected? USB? 2 or 3?

I assume 30 fps is in film-mode, which probably is a lower resolution, not 'quick pictures'. Can you ask the camera to film and transfer the movie instead?

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 24
(4,475 Views)

I do hope you are using a Producer/Consumer loop, which lets the Queue "buffer" some of the images.  You are generating 3.25 MB/s, and USB 3 speed is around 640 MB/sec, so you should have a little wiggle room in getting the images into the Camera.  Did you notice that 2448 * 2048 is around 5 MB, so if you are taking 1 frame/sec and saving it "as is", your images would be about 40% larger than you report?

 

This is probably because you are saving in JPEG format, which uses lossy compression to shrink the image.  Compression takes time, which probably explains the low frame rate.  It also indicates (to me) that you are not using Producer/Consumer, but are doing all of your processing in a single loop.  Unfortunately, you did not attach your VI (don't bother attaching a picture of the Block Diagram, as this provides only frustration for people such as I who like to examine, modify, and test code), so I can't be certain how to help you.

 

Bob Schor

0 Kudos
Message 6 of 24
(4,456 Views)

You are correct, as aforementioned, I am relatively new to LabView and am unaware of the producer/consumer loop you're talking about so I'm not using one. I apologize, I did not provide the ZIP earlier due to later functions in the code, however I didn't even think of separating the code. Attached is the code that is separated from the later programs to help you better to help me. (This code is where the start>take image>save image takes place).

 

I am also using LabView 64 bit, 2018.

 

I was initially trying to start camera>take images>save to folder. To alleviate the compression and hopefully speed up the frame rate, what would you recommend?

 

Thank you for taking the time to review and help with this issue. 

 

-Isaac 

0 Kudos
Message 7 of 24
(4,442 Views)

The camera (I believe) is taking raw data into the computer and the program is currently turning them into .png files. The camera is connected by USB3. I started trying to make a AVI version of the function to save a movie instead but that did not turn out very well. Attached is the code I am using.

 

Thank you for taking the time to help.

0 Kudos
Message 8 of 24
(4,437 Views)

Here's a link describing the Producer/Consumer architecture Bob Schor mentioned. 

 

It's a typical choice when you want to separate "fast" processes (or at least processes you want to be fast) like acquisition from slow processes like saving to disk or intensive post processing. 


GCentral
0 Kudos
Message 9 of 24
(4,425 Views)

Thank you, I will begin looking into it and try applying it to this code 🙂

0 Kudos
Message 10 of 24
(4,422 Views)