Quantcast Avisynth: Wavelet Denoising? - Page 2 - digitalFAQ.com Forums [Archives]
Go Back    digitalFAQ.com Forums [Archives] > Video Production Forums > Avisynth Scripting

Reply
 
LinkBack Thread Tools
  #21  
11-18-2002, 07:35 AM
GFR GFR is offline
Free Member
 
Join Date: May 2002
Posts: 438
Thanks: 0
Thanked 0 Times in 0 Posts
Hi

The "lazy" wavelet from the code I've posted is not good for this application - when you remove the details, the reconstruction gets blocky.

Sansgrip, you definetely need another stage to get usable results, the highest frequency bands are of too high frequency, you should have very little energy in these bands (with a good wavelet) so that they make very little difference unless you are too agressive to them

Some papers I've read state that you get a significant improvement in the smoothness of the reconstructed image if you use redundant wavelets, that is, if each band is not critically sampled and you use several "shifts" for each band. This of course involves LOTS more computation and memory.

I think we could try an intermediary thing like this:

1) smooth the image so you get rid of the high frequencies (but dont subsample the blured image, keep it at full resolution). You could try any smoothing filter you want, a moving average filter, splines, etc.

You could use separable filters (filter horizontal, then vertical) or non separable filters (that work with a "radius" around a given pixel).

2) Generate a detail image that is the difference of the original image and the blured image. This image is not subsampled too.

3) You can go on and smooth the smoothed image even more, with a more drastic version of your smoothing filter, and generate another difference image.

4) Apply the thresholding to the difference images (low level gate for noise removing, clipping for selective edge smoothing)

5) and then reconstruct the image adding the most smoothed image to its difference, then to the previous difference, etc.

You can easily change the smoothing filter without changing the rest of the program, and try different filters until you're satisfied with the smoothness. I think you could even implement the full algorythm in a AVISynth script

Even if maybe it's not exactly a Wavelet (depends on the filter you use) it will be a subband decomposition with perfect reconstruction, and the fact that we don't subsample the subbands may help the visual quality of the denoised image.

I think that eliminating the upsampling + filtering stage is the key to get rid of most of the spurious oscillations on the denoised image.
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Site Staff / Ad Manager
 
Join Date: Dec 2002
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #22  
11-18-2002, 10:09 AM
SansGrip SansGrip is offline
Free Member
 
Join Date: Nov 2002
Location: Ontario, Canada
Posts: 1,135
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by GFR
I think we could try an intermediary thing like this
This process you described (smoothing, threshold the difference, recompose) is basically the same as:

1) Find average of pixel values in n-by-n block
2) If centre pixel is out by more than threshold, average it with neighours

which is pretty much what all smoothers do already, and has the drawback that fine details are smoothed away along with noise. I don't think smoothing the smoothed (or even the difference) image again would help, because noise is generally so low-amplitude that it would be taken away in the first pass.

I'm intruiged by (non-lazy) wavelets, though, and would love to find one specifically targeted at denoising. Targeted at video denoising would be even better, but I can dream .

So if you hear of any wavelet algorithms (even very computationally expensive ones) you think would be particularly suitable, it would be interesting to code one of them up with your mathematical help to see how effective it really is.
Reply With Quote
  #23  
11-18-2002, 04:27 PM
GFR GFR is offline
Free Member
 
Join Date: May 2002
Posts: 438
Thanks: 0
Thanked 0 Times in 0 Posts
1) The problem: we have a noisy image and we want to recover the best approximation of the clean image we can, from this noisy image.

2) The clean image (the signal) is not available but must be guessed from the noisy image. We can make some assumptions about the clean image.

The first is that each pixel in the image is highly correlated to its neighbours. This means that the information is spread all over the image.

The second assumption we can make is that we can apply a "transform" to the image, that is, represent the image in an alternate way such that most of the information is "compacted" in a few coefficients, and the other, many, coefficients are not so important. One of such transforms is the DCT, another is the Wavelet Transform (WT). If you look at the DCT of an image or of a block of an image you'll see that most of the energy is compacted near the DC coefficient and it rapidly vanishes as you move to the highest frequencies. In a WT most of the energy is at the lowest resolution subband, and each detail band has less energy as you move to the highest frequency subbands.

This is because most images have most of their energy concentrated in the lowest frequencies, and have very little high frequency information. This is, of course, a generalization, but this is what lossy image compressing schemes like JPEG or MPEG rely on.

3) A practical denoising technique must also make some assumptions on the noise.

In the so called white noise one pixel of noise is not correlated to other pixels of noise; This means it doesn't have a DC level (zero mean) and that if you take a DCT or WT there won't be any concentration of significant coefficients - the white noise has equal energy at all frequencies. This doesn't hold if the noise is "coloured".

White noise is also not related to the clean signal in any way. Some kinds of noise, like JPEG artifacts, are highly correlated to the clean signal.

The noise is considered additive, this meaning that the noisy image is a "sum" of the clean image with some amount of pure noise.

To be able to make a nice approximation of the clean image using the noisy image, the amount of noise should not be "too much". It's not only much harder to guess what's signal in the middle of an ocean of noise than to remove a little noise in an almost good image, but the more noise you have the worse will be your results. As the level of noise increases, the more subtle information is masked by the noise and you can only extract the more strong features of the clean signal.

4) The Wavelet denoising.

Since the noise is supposed to be additive, and the WT is linear, the WT of the noisy image is equal to the WT of the clean signal added to the WT of the pure noise.

The WT of the clean image has most energy compacted at the low frequency subbands. The WT of the noise has its energy spread evenly all over the subbands, and its energy level is hopefully very much smaller than the energy level of the lowest frequencies of the clean signal and hopefully smaller than the most important signal features at the highest frequency bands of the clean signal.

Since the energy level of the noise is hopefully very much smaller than the energy level of the lowest frequencies of the clean signal, you can leave the low frequencies alone as the noise is masked by the signal and wont bother you

Traditional denoising kills the noise by attenuating the high frequencies (with some smoothing filter), but this also attenuates the high frequencies of the signal by the same amount.

The WT thresholding technique uses a "kill or keep" strategy. If the high frequency coefficient amplitude is below a certain level, it is noise or some detail you can't see anyway because of the noise; so you kill it. If it is above a certain threshold it problably ain't noise, but it is some detail you can see even with the noise; so you keep it. The result is that the noise is "killed" but the details that stand above the noise level are kept intact. The higher the noise level, the more details you have to sacrifice, just like in traditional denoising using "smoothing", but the difference is that even if you're sacrificing lots of details, the most proeminent details are still kept intact.

================================================== ====================================
Reply With Quote
  #24  
11-19-2002, 06:39 AM
GFR GFR is offline
Free Member
 
Join Date: May 2002
Posts: 438
Thanks: 0
Thanked 0 Times in 0 Posts
Hi,

take a look at

http://www.geocities.com/gfr.geo/teste2.html

Looks a lot better than the lazy Wavelet!.


here's a nice tutorial (but you need some math):

http://cas.ensmp.fr/~chaplais/Waveto...tation_US.html

This one is easier to understand, very good:

http://engineering.rowan.edu/~polikar/homepage.html

In this thesis you've got a chapter about still images and another chapter on video encoding:

http://www.informatik.uni-mannheim.d...mmer2002b.html
Multimedia Applications of the Wavelet Transform
Claudia Kerstin Schremmer

There are many papers on still images denoising you can find with google.

This book:

Signal and Image processing with neural networks (A C++ sourcebook)
Timothy Masters
John Wiley & Son Inc

Has the most intuitive wavelet explanation I've read, and also has got C code for image manipulation...

Some interesting stuff:

http://www.informatik.uni-mannheim.d...mmer2001d.html

http://www.informatik.uni-mannheim.d...mmer2001g.html
Reply With Quote
  #25  
11-19-2002, 08:27 AM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Hi GFR,

Now that's a lot of good information
Some of it, I can understand, and some I need an ice bag on my head after reading.
Excelent references.
This one is really nice and graphical: http://engineering.rowan.edu/%7epoli...Ttutorial.html

Thanks,
-kwag
Reply With Quote
  #26  
11-19-2002, 11:53 AM
GFR GFR is offline
Free Member
 
Join Date: May 2002
Posts: 438
Thanks: 0
Thanked 0 Times in 0 Posts
More to torture your neurons

I've found a C source for Wavelets & images.

Note: this Mallat guy is THE guru for wavelets!

Quote:
From: Stephane Mallat
Date: Tue, 22 Dec 92 12:56:39 -0500
Subject: Wavelet Softwares Availables

/************************************************** **************/
/* Wave1 Software */
/* Authors: Emmanuel Bacry, Wen-Liang Hwang, */
/* Stephane Mallat and Sifen Zhong */
/* */
/* (c) Copyright 1992 New York University */
/* All rights reserved */
/************************************************** **************/


/************************************************** **************/
/* Wave2 Software */
/* Authors: Wen-Liang Hwang, Stephane Mallat, Sifen Zhong */
/* */
/* (c) Copyright 1992 New York University */
/* All rights reserved */
/************************************************** **************/

Wave1 and Wave2 are two softwares written in C
to process signals with the wavelet transform.
These software run under Unix and X11 windows.
They provide shell environements that include
image displays, plotting and postscript facilities,
as well as general signal processing subroutines.
They can be particularly useful for researchers or engineers who
want to make experiments with the wavelet tranform.
The wavelet transform algorithms implemented in these softwares are
mainly based on two published papers:

[1] "Characterization of signals from multiscale edges" by Stephane Mallat
and Sifen Zhong,
IEEE Transactions on Pattern Analysis and Machine Intelligence,
Vol. 14, No. 7, p. 710-732, July 1992,

[2] "Singularity detection and processing with wavelets", by Stephane Mallat
and Wen Liang Hwang, IEEE Transactions on Information Theory,
Vol. 38, No. 2, p. 617-643, March 1992.

The Wave1 software processes one-dimensional signals whereas Wave2
processes images. Dyadic wavelet tranform decompositions and reconstruction
are implemented. Signal singularities and edges are detected from the
local maxima of the wavelet transform. We implemented the
subroutines that reconstruct signals from the local maxima of their wavelet
transform, with the algorithm described in [1]. One-dimensional signals
as well as images can thus be processed through the local
maxima of their wavelet transform (multiscale edges). Many subroutines
to process these local maxima are available. For images, applications to noise
removal and optical flow detection are implemented. An on-line
documentation is available.

A nonexclusive license to use this software and its documentation
for scholarly and research purposes only is hereby granted by
New York University. There is no fee to use this software for these
purposes. In using the software and documentation for scholarly and
research purposes you may copy or modify them but (a) you must include
the NYU copyright notice and the original authors' names on each copy
or modification you make of the software and of the supporting documentation;
and (b) you may not use, rewrite, or adapt the software or the documentation
(or any part of either) as the basis for any commercial software or hardware
product, without in each instance obtaining the prior written consent of
NYU or an appropriate license from NYU. You may not use this software
and its documentation (or any part of either) for any other purpose
without obtaining an appropriate license from NYU. To obtain any
license or consent from NYU, please contact: Patrick Franc, Office of
Industrial Liaison, New York University, 251 Mercer Street, New York,
NY 10012.

The source codes of Wave1 and Wave2 are available via anonymous ftp on the
machine cs.nyu.edu (IP number 128.122.140.24). After login with login name
"anonymous", do "cd pub/wave". The wave1 and wave2 softwares are
respectively in the compressed tarfiles "wave1.tar.Z" and "wave2.tar.Z".
These are unix-compressed tarfiles, so don't forget to put ftp under "binary"
mode before getting them. You must use the "uncompress" and "tar" unix
commands to restore the software.
Instructions for compilation are in the README files.
Reply With Quote
  #27  
11-21-2002, 11:05 AM
GFR GFR is offline
Free Member
 
Join Date: May 2002
Posts: 438
Thanks: 0
Thanked 0 Times in 0 Posts
This is great!

http://www.informatik.uni-mannheim.d...d/animationen/

It has java applets for Wavelets, DCT, etc. very instructive!
Reply With Quote
  #28  
01-08-2003, 12:26 PM
GFR GFR is offline
Free Member
 
Join Date: May 2002
Posts: 438
Thanks: 0
Thanked 0 Times in 0 Posts
http://perso.wanadoo.fr/polyvalens/clemens/clemens.html

The above site has an intuitive wavelet tutorial (downloadable in pdf) that covers noise reduction among other things, and it has pascal and c codes.

It also has a link to a page with a collection!!! of transforms
Reply With Quote
  #29  
01-08-2003, 11:16 PM
Gaudi Gaudi is offline
Free Member
 
Join Date: Dec 2002
Location: Buenos Aires, Argentina
Posts: 131
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Gaudi
Donīt know much about wavelets ( in fact know nothing), but used Matlab and know it has Wavelets and even an Image Processing Toolbox.

Matlab Homepage

These guy at Matlab are very good, so perhaps going through the code of the toolbox functions will be a good start. As far as I know, the coda can be compiled to C++.


Hope it helps a little.


Gaudi
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Avisynth: Ads() a function using a masked denoising etc incredible Avisynth Scripting 97 10-19-2004 06:52 AM
Avisynth: funny denoising routines incredible Avisynth Scripting 44 11-15-2003 11:27 AM
Avisynth: Wavelet Noise Reduction? kwag Avisynth Scripting 98 09-23-2003 12:22 PM
Wavelet Noise Reduction for VirtualDub kwag Video Encoding and Conversion 3 03-15-2003 12:23 AM




 
All times are GMT -5. The time now is 03:23 PM  —  vBulletin Đ Jelsoft Enterprises Ltd