Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Camera acquisition slower than trigger using LabView/IMAQdx, works fine with FlyCap2

Hello,

 

Help is much appreciated. I am trying to operate a FLIR Grasshopper3 USB camera (GS3-U3-23S6M) using LabView and it seems to max out at acquiring images at 20 Hz. However, I will need this camera to work at 40-50 Hz regularly. I think it is not a problem with the camera (which has a max FPS of 163) or cables because I can operate the camera with the FlyCap2 software at 163 FPS with the trigger disabled, and at 40 FPS with the trigger enabled (note, I am supplying a 40 Hz trigger signal with a pulse generator). But once I swap drivers and try to operate the camera with LabView, it can't seem to acquire any faster than 20 Hz. I can slow down the trigger to below 20 Hz and then LabView/the camera can keep up. Any thoughts on what the source of this issue may be? I am rather new to LabView, so I'm sure it is something in my code that is slowing the whole process down. I have attached the code to view. 

 

Sorry if this is not the right forum location for this question. I'm new to NI forums. 

 

Thank you!

0 Kudos
Message 1 of 7
(1,703 Views)

You do a lot of thinks in the while loop. Try this please. You can also play with image formats. I have changed to png. If programm is still to slow, disable saving and try again.

0 Kudos
Message 2 of 7
(1,667 Views)

Hi, unfortunately I can't open your file because it is in a newer version of LabView than I have. Could you save it to the 2017 version and send again please?

0 Kudos
Message 3 of 7
(1,655 Views)

Sorry, I did'nt have access to an LV PC during last days. Please try this.

0 Kudos
Message 4 of 7
(1,633 Views)

Thank you, your code has helped a lot, but I have one issue/question. The 'buffer number out' seems to match the rate of my triggers (i.e., if my external trigger is 40 Hz, I'll get ~40 buffers out per second). However, when I stop the program from running and check the folder where the images are being stored, there are fewer images saved than the buffer number out (by a lot, for example, buffer number out was 184 but only 43 png images were saved). Do you have any thoughts on why that is? I inserted my time measurement flat sequence again and it still seems to be taking >100 ms to grab and save each image...

I can also seem to only run the program once and upon trying to run it a second time I get a time out error (Error -1074360293). Is there a way to fix that?

Thank you for your time! 

0 Kudos
Message 5 of 7
(1,608 Views)

Hello, posting again because my reply was removed for some reason. Thank you for your code, it was very helpful. However, I still seem to have the same issue. With your code, the 'buffer number out' seems to match the rate of the trigger, but it doesn't save the same number of images as the buffer number out -- in fact, significantly less, still at ~10 Hz or so. Wondering if you have any other ideas? 

I have tried removing the saving functionality and then it does grab the images at the expected rate. But that's not helpful -- I need to be able to save the images for data analysis. 

 

Also, I seem to only be able to run the code once and when I try to run it a second time I get a timeout error (-1074360293). Is there any way to fix this?

 

Thank you again. 

0 Kudos
Message 6 of 7
(1,604 Views)

It sounds what you hardware is too slow to store the images. Test your hard disk write rate.
Try using an SSD or several HDDs in RAID0 configuration. Maybe the producer-consumer pattern will help You.

0 Kudos
Message 7 of 7
(1,587 Views)