07-22-2009 08:57 AM
Good morning everyone,
I am working with the LabVIEW code posted below. I am taking images through a CCD camera at a high frequency. Therefore, I need this code to be able to keep up with the trigger. I take anywhere from 30 to a few 100 images and acquire them through buffers. The code I have now (which I got from someone else in my lab; I did not write it) saves the images in the for loop in which each is required. This slows down the code considerably. Timing is important to my application. Does anyone know if there is a way to set each buffer aside after they are acquired and then save them to disk AFTER all the images are acquired. I think this will allow the code to keep up with the trigger.
As a side question, I would like to have the code trigger my camera on both the rising and falling edge of the trigger pulse. As you can see from the code, I tried to set this up, but the method I tried doesn't work; each time a new trigger is setup it wipes out the old one. Is there a way to set up 2 triggers?
Thank you very much,
Matt
07-22-2009 10:15 AM
Hi Matt,
You don't need to extract each image to save it as they come in from the camera.
I mean you set up a ring buffer to contain x images, so take advantage of that buffer. The buffer will be filled automatically after you start an acquisition, just check if the number of frames required are taken. If yes stop the acquisition, do whatever you want to do with the images, saving in your case and eventually start a new acquisition.
Attached a screenshot how I did it once.
I build up a ring buffer just like you did, size depend on how much product the operator wanted to see.
Then I started an acquisition, wait for the number of frames, stop the acquisition, analyse the picture and do it all over again endlessly 🙂
If the operator wants to save the image, I saved the whole buffer image by image, see second screen shot.
Hope this helped you further 🙂
07-22-2009 11:04 AM
Thanks for your response. I am unclear on what VIs you are using in the second picture. Would you mind uploading your code or clarifying which VIs you are using on the upper left side just outside the for loop. Also, would you recommend deleting everything from inside my while loop? What VI do I use to retrieve the images after they are all taken?
Thanks again for all your help
-Matt
07-22-2009 01:12 PM
Left from the loop there's an "Array Subset" vi because I didn't use the first two pictures of the ring.
So you can forget about it and wire the ring directly to the "For Loop".
You can see the Ring as an array of images, so basically you don't need any VI to retrieve an image from the ring, just an "Index array" will do.
Wire the output of the "Index array" to an image control.
This is of course if you first fill the ring and then process it.
If you want live images, then you can use the vi you're using to extract an image from the buffer but I understood that you want to acquire images as fast as possible and process them afterwards.
Correct? Yes, then you don't need the "IMAQ Extract Buffer" vi.
And yes, you can remove everything from the loop, just check if the number of frames is reached.
When all frames are acquired, quit the loop and process the ring buffer.
I checked your code again, and observed that you do nothing with the ring buffer
You build it up in the first For loop and delete it at the end of the code but never used it in the loop
I attach a larger view of the acquisition loop, so that you can have a better idea of the whole ring stuff.
I have a shift register for the ring so that all states can access it.
The state "Save all images" loops through the array, to save the images one by one.
I'm sorry I can't post the complete vi, it's way too large and contains lots of sub vi's to analyse the images and handle the I/O toward the process line.