From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Grabbing images from two cameras in VBAI synchronously

My setup consists of VBAI 2015 and two Basler Racer Line Scan cameras. Originally, I had one camera in the setup which was working just fine on the VBAI side of things. The cycle between each image taken was roughly around 12-16 seconds depending on the material. I have an encoder triggering the line start trigger to grab the number of lines for a frame. The amount of lines the camera was grabbing for a frame always exceeded the specified height (the number of lines in one frame) with the one camera so there was always a second frame not filled to the height. So, what the camera does is holds on to that second image till enough lines are taken to fill the rest of the frame. This will get your second image. We didn’t want that, we wanted to start a new blank frame for the next image. So, we made it where the camera would timeout between cycles which then caused the excess lines to be erased. If we were to fill in the half empty frame, the image would not be consistent. You could tell where the first section of the frame ended and where the next began since the material scanned didn’t line up. This would throw off our measurements in VBAI so we decided to start a new frame instead.

 

After installing the second camera and copying all the settings to the hardware, I used the same VBAI file and just add a new state for the second camera with the same Read/Write Attributes Step as the first camera. But now instead of starting a new frame after the timeout, the partial image leftover stays and messes up the next image causing the VBAI to get bad readings. Is acquiring images from two cameras in one VBAI causing problems with getting the images from both? If not, is there a sure-fire way to make it where the camera always starts a fresh frame on each grab such as being able to delete the second unfilled frame?

 

Any advice will be helpful. Thanks!

P.S. Sorry for long explanation.

0 Kudos
Message 1 of 5
(2,393 Views)

You should try using a frame trigger in addition to the line trigger from the encoder. The frame trigger could come from SW or HW. Most cameras supports a SW trigger as the source and you can have a Read/Write Camera attribute step before your Acq step that sends the SW trigger.

 

You could also use the Snap Acq mode instead of immediate or every image. This will start a new acquisition every time the step runs and then unconfigure the acquisition after acquiring 1 image, but this will be much slower, but it sounds like you don't have a very fast cycle time, so this may work for your use case.

 

Hope this helps,

Brad

0 Kudos
Message 2 of 5
(2,363 Views)

Currently I have a HW signal coming from a machine which triggers the acquisition start trigger. The frame trigger is turned off so that it becomes valid when the acquisition start trigger receives a signal. Then the encoder triggers the line trigger to start grabbing lines when the material moves. I have been using Wait for Next Image mode and it was doing the trick when there was only one camera involved in the inspection. I attempted to use the Snap Acq mode but was not getting any image from the camera. Does Snap Acq mode work only when frame trigger is on? 

0 Kudos
Message 3 of 5
(2,357 Views)

Snap works in any mode, but you need to realize it starts from scratch when the step is called so any triggers required to acquire the image have to happen while the Acq step is executing and not before or else those triggers are ignored since everything is setup only when the step executes. So the Snap mode may not work for your needs.

 

Do you have a trigger that pulses every time you need to take an image? If so, use this as the Frame Trigger (and not the start trigger). If not, use a SW trigger for the Frame Trigger and call Read/Write Camera Attribute to send the SW trigger before the Acq step executes.

 

Hope this helps,

Brad 

Message 4 of 5
(2,353 Views)

I was able to get it to work. The problem was I had disabled the step that stopped the "waiting to acquire image".  Since it was continuously trying to grab a frame instead of telling it when to stop, it kept the lines left over and continued the next frame with those instead of starting over. I believe that is how it works. 

 

Yes, the pulse from the machine triggers the camera to enter the "waiting for Line Start Trigger" acquisition status. So from what you said the Start Trigger is just an extra, unnecessary step for the Frame Trigger? It makes sense since the Start Trigger is there to just turn on the Frame Trigger. If I turn the Start Trigger off and have the Frame Trigger on with the same pulse being used to trigger it, I should get the same results right?

 

 

0 Kudos
Message 5 of 5
(2,349 Views)