04-14-2011 03:46 PM
I've been a vision user for many years and am still wondering when a proper "Frame Average" function will be added to vision?
The problem is when Adding a U8 image to another - within a U8 buffer - you will likely overrun the upper limit of the U8 data. The solution of 'casting' the U8 to a higher size - also - scales the data - so you're back the same overun problem.
Doing this by dumping the image as a numeric array and performing this operation is very CPU intensive. It should be possible to perform the summing and divide operations within IMAQ memory. But the IMAQ function are so specific with regards to input image type - they throw errors when you attempt to Add a U8 image to a U16 image (this should not be a problem).
Also, the singular example, is not a circular buffer example - which slow the refresh rate. Ideally, what everyone wants is a circular buffer frame averaging schema - where a image output for every frame input and it averages the last "N" frames. When it is first run there will be a delay to fill the buffer, but once it is full, it will output a frame for every frame in.
Regards
Jack Hamilton
04-19-2011 04:39 PM
Jack,
There is currently a frame averaging function in Vision. It is called IMAQ Compare and the default operator is "Average":
Your suggestion for an additional example program would be a great addition to the NI Community. Feel free to submit it.
04-19-2011 08:47 PM
Zach C.
Thanks for that post, it's odd that tech support is not aware that this function exists? I've called and posted on this several times over the years and always been pointed to the (at least) 15yr old "Frame Average Example"
I'm somewhat reluctant to use this function as I don't know if it allocates memory of a higher datatype than the input to prevent over-range occurance. Also, a two frame average is not the best, but marginally better than nothing. Is that acceptable for a vision package that cost several thousands of dollars$$$??.
As my application is collecting critical scientific data, I cannot affort to have the data corrupted by an 'unknown' function. And I would never know if this function causes an over-range condition - if so and under what situations.
As this is a common technique in any high speed data acquistion (averaging data)...I still don't know why it's not supported in IMAQ. Matrox image cards support this and have for over a decade.
I have written a 3 frame average FIFO that works, but dumps the data as an array, performs the summing and averaging and pushes it back to IMAQ memory again - very, very CPU intensive.
I suppose, we'll have to wait another decade for this function? (Please don't take this as a flame post - I work with vision, and often work with engineers who have a lot of imaging processing experience and I am often put into the position of defending why LV Vision is missing what is seen to be some basic functions)
Regards
Jack Hamilton
04-21-2011 08:52 AM
Jack,
Thanks for your suggestions, it's always great to hear what our customers are doing with our products. I'd suggest testing the IMAQ Compare function out in your application, I haven't noticed any incorrect behavior. To let you know, it does not accept two different data types to average. Additionally, you are not limited to averaging just two frames, you can use multiple instances of the function and average 2, 4, 8, 16, ..., etc. This may be another option for you.
This software has been developed to give customer's a wide variety of tools for image acquisition and processing. Unfortunately, we are not able to specialize it for every customer. I'm glad you are able to find a way to do this processing on your own using our tools. I will pass on this suggestion to our development team.
01-04-2013 01:40 PM
Zack,
I know this post is a little outdated but I was actually trying to use this IMAQ Compare function and had some questions about your statement. I want to take my raw image, which is constantly being updated, over 30 seconds and then average the values of all of the accumulated images and output to a single array that can be viewed. Do you have any ideas for how this could be accomplished?
Thanks
01-07-2013 09:31 AM
Greetings;
While I would recommend that you might want to create a new topic to ensure that this question has better visibility, I would have a question and possibly a recommendation.
If you are attempting to compare raw images over 30 seconds, would you not be able to convert the images initially to an array and then add these arrays / average them? Or is there a reason such as computing as to why you would need the IMAQ Compare function?
I wish you a great day!
Cordially;
Simon P.
01-07-2013 12:24 PM
Converting the images to array and performing the math in that domain of course works. The problem it is it EXTREMELY CPU intensive to push and pull numeric data from IMAQ memory.
What is being asked here is for an IMAQ low-level function to do this as PART OF STANDARD IMAQ FUNCTIONS. Frame averaging, is not new or novel and it's quite embarassing that IMAQ does not do this natively.
So IMAQ needs a function that will take U8 image input and sum them in U16 memory space. This would be quite efficient as a single U16 'frame' can sum upto 256 U8 images!.
The Matrox drivers have this built-in, you merely set the numbers of frames to average and Voila - after 'n' frames you get an averaged frame for every new frame input into the function.