05-19-2021 01:39 PM
Hello,
It has been some time since my initial internship but I am re-vamping this project. There were some issues left unresolved and I see that there is also still interest in this project by some other LV community members. Here is the original thread link: https://forums.ni.com/t5/LabVIEW/How-to-Optimize-Camera-Speed-fps/m-p/4052322#M1162346
Goal 1:
Currently, the code has an issue with the Queue wiring (see attached VI for current code) and this is one problem. I have a more complex version that in theory analyses the images but is not attached due to other reasons and I cant currently share that VI. For this, I only wish to capture and save images as fast as possible, and to save all of the images being captured.
The producer loop should generate the images and send them to the consumer loop. The consumer loop is meant to only save the images into a file that is predetermined. Each file gets re-created based one the "experiment number", which is really just each time it's ran for now.
The images are still saving at "lower" speeds around 35 fps, when the camera is able to operate much much faster at default settings.
To combat this, we created a queue function to try to save images even after the camera runs. Which worked for a moment but had issues with saving the same image over and over again. Now, there is an issue of queue wiring that I can't seem to find the problem with. Note: Goal is to run at 196 fps (or as close to as possible). One idea is to reduce the resolution slightly, but how to do this in LabVIEW but still be able to see 10um objects?
Any advice on optimizing the code and allowing the program to save all of the captured images without saving one image continuously, would help a lot!
Goal 2: is to have the original images be sent to a consumer loop that analyzes each image. My current set up to do this sends a duplicate image to the consumer loop. In my code, both "IMAQ Copy VI" and "IMAQ Write File 2 VI" have a duplicate image output that could work for this. The question is, which one may be better to use to improve the processing speed of the program?
I am using a more advanced computer and camera version than previously discussed, so optimization should (in theory) be a bit easier on computer processing capabilities. I also now have an actual PC interface card from Basler to help with this.
Thank you for any help on this, I look forward to seeing what you all think! This is also mentioned in the orginal thread (see link above) but I decided to make a new thread since it has been awhile.
Thank you!
-James
05-19-2021 01:01 PM - edited 05-19-2021 01:03 PM
Hello,
It has been some time since my initial internship but I am re-vamping this project. There were some issues left unresolved and I see that there is also still interest in this project by some other LV community members.
Currently, the code has an issue with the Queue wiring (see attached VI for current code). I have a more complex version that in theory analyses the images (previous goal) but is not attached due to other reasons and I cant currently share that VI.
The producer loop should generate the images and send them to the consumer loop. The consumer loop is meant to only save the images into a file that is predetermined. Each file gets re-created based one the "experiment number", which is really just each time it's ran for now.
The are still saving at "lower" speeds around 35 fps, when the camera is able to operate much much faster at default settings.
To combat this, we created a queue function to try to save images even after the camera runs. Which worked for a moment but had issues with saving the same image over and over again. Now, there is an issue of queue wiring that I can't seem to find the problem with. Note: Goal is to run at 196 fps (or as close to as possible).
Any advice on optimizing the code and allowing the program to save all of the captured images without saving one image continuously, would help a lot!
This summarizes goal 1.
Goal 2 is to have the original images be sent to a consumer loop that analyzes each image. My current set up to do this sends a duplicate image to the consumer loop. "IMAQ Copy VI" and "IMAQ Write File 2 VI" both have a duplicate image output that could work for this. The question is, which one may be better to use to improve the processing speed of the program?
I am using a more advanced computer and camera version than previously discussed, so optimization should (in theory) be a bit easier on computer processing capabilities.
Thank you for any help on this, I look forward to seeing what you all think! I may have to make this a separate thread though...
05-19-2021 03:21 PM
I'm not very familiar with most IMAQ stuff, so here are some more general comments:
-Kevin P
05-20-2021 12:07 PM
Good morning Kevin,
Thank you for your reply and general help solutions!
Changes:
I was unsure how to fix the greedy loop you mentioned. I really liked the cartoon styled link you provided with it. What does an error in do??
Now, I need to test how this affects speed. (I'll post an updated average fps and image save data when I run it a few times)
I'm 100% open to any more advices/advances. Thank you!
05-20-2021 02:46 PM
Kevin's advice actually helped quite a bit for the queue. Currently, I am looking at speed but need to do an extra test to see if the same image is being constantly copied again.
Fps data update:
So the code is simplified a bit but still running "slow". The camera is capable of running at 136 fps at default settings; 2464 x 512 resolution.
Questions from this:
Thank you!
05-20-2021 03:29 PM
This is how to do it with the Measurement & Automation Explorer. https://www.youtube.com/watch?v=oTWHhMENsCg
However, is it possible to set a program on the interface so the user can more accessibly adjust the resolution?
05-22-2021 03:26 PM
To the tune of "Anything You Can Do, I Can Do Better" (thanks to Irving Berlin):
Anything MAX can do, you can do also. Though MAX is easier, you can do it, too.
To which you reply -- "No, I can't", and I say "Yes, you can", and it goes on for a while.
Look at how you set things in MAX. You are basically setting Properties for the Camera to set its FPS and other parameters. There's a way to do exactly the same thing with IMAQdx, but it is a bit complex, sufficiently so that I can't recall the process (though I did some IMAQdx work a few years ago). But a hint will come from the names that MAX gives to the Properties (for example, looking at the integrated Web Cam on my Laptop, I see an Acquisition Mode that includes an FPS specification).
Bob Schor