Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

acquiring images from multiple loops

I currently have two cameras, one 16-bit and one RGB, simultaneously acquiring data and then being processed in one large loop.  This works well for most applications but the problem is when I lengthen the exsposure time of one camera the other one is affected and vice-versa.  What I would like to do is have each camera running in its own loop and then sending its information to a third loop that does all the processing.  This way each camera can run as fast as they want without being interfered by the other.  The issue I've had in the past, one aspect of the processing, is the merging of the two images having the two loops running at different speeds makes sending the data to this part very unstable and it crashes alot.  I was wondering if anyone had any suggestions about how to properly buffer the cameras so that they could run at two independent speeds while being processed at another.
0 Kudos
Message 1 of 4
(3,412 Views)
You don't necessarily have to use separate loops for each camera and the analysis.  You just have to remove the coupling between the acquisition and the analysis.
 
I would set up each camera with a continuous buffer loop.  This is just like a sequence, but you use continuous acquisition instead of one shot.  You can monitor the number of unprocessed frames in each loop.  I would setup the loop with a very short delay.  Each time through the loop, check if there are any new frames in either buffer and process any new images.  Unless your processing takes too long, you shouldn't have any problems.
 
Bruce
Bruce Ammons
Ammons Engineering
0 Kudos
Message 2 of 4
(3,402 Views)
I'm a little confused by how you get the new image from each camera into processing.  Do you know of any examples that could help me out.
0 Kudos
Message 3 of 4
(3,394 Views)

Sorry, I don't have any examples.  Perhaps another explanation will help:

In your outer loop, check the last valid buffer number for each camera, and compare it to the number of the last buffer processed.  The difference is used for N of a for loop.  Inside the loop, process the N new images for that camera.  You will have two inner loops that are parallel inside the larger outer loop.  I would put a delay inside the outer loop of about 25 msec for the times that there are no new frames from either camera.

To answer your question, acquire buffer X inside the for loop and process it.  For example, if the last valid buffer is 25 and the last buffer you processed was 23, you would loop 2 times (25-23).  The first time through the loop, you would retrieve and process buffer 24.  On the second time through the loop, you would use buffer 25.  This is the value that goes into a shift register on the outer loop for the next iteration.

Bruce

Message Edited by Bruce Ammons on 11-02-2005 02:05 PM

Bruce Ammons
Ammons Engineering
0 Kudos
Message 4 of 4
(3,388 Views)