LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Slow Image Acquisition Speed ThorLabs KiraLux Camera

Hi, 

 

Hope yall are doing well. I am currently working with an XY and Z stage to raster scan and, next autofocus at each position. Currently, our problem is that the image acquisition speed is to slow. Theoretically with the ThorLabs Camera, I should be able to take pictures much quicker at each position. I was wondering if someone could help me tweak my vi so that the camera can image quicker at each position so the raster scan is faster. I am not sure what is slowing it down, does any know how to accelerate this? 

 

Currently it takes about 5 minutes to raster scan a 100 images in 10mm X10mm. Need it to be faster. 

 

I have attached an image and my .vi. Please let me know if yall need anything else. Thank you!!Camera_VI.PNG

0 Kudos
Message 1 of 10
(2,457 Views)

Right now you have 3 things running in series, and it can't get a new frame until all 3 are done:

* Acquire image

* Process image into RGB color

* Save image to disk

 

You need to set those to run in parallel.  I would recommend setting up 2 separate While loops that run in parallel with your event structure, one for image processing and one for saving the images to disk.  When you get the raw image data (the 3D array) from the instrument drivers, just enqueue it as an element and have the first parallel loop dequeue it and process it into a TIFF, then enqueue that again into the 2nd while loop, where it dequeues to do the disk saving.

 

Also, I am pretty sure you could speed up your processing.  Right now you run two nested FOR loops and each one is constantly building arrays with the auto-indexer output terminals.  Resizing arrays can be a very time-intensive thing to do repeatedly, so what you probably want to do is create the final array at the start, then pass it into the FOR loops as a shift register, and then just use the "Replace" array function to insert each pixel, or use the "In place element structure" to be totally sure it's not doing unnecessary memory allocations.

Message 2 of 10
(2,440 Views)

Hi Kyle, 

 

Thank you so much for the outline on how to fix this. I will work on implementing this architecture this week and follow up. This is immensely helpful. 

0 Kudos
Message 3 of 10
(2,399 Views)

@Bobdog20 wrote:

Hi Kyle, 

 

Thank you so much for the outline on how to fix this. I will work on implementing this architecture this week and follow up. This is immensely helpful. 


And clean up the block diagram.  True story:

 

A colleague of mine spent a few days trying to find a bug, and the bug was that he had wires running behind his subVI that he thought were connected, but they weren't.  (The other glaring issue besides sloppy block diagram was that he didn't set the connector pane terminal to "required" so he had no idea that critical wire wasn't connected.)

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 10
(2,393 Views)

Hi, 

 

I am having a tough time getting started since I adopted this code from ThorLabs. Is there any way you could highlight what components of the image you would consider running in parallel? 

 

Thanks. 

0 Kudos
Message 5 of 10
(2,379 Views)

Kyle97330_0-1632859924800.png

I would move the red-circled area into one parallel loop and the green-circled part into another loop.  I'm not totally sure you'll want to move the VI that makes the Z scan live view there, but definitely the rest.

 

You'll want to use a queue to do this (2 of them, actually).  There's a few "how to use a queue in LabVIEW" videos and pages if you're unfamiliar with how to do that and need a starting point.

0 Kudos
Message 6 of 10
(2,372 Views)

Thanks for the reply. My understanding is that there will be will 3 loops. 

 

Loop 1.) Z-scan to acquire the image. (outside of green and red circle)

Loop 2.) Process the image to RGB (red circle) 

Loop 3.) Save image to disk (green circle).

 

There will be 2 queues, one queue between loop 1 and 2, and another queue between loop 2 and 3? 

0 Kudos
Message 7 of 10
(2,364 Views)

Yes that's what I am recommending.  Give it a shot and see what happens.  

0 Kudos
Message 8 of 10
(2,359 Views)

So far this works, not as fast as we'd like it but its significantly better (might be a computer issue). Might be following up with more questions. Thanks a lot for your help, I really appreciate it.

0 Kudos
Message 9 of 10
(2,335 Views)

Hi Bobdog20,

Would you mind sharing your VI, as I'm having the same issue with the Kiralux cameras in LV, and I'm trying to put the get image and process image components into separate loops.

 

Much appreciated if you can,

Browntown

0 Kudos
Message 10 of 10
(2,158 Views)