LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to optimize my system to run and acquire frames faster

Hello Experts,

 

I have attached a .vi in here and the problem I am looking to the solution to is:

 

I have this .vi which hjas two tab controls in it. 

1. Triggering: In this I am triggering my camera through a PCI 1422 frame grabber and the trigger to frame grabber is done by an FPGA board which is PCI 7833R. In the .vi I have programmed in the style that my camera is initiated and ready to acquire images/frames based on how fast it is getting the trigger. So, as soon as it detects a trigger it saves an image(when I press the grab switch and defines the path). Now, this .vi is getting the trigger from my source which is triggering at a rate of 16kHz and the camera is acquiring too, so everything works fine. 

 

The problem is that my camera is acquiring/showing only approx. 10 frames/ sec right now in this configuration instead it should give me approx. 19 frames/sec as per the camera configuration. So, I believe either my labview code is slow because of while loop or any other reason which I am not sure of as I am still learning.

 or if there is anyher suggestion which any one would like to give?

 

I even tried to move the memory location of configure buffer list from SYSTEM to ONBOARD but it gives me an error saying this is not operational with Extract buffer.vi which is another problem for me to solve here.

 

Things I have done from my side are:

1. The source can't be modified so it can't be slowed down. (option ruled out)

2. I have tried oscilloscope to generate a trigger and see when it starts to loose the frames but it doesn't increase after 19Hz and remains same apporx. 10f/s until 16kHz. 

3. I have tried reducing the I/O like the screen showing the live video of the camera but it didn't effect it much.

 

Please let me know that how can I increase my speed of acquisition of frames for this code?

 

Any answers or suggestion are welcome.

 

P.S If I have missed any information or you have questions. Feel free to shoot me.

 

Thanks in advance

Rahul

0 Kudos
Message 1 of 8
(3,374 Views)

How fast does it go if you disable the code which writes the png file to disk?

0 Kudos
Message 2 of 8
(3,346 Views)

Hello Hornless Rhino,

 

I haven't tried that yet. I will do that and get back to you here asap.

 

Thanks.

0 Kudos
Message 3 of 8
(3,336 Views)

I'm a bit puzzled by your code (I've never used an NI Camera through IMAQ, but I have used Ethernet and USB video cameras through IMAQdx).  There are probably "things you are doing" that I just don't understand, but that's probably do to my lack of experience.  Here are a few comments:

  • With a relatively inexpensive USB Video camera, it is easy to put it in Video mode at 30 fps and capture all of the frames, either as an AVI (so you can easily "play the movie") or as a series of PNGs.
  • To avoid losing frames, you want to configure a Producer/Consumer Design -- the Producer loop sits there getting an Image (which is really a pointer to a Buffer in memory) every 33 msec, puts it in the P/C Queue, and sends it to the Consumer who saves it to disk (either as a PNG or as an AVI frame, whichever you choose).  For this to work, you want to configure enough Image buffers (I don't remember the algorithm we used, but we had 24 Ethernet cameras simultaneously taking videos at 30 fps -- we weren't saving all of them as we only wanted 5-second movies of "significant events", but the cameras were continuously active for 2-3 hours).

Bob Schor

 

P.S. -- I realize I'm not sure we ever saved PNGs at 30 images/second.  I'm not sure of the "overhead" in doing the required File I/O for such images.  I do know we've done some "slow" work looking at transport where PNGs were taken at a few frames/second (or, sometimes, at a few seconds/frame) ...

0 Kudos
Message 4 of 8
(3,329 Views)

Hello Rhino,

 

It's working at the same speed. As the writing part is controlled by case structure so it didn't have any effect if I save files or not. I even tried disabling it and completely removing the writing feature but it's same.

 

-Rahul

0 Kudos
Message 5 of 8
(3,278 Views)

Hello Bob,

 

Yes I am using an InGas camera with IMAQ. Thanks a lot for your comments, however,

 

1. Buying another camera is not feasible for me right now.

2. I roughly knew about this producer/consumer design but I am not sure whether it will have an effect since as per above post from Hornless Rhino, I tried removing that writing file to disk part and saw that it didn't change or improved my acquisition speed. So, therefore I am not sure that whether implementing P/C will work. Plus it would be great if you could suggest anything else or share any link about P/C ideas or algorithms I might be able to use. My program is simple as I have one camera and would like to acquire as fast as possible from it andI would also not save all the PNG's but few of them like you did as you said.

 

And any suggestion would be of a great help. We never know what might hit. 🙂

 

Thanks,

Rahul

0 Kudos
Message 6 of 8
(3,275 Views)

Rahul,

 

     Am I correct that you are using an InGaAs camera?  Which one?  Can it do video?  At what frame rate?

 

     If it can take video, then it should clearly be able to take images at its allowed Frame Rate.  Have you tried running MAX and configuring the Camera for Video, then doing a "Grab" (instead of a Snap)?  Can you get reasonable frame rates?

 

     When you are taking video images, there's a little more setup of the camera to allocate Buffers and allow you to "interact" with them properly.  I'm not 100% certain I fully understand how this works, but my colleague and I got a system running.  I think there are some Examples that discuss allocating buffers and being able to get the Images (really, pointers to the buffers holding the image data) when filled so that they could be sent (via a Queue) to a Consumer that writes them to disk.

 

     Let us know more about the camera, and do the MAX experiment to see how your camera does with video.

 

Bob Schor

0 Kudos
Message 7 of 8
(3,266 Views)

Dear Bob,

 

Yes, I am using an InGaAs camera. It's sensons unlimited SU640-1.7RT-D and yes it has video which I have configured in grab position too. So, it can take a series of images continuosly as a video. Right now I am getting 9.6 f/s but I should get 19 frames/s which is the Frame rate for the camera as per it's manual.

 

I have also run this camera through MAX but the problem is that I did not have exact .icd for this camera so I modified different camera .icd file and got my present camera running. Result of  which I cannot see what is the frame rate at which MAX is acquiring.

 

In addition, I have already configured the buffers as you suggested but it also doesn't make any difference. I have attached the .vi in my first post of this thread. You can have a look what I am doing and whihc might give you a better idea and may be you can suggest accordingly.

 

In MAX, I can only see that camera is running and can save images (snap) or video (grab). 

Still I will try to do some more debugging on my part.

 

Another as per the .vi attached, can you tell me how can I modify it that the images are stored onboard the frame grabber memory rather than the disk. This may fasten it a bit.

 

Please feel free to ask any question.

 

Thanks,

Rahul

0 Kudos
Message 8 of 8
(3,262 Views)