Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

How to acquire faster in Vision Builder and LabVIEW 2010?

Hello,

 

I created simple vbai in VB 2010. It only acquires an image from NI 1742 Smart Camera. When I run it in loop, I get only about 6 fps. When I configure the step and start to acquire continuous images I easily get max frame rate 60 fps. How can this speed be achieved in actual vbai?

Same low speed problem is in LV when I try to acquire images fast. I get same 6 fps. See attachment about the LC code.

 

The main purpose is achieve at least 20 fps from NI 1742 in LV. Any ideas are appreciated!

 

BR,

Jick

0 Kudos
Message 1 of 12
(2,884 Views)

Hello Jick,

 

It wasn't clear to me under what conditions you acquire 60fps. Is this only when you acquire when editing the step? Are you triggering your acquisition? One reason you may see slow acquisition from the smart camera when viewing the images on your PC is if you have a slow network connection (i.e. 10Mb or 100Mb) instead of GigE speeds. Make sure you have set the step for immediate mode to acquire at the fastest possible rates. If you look at the bottom of the step when running, it will show you the frame index which should increase by more than 1 each iteration when you set the acquisition mode to immediate. This will give you a sense of how fast the camera is actually acquiring (See image1.jpg for what I'm talking about).

 

You can also change your LV code to look like image2.jpg to see how fast the inspection runs on the target without viewing the images on your PC. The inspection will run slower in Configuration mode than inspection mode, so you may also want to try running the inspection in Inspection Mode. Another idea that can help performance is to use a Custom UI with the Update Inspection UI step and then you can view the inspection running from a web page, which polls the target and may not get every image, but you can put indicators on the custom UII to see how fast the actual inspection is running on the target and even if you do have a slow network connection, this shouldn't slow down the execution on the target as much as running it configuration mode, which waits for each image to finish transferring before the next iteration starts. Inspection mode should also not slow down performance on the target and will just get images when it can, but I wanted to give you other options to try.

 

Hope this helps,

Brad 

0 Kudos
Message 2 of 12
(2,860 Views)

Hello Brad,

 

The slow speed problem in VB was that I ran my inspection in loop instead of running state in loop. When I run state in loop I get desired fps (at least close to 60 fps). There is only one step in VB which is Acquire Image. It is not triggered acquisition and it is immediate.

 

But, In LV, when I configure same vbai (see attachment) and start inspection before loop it acquires images very slowly. Which is something like 10 frames per minute. Is there something wrong in my configuration? How to switch between inspection mode and configuration mode? In addition Iteration/s and Num Iterations shows 0 all the time. I also added Loop Iteration Indicator in the while loop. It shows that every third iteration is very slow (I can see values 0...3...6...9... long time, at least few seconds)

With run inspection once.vi I get mentioned 6 fps in LV.

 

BR,

Jick

0 Kudos
Message 3 of 12
(2,821 Views)

In addition, when I Swtch to Inspection Interface in VB and Start Inspection it is as slow as in LV configured like in my previos attachment. And when I switch back to configuration interface and run state in loop, it is very fast again. This speed should somehow be transferred to LV.

 

Jick

0 Kudos
Message 4 of 12
(2,815 Views)
Highlighted

It could be that when you're running at full speed and only have an acquire step, the smart camera is so busy acquiring, it doesn't have much time to send images/results across network, especially if you have a slower network connection. Do you have a GigE network card you can directly connect the smart camera to so you can avoid routers/switches that may have MB speeds instead of GigE speeds? You can also try adding a 10-100ms delay step to your inspection to see if this helps improve update rates.

 

As mentioned in the screenshot of my previous email, for the statistics to update correctly, you will need an Update Inspection Status step (located on the last tab in VBAI). I'd be interested to hear how adding the Update Inspection Status and the Delay (start with 100ms and go down to 10ms) affect the VI you included earlier that just report on the statistics of the inspection, but don't transfer images. I think you have a combination of trying to send images too quickly (since you're not doing any processing), and having a slower network connection. Adding the delay will help give the Smart Camera some free time to send results/images back to your host machine, but you shouldn't need this when you actually add some of your processing steps.

 

Sorry this hasn't been easier, but let me know how these suggestions work for you.

Thanks,

Brad

Message 5 of 12
(2,801 Views)

I don't have a GigE network card. The Smart Camera is connected directly to the motherboard's ethernet connector.

 

I added Update Inspection, Set Inspection Status and Delay steps. I got it running faster than before. Here is what I got with VI I included earlier (without transferring images):

 

100ms delay: about 7.4 Iteration/s
90ms: 8.0 Iterations/s
80ms: 8.8 Iterations/s
70ms: 9.5 Iterations/s
60ms: 10.8 Iterations/s
50ms: 11.9 Iterations/s
40ms: 13.7 Iterations/s
30ms: 15.7 Iterations/s
20ms: 18.3 Iterations/s
10ms: 21.5 Iterations/s
without delay: 29.0 Iterations/s

 

I try to play with different kind of combinations of steps and delay. The best fps with images transferred is about 10 fps so far.

 

If you have more ideas I'd like to here them.

 

BR,

Jick

0 Kudos
Message 6 of 12
(2,758 Views)

Here is a simple VBAI 2010 inspection for the smart camera. You can copy this inspection to the smart camera by

- copy the attachment to your desktop

- launch VBAI and connect to smart camera and go to Configuration Mode using a new inspection.

- go to menu option Target>>Add/Retrieve Inspections.. and browse to your desktop and copy the inspection to the target.

- for the Custom UI to work, go to menu option Target>>Target Options>>Web Server and enable the web server and add * to the Browser Access List (so any computer can view the custom UI running on the target. Press OK in dialog.

- Now go to Inspection Mode (Ctrl-I), and start the inspection running. You can see what the frame rate and number of image index of the camera displayed. Close Inspection mode, and you will have the option to keep the inspection running. Select to close and keep inspection running.

- Now open a web browser and type in http://<IP Address of Target> and it should display the custom UI running on the target. You should even see faster frame rate here than when viewed from the inspection interface of VBAI.

 

If you need to see images, I would strongly recommend getting a GigE connection. I had a similar problem with 100Mb connection and was seeing about 1-2 images per second and when I upgraded to GigE card, I got ~15 fps including the inspection running all my algorithm code.

 

Hope this helps,

Brad

0 Kudos
Message 7 of 12
(2,748 Views)

Ok, I'll try that when you send the attachment Smiley Happy

 

BR,

Jick

0 Kudos
Message 8 of 12
(2,737 Views)

Sorry about that...meant to include this earlier.

0 Kudos
Message 9 of 12
(2,729 Views)

Actually, I made a minor change (removed the Display flag at the end of the state). So this one should be a little more optimized:

0 Kudos
Message 10 of 12
(2,727 Views)