Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Build an AVI file with exact and high frame rate (100 fps) by using Basler A602fc, IMAQ1394

Hi,
 
I am using LabView 7.1, IMAQ1394 2.0.2, Basler A602fc and a signal generator (GW GAG-809).
According to the specification from Basler, A602fc could support up to 100fps with full resolution. 
What I want to do is making a short (10-15 sec, certainly more is better) AVI file with 100 fps, color and 640x480.
 
By modifying an example from <NI example>/Hardware Input and Output/IMAQ1394/High-level/Grab and selectable format.vi, I could make an 640x480 AVI movie. However, the frame rate and color were just AROUND 100 fps and mono(8-bit) only.
I known that the frame rate depend on 1) shutter value, 2) the height of the area of interest (AOI) and 3) Bytes per packet.
For my case, as the max bytes per packet is 4096 (Am i right?), I could only adjust the shutter value to achieve 100 fps.
 
My questions are,
1) Is it possible to build a color, 640x480 and 100fps AVI file by using the current configuration?  
2) Why the frame rate do not keep constant, even using Extrig/Continuous-Shot operation.
3) How could I set the Number of Buffer value for the IMAQ1394 Configure trigger.vi? (It seems nothing change after have adjusted the value)
4) What is the different between IMAQ and IMAQ1394 in NI? Why I always get an error message "Error -1074397145 occurred at IMAQ Init.vi" and "NI-IMAQ:  No interface found" once run LL ring.vi.
5) May I get the Extrig signal from IEEE1394 for verification?
 
Any suggestions and solutions are appreciated.
 
Thanks a lot,
Kai
 

Message Edited by Guyson on 04-26-2006 04:36 AM

0 Kudos
Message 1 of 11
(6,747 Views)
Hi Kai,
 
Thanks for your post.  You are correct concerning how to adjust the frame rate of the camera.  The shutter value combined with the ROI will determine how fast your acquisition is.  In Measurement and Automation Explorer (MAX) you can see the displayed and acquired frame rate in the bottom right hand corner during an acquisition (should look like 100/170, etc).  The larger number is how fast you are pulling images off the camera, the other is how fast they are actually being displayed on your PC.  Here are answers to your questions:
 
1) To see an example of how to use AVI and 1394, see "Grab and Save to AVI" (located under HW Input Output>>IMAQ>>File Input and Output) and the "Snap.vi" (located under HW Input and Output>>IMAQ 1394>>High Level) in the Example Finder in LabVIEW. 
 
2) The frame rate will vary on your PC at high frame rates because of other programs running on the OS.  As other programs task the processor, the acquisition may lag slightly.  Extrig/Cont-Shot Acquistion is the best way to minimize this unless you use a real time OS.
 
 
4) NI-IMAQ is for configuring our hardware image acquisition frame grabber cards.  NI-IMAQ for 1394 is only used to configure a 1394 device.  The two can not be used together.  No interface found is a typical error when the image can not be acquired through MAX.  Check the settings for your camera in MAX to ensure it can acquire an image.  See link below for more info on IMAQ error codes:
 
5) Use the IMAQ1394 Configure Trigger.vi to configure and setup external triggers on 1394 devices. See link below for more info:
 
Thanks,
 
Scott Savage
National Instruments
Applications Engineering
Message 2 of 11
(6,717 Views)
Hi Scott,
Thanks for your kindly help.
 
According to a document named "NI-IMAQ for IEEE 1394 Cameras User Manual", I think I should use IMAQ1394 Sequence.vi instead of IMAQ1394 Grab Acquire.vi.
After have studied another discussion from Jim Laudie (http://forums.ni.com/ni/board/message?board.id=200&message.id=5023&query.id=102793#M5023),  I modified a simple VI for the task.
It was attached for your reference.
 
Basically, together with a trigger signal, the VI programe can fullfill my requirement. However, how can I speed up the process.
At this moment, the program will spend about 5 minutes to record a video clip (the video format is: mono, 640x480, 100 fps 20 sec). I think it is far from our expectation.
 
Looking for your replay.
 
Many thanks,
Kai
0 Kudos
Message 3 of 11
(6,705 Views)

Kai,

I took your VI and configured it to no triggering and doing the acquisition from a Basler 601f1 in 640x480 at 60fps.

The acquisition of 2000 frames takes ~30 seconds. This is what I expected.

Writing the resulting ~600MB AVI to disk after the sequence was acquired takes about 15 seconds.

The overall execution time is less than one minute. So where is the problem? BTW, I noticed on my PC in the TaskManager a Peak Memory Charge of almost 1600MB. Does your computer have enough memory for this operation ? 

BR, Guenter Mueller

Message 4 of 11
(6,690 Views)
Hi Guenter,
 
Thanks for your kindly help and testing.
 
I am using a notebook to run the VI program. The ram capcity is only 1024MB (As i am not in my lab, I can't provide another details config. ). I agree to you that ram is one of the significant parameter to the process time. However, I do believe the notebook's configuration is reasonably good or even better than general.Smiley Wink
 
As per the conversation with my boss lately, actually we are looking for a solution that could achieve
1) 100 frames per sec, the time interval between each frames have to be even and exact. ( That why we need an external trigger signal).
2) resolution is 640x480,
3) color (YUV - 32bits)
4) can be filming continuously. Therefore, at this moment, the 2th VI program, named "kai Sequence and Save to AVI.vi", is no longer acceptable.
Indeed, the first attached VI program can achieve all of the requirements except the high frame rate. I agree to Scotts. Who point out that the frame rate fluctuation is caused by another tasks parallel ran in the OS.
 
The following specifications are come from Basler's Vision Techology
 
We note that there is a sentence "Mono: 8 bits/pixel, Color: YUV4:2:2 at half framerate or raw data". Am I right that the camera cannot maintain 100 fps in 640x480 with YUV4:2:2 video format? Althought the docs do not state clear the camera limitations, I suspect that if the camera ability is good enough to provide the solution.
 
As we have a signal generator that is out of any display, I can't confirm the exact freq. of triggering signal. I would like to know have any  VI's parameter can get the trigger signal from the IMAQ1394 camera so as to verify the trigger freq.?
 
Many thanks,
Kai
0 Kudos
Message 5 of 11
(6,686 Views)

Hello Kai,

concerning your "Am I right that the camera cannot maintain 100 fps in 640x480 with YUV4:2:2 video format?" - I think I was sleeping. Although I am not the hero of all video formats, YUV4:2:2 should mean, that you have an average data transfer of 16bit per pixel. (look e.g. at homepages of video professionals -- and -- This is also what Basler says.)

Short check: 100fps x (640 x 480) x (2byte per pixel) is about 60MB/sec. This is twice the bandwidth of 1394. So the maximum frame rate you can expect should be about 50fps.

Does anyone know better about YUVa:b:c than me and would like to add some comments for Kai? (Especially in case my calculation is incorrect.)

Message 6 of 11
(6,679 Views)

Hello Kai.

The information in my recent posting should be ok. A solution might be to use the camera in raw mode and to "bayer decode" the color - the A602fc CMOS chip supports this. See e.g. Basler homepage for the specification of the A602fc and the  http://www.framos.de/pdf_sheets/mt9v403_ds.pdf.

This should solve your "bandwidth problem".

Message 7 of 11
(6,674 Views)

Thanks Guenter,

I can make use of Bayer 8 to record a avi file. However, how can we decode the frame?

I understand that it is hard to guarantee an exact frame rate all the time. May I know the tolerance of the rate?

My notebook configuration are as follow,

1) HP NX6120

2) Microsoft Windows XP Professional Version 2002 SP2

3) Intel(R) Pentium (R) M processor 1.73GHz 794MHz, 0.99GB RAM.

The tolerance is important for me to further analysis.

 

0 Kudos
Message 8 of 11
(6,630 Views)

Hello Kai.

Examples how to "bayer decode" an image are shipped with your NI Vision Software, see  e.g. the color.llb in the vision examples.

Your question "May I know the tolerance of the rate?" is quite good - and hard to answer.
Scott Savage properly pointed out (in his answer) that you are not dealing with a real time operating system.

A good approach is: You run a benchmark and specify the conditions that must be met to keep your system doing it's job:
Try out if your notebook is in a good condition, i.e. it should at least be capable in doing a continous acquisition without "loosing" a images.
In the next step try out if your notebook is capable in writing all the incoming frames (within a reasonable delay) to an AVI.
If this works and the CPU and memory usage look good, this should be worth further investigation.

0 Kudos
Message 9 of 11
(6,617 Views)
Thanks Guenter,

I will try the example later.

Is it true that the frame rate fluctuation is 100% due to the PC or notebook?
How could we check if the notebook is in good condition? Any benchmark program that I can try?

On the other hand, as the notebook was mainly reserved for the project, we can switch off all the useless and unrelated background programs.
Could you suggest me which background programs that we can close?

I have already switch off WLAN, BLUETOOTH etc.

Many thanks,
Kai
0 Kudos
Message 10 of 11
(6,606 Views)