Log in

View Full Version : Frequency based masking


Sagekilla
4th December 2008, 14:36
Does anyone know if it's possible, or if you can currently do this? I was thinking about it and it sounds like it could be useful to filter images based on the frequency domain.

An idea I had would be (pseudo code):

Find all frequencies above some value (basically a high pass) OR between two frequencies.
Create a mask of the video/image based on this.
Apply your filter of choice
Apply the mask from before to only affect your select frequency range


I thought it could be useful to filter out any extremely high frequency noise or otherwise do some neat tricks. I'm not sure if this is practical or anything, but just an idea :)

Also, is there anything that could create a frequency domain based mask?

Myrsloik
4th December 2008, 17:50
Filtering is just convolution so this can already be accomplished with your friendly general convolution filter.

Step 1: Create a band pass filter for the frequencies you want to filter
Step 2: Create the matching band stop filter
Step 3: Apply both filters with your convolution
Step 4: Apply your special treatment to the selected frequencies
Step 5: Merge images again
(note that for all linear operations step 1-5 can be merged)
Step 6: Wonder why the artifacts now look different

Lesson learned: you should not take the frequency domain lightly (even if it's technically done in the spatial domain)

I know this sounds a bit mean but it's very possible to do right now even if it's a bit slow. Until you figure out the exact operations to do (the hard part) I don't think there's anything to add.

Fizick
4th December 2008, 18:02
how do you can have frequency domain mask applied to spatial domain? :)
See defreq for global specrum.

Probably you say about some sort of block aproach, like fft3dfilter - it is implemented internally (sigmas).

I asked for more general real (complex) image type support (to produce and process frequency-domain intermediate images in scripts) , but the answer was: it will not be even in Avisynth 2.6.