Printable Version of Topic
Click here to view this topic in its original format
Unofficial VirtualDub Support Forums > VirtualDub Filters and Filter Development > Image Averaging


Posted by: jjussila Feb 21 2003, 03:16 PM
I've just started to use VirtualDub with my astronomical video data. VirtualDub is a perfect tool for my purposes, except that it misses one useful filter -- 'frame averaging'. I spent some time searching for something like it but it seems to be unavailable.

The captured data (PAL, CCIR, 25 fps) is slightly noisy due to image intensified video camera and I would need better SNR for my purposes. The better SNR could be obtained by averaging consecutive frames into one frame and decreasing the frame rate at the same time. It should be possible to choose the amount of averaged frames between 2 and 250 (or something) frames.

I know that VirtualDub is not normally used in this kind of purposes, but would somebody know does there exist such a filter, or would somebody be able to program it?

- Jouni


Posted by: ChristianHJW Feb 21 2003, 04:17 PM
Use the 'temporal smoother' filter, it does everything you want, except change framerate ( or even 'drop' frames ) ....

Posted by: valja Feb 21 2003, 05:22 PM
QUOTE (ChristianHJW @ Feb 21 2003, 07:17 PM)
Use the 'temporal smoother' filter, it does everything you want, except change framerate ( or even 'drop' frames ) ....

Looks like temporal smoother can't do what jjussila needs. If we look to temporal and spatial behaviour of a picture, then "temporal smoother" is temporal analog of "spatial smoother". If we continue with this analogy, he needs "temporal resize".

In other words: spatial smoother can make picture quite smooth, but it will have the same spatial resolution as the original. It is not equal to shrinking the picture - in case of shrinking we will have lower resolution (smaller number of pixels).

What jjussila needs, is filter, which can replace 2-250 frames by one average. It is temporal analog of spatial resize - we will have lower resolution in time - say 1 frame instead of every 10 or 100. Even algorithms, how to calculate pixels in the average frame, can be analogious to these used with spatial resize. In case of hard spatial shrinking (say 5-10 times), every new pixel is result of averaging over 25-100 pixels, and result depends of algorithm used (bilinear, bicubic etc). In case of temporal "resizing" we have the same - one pixel is average of 2-250 frames over the time axis, and we can use here just the same algorithms (one dimensional linear, cubic etc).

AFAIK we havent such filter.

Posted by: jjussila Feb 21 2003, 05:46 PM

Yes, the "temporal smoother" doesn't help me. It certainly removes the noise, but it doesn't increase the signal, which I'm interested of. In certain cases I have to average frames over 5 or even 10 seconds to be able to get the weak signal out from the background.

Nowadays I normally extract the movie to separate images (1 frame/image), form a average of required images into new images, and then compile a new movie of the averaged images... it works but it's not effective at all.

Well, hopefully somebody has enough free time in the near future...

- Jouni

Posted by: valja Feb 21 2003, 07:24 PM
What you need (as first step) is a filter that can replace 2 3 or 5 frames by one average. This filter can be applyed in chain more than once, that will give a way to average over more frames (two consecutive filters that average 2 an 5 frames, will give as a sum average over 10 frames etc).

As I understand, your "movies" (actually series of pictures) have no sound, so it isn't thing to worry about.


Posted by: jjussila Feb 21 2003, 09:34 PM
Yep, exactly, a filter cabable to average 2,3 or 5 frames is enough! And there isn't any sound included into these clips, so that is certainly a thing not to worry about.

Actually, the video footage that I'm handling is either of northern lights or of some other astronomy object. You can find a small example from http://spaceweb.oulu.fi/projects/optical/atv98_example.html.

- Jouni

Posted by: Morsa Feb 22 2003, 12:04 AM
Simg software doesn't help you.It is meant for astronomy purposes.
If you wanna try it go to sourceforge.

Posted by: phaeron Feb 22 2003, 03:45 AM
Try cranking the threshold of temporal smoother all the way to the max -- it'll be very close to an averaging filter with radius 3, because for the vast majority of pixels the computed error will round off to zero. It's a FIR filter and should equally weight the frames. Use decimation afterward to throw out frames if you want. However, I wouldn't advise chaining it too much, as you'll accumulate roundoff error.

Incidentally, someone made an Avisynth version of the filter that can go up to a 14 frame window. Never tried it, though.

Posted by: valja Feb 22 2003, 12:57 PM
Avisynth's temporal soften filter and decimation may be used as workarounds, but jjussila certainly needs special filter.

What he is doing is accumulating a noisy picture to detect weak signals. Signal increases during accumulation, but noise fluctuations compensate each other, forming more and more smooth background. So with long enough accumulation time even very weak signal may be visible on the smooth background. It's something like increasing of exposure time in photography, but analyse with this filter have advantages - averaging over different numbers of frames allows also detect spatial move of weak signals.

Algorithm of such filter is very simple - just average pixels over N frames and replace these N frames by one average. It should not be a problem for programmer familiar with VDub filters. I would be glad to try it myself, but it will need too lot of time - I'm not at all familiar with VDub sources sad.gif

Powered by Invision Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)