Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Speed of Acquisition for IEEE1394

Hi,
 
I am currently using a Basler A601F Firewire camera and is using NI IMAQ for IEEE1394 Firewire Camera software package to control/program it using C++. I have used MAX to set the acquisition of the camera to be at 60 frames unsigned 8 bit mode at 640x480 and have set the speed to be at 400mb. I have tried to program the camera to acquire using 128 frames using snap mode(done using a for loop). I have not processed any image in the loop, just doing acquisition without any processing.
I have programmed some pop out windows to signify the end of acquisition at the end of loop
 
Example
for( int i =1; i <=128; i++ ){
  imaq1394Snap (Sid,  (void **)ImaqBuffers[0], rectangle);
}
 
  AfxMessageBox("End of imaging");
 
The speed of acquisition using a timer(real watch) from start of acquisition to the end(when Messagebox is displayed) is calculated to be only at 5-6 frames/s ....
 
I have tried to repeat this with using sequence mode using the below code instead
 
 for( int i =1; i <=128; i++ ){

   errChk(imaq1394StartAcquisition (Sid));
   errChk(imaq1394GetBuffer2 (Sid, 2, &bufferNumber, IMG1394_ONOVERWRITE_GET_NEWEST, (void **)&ImaqBuffers[0]));
      errChk(imaq1394StopAcquisition (Sid));

 }
 
There seems to be no improvement
 
Would like to have any suggestion for improvement or if there is some programming error, would like your kind help in debugging the problem
 
Thanks in advance
 
0 Kudos
Message 1 of 9
(4,394 Views)
I recommend that you consider an alternative to snapping in a loop.

My recommendation is to use a sequence. The driver will allocate 128 buffers and acquire all images with minimal latency between each frame. This mode of acquisition ensures that no frames are skipped. With a high level sequence you can start processing the images as soon as all the images are acquired. With a low level sequence you can start processing the images as soon as each image is acquired.

Either sequence should work much better than a snap in a loop and you should be able to average about 60 frames/sec.

Regards

JohannS

0 Kudos
Message 2 of 9
(4,381 Views)
Hi,
 
Actually I am trying something rather tricky.... I would need to image different pattern for each frame... in all there is 128 pattern in one acquisition session.... Pattern changing speed is faster than image acquisition... to do sequence..in parallel acquisition with the pattern changing....... i would need some synchronisation and put in some dummy frames to account for the time taken for change in pattern.... theoretically it would make the speed much lower than doing it sequentially(not the acquisition mode) .... is this correct?
 
 
Frame rate for sequential style of acquisition  = 1/ (1/pattern change speed + 1/ image acquisition speed)
 
 
Frame rate for parallel style of acqusition is dependent on the bottleneck(the camera in this case) and we would need to probably throw in some frames for synchronisation for example 2 frames to get one image... it would reduce the speed by half......
 
 
Or for sequence mode.... is it possible for us to do some pattern changing in between frames and still keep synchronisation? From what I know in sequence mode... imaging is continuously ongoing..... this would create some trouble for synchronisation i think... would it be correct?
 
Thanks for your help!

Message Edited by Water on 09-20-2005 10:28 PM

0 Kudos
Message 3 of 9
(4,376 Views)

I also have a similar problem, if I use sequence for capture images, it will show "insufficient resourses for this process"  when I capture a large number of image.

So, what can I do if I want to capture 100 fps, and want to save each images into jpg / bmp  file ?

 

Thanks !

Metron

0 Kudos
Message 4 of 9
(4,372 Views)
My first response is for Water.

I do not completely understand your application, but here is what I gather:
You have something going really fast (faster than 60fps) with unique patterns on it. For this example I will assume there is 4 patterns that are continuously cycling.

A B C D A B C D A B C D ....      (this is the sequence of patterns you are imaging)

If you were to acquire at max frame rate, you would get something like

A  C D A B D A ...    (you would not be able to acquire each pattern since pattern is changing faster than camera acquisition).

You can do a couple of things to speed up your acquisition
1) Acquire images faster. This can be done by getting a faster camera like the DragonFly Express that can acquire 640 x 480 fps at 200 fps.
2) Acquire less data. Another way to increase your acquisition rate is to reduce the region of interest. Instead of acquiring 640 x 480, attempt to acquire 320 x 240. In many cameras that will result in a 3-4 frame rate increase. You will need a camera with full partial scan support (like a Basler A602f or DragonFly Express) to get frame rates above 200 fps with reduced region of interest.
3) Do not acquire every image. In our example you would acquire every 5th pattern. For example

A B C D A B C D A B C D A B C D ... (this is the sequence of changing patterns)
A ----------- B ----------- C-----------D      (this is the sequence of patterns that you acquire)

In order to do this you have to triggger the firewire camera every 5th change in pattern. If the frame rate is fixed you can use a timer to trigger the camera. You could also use a proximity sensor or a quad encoder to count the number of times the pattern change before triggering the camera for the next frame. Something like the NI PCI-8254R or a simlpe counter timer bourd would be very useful for conditioning the input signal to externally trigger the camera.

Hope this information helps

Johann



Message 5 of 9
(4,362 Views)

Hi,

Thanks for your answer, Johann!

I think for your answer 1) and 2) might be out for me... as it involve spending more monies

I am particular interested in trying out option 3)... Just wonder what do you think if I program my application in this manner

1) Setup a low level sequence mode of acquisition with a buffer of 256 fames or more

2) After every frame is imaged, it will call a callback.. Then I will check for current frame number... if it is odd, I will initialise a pattern change... while it is even, I will save the frame collected... in short I will be imaging at every 2 frame...

Would this be feasible? BTW, how do I check for current frame number... would frame number be constantly incrementing?

Thanks for your help once again!

0 Kudos
Message 6 of 9
(4,359 Views)
My second response is to Metron.

The "insufficient resources" error arises when:
1) you have too many cameras sharing the firewire bus. For fast applications limit the number of cameras per firewire interface card. Ideally you want to use a single camera per card with no more than 2 PCI firewire cards in a system.
2) you run out of physical memory. While rare, this can happen with large images and many buffers. Try adding more memory.

Hope this helps.

Johann

0 Kudos
Message 7 of 9
(4,352 Views)

Dear Johann,

 

I have only one camera in one PC. So that the total number of images can be captured is related to physical memory, instead of the virtual memory of the PC ?

Then there has a limitation for the total number of image taking by the function "sequence", because there has a limitation in the physical memory of each PC ?

 

Moreover, is there has another method can capture and save a large number of image instead of using function "sequence" and the speed can as fast as "sequence", because I need to capture and save image at around 100 fps.

 

Thanks !

 

Regards,

Metron

0 Kudos
Message 8 of 9
(4,336 Views)
Water -

You can find the last acquired buffer number by using the imaq1394GetAttribute function.  The IMG1394_ATTR_LAST_TRANSFERRED_BUFFER_NUM attribute (called "Buffer Number" in the CVI function panel) will return the sequential buffer last acquired.
David Staab, CLA
Staff Systems Engineer
National Instruments
0 Kudos
Message 9 of 9
(4,320 Views)