# How to separate, modulate, and reassemble spatial frequencies?

### Background

I am trying to create a node in Blender that would allow me to do what you would do with an audio equalizer but on the spatial frequencies of an image: A sort of panel with eight controllers, from low to high spatial frequencies, which allows me to attenuate or increase a certain frequency plus a second panel that allows me to increase the contrast on each of the eight frequencies.

The idea came to me after playing a bit with Materialize, a well-known open-source software that serves to generate textures from a photograph and is used a lot in the world of video games. To generate a height map (but also other maps) it offered a panel with various controllers that allowed to act on the frequency.

### Question

On the Internet I have found practically nothing that is not the separation of frequencies made in Photoshop to correct skin imperfections. This procedure divides an image into low and high frequencies and then reassembles them. My problem is: How do I split an image into several different spatial frequencies (not just two) and then reassemble them to get the original image again but with the possibility of modulating them individually. Now, regardless of the software, what mathematical operations could I use fr this?

I'm doing tests with Blender nodes. The node is a group of other nodes, I'm not using Python.

• I edited your question according to my understanding. Please check whether everything is still according to your intentions and edit if needed. – Wrzlprmft Jul 2 '19 at 20:38
• Ideally you would run a fourier transform on the image and then filter those. As you would save some steps. But the skin frequency technique you see used in PS can be done recursively. Just separate very high form rest i then separate high ones from rest etc etc. The reason youd youse fourier is that this task gets easier and has a lower computationalb complexity (and you get a sinc basis instead of a gaussian one) I usually split my images to 2-4 bands when retouching. – joojaa Jul 2 '19 at 20:52
• This may be useful reading: en.wikipedia.org/wiki/Discrete_cosine_transform – PaulHK Jul 4 '19 at 4:06
• Another alternative to a Fourier transform would be to use a wavelet decomposition, say either (the very easy to code) Haar Wavelet (en.wikipedia.org/wiki/Haar_wavelet) or, probably better , say a linear or cubic wavelet. (eg see citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.54.5600 ) – Simon F Jul 4 '19 at 7:24
• Is this what you want? david.li/filtering If it is, check out the code (lower right corner). – lightxbulb Jul 15 '19 at 18:39