0

I'm trying to use a Butterworth or Gaussian filter to combine two images in GIMP after using a Fourier plugin to convert the image to the Frequency Domain.

Frequency domain filtering: http://fourier.eng.hmc.edu/e101/lectures/Image_Processing/node8.html

The problem is, I have no clue how to implement/apply that filter in GIMP. There is a Gaussian filter but it's for Gaussian blur, not for placing a Gaussian-shaped gradient in image space. I want something like this: http://retina.anatomy.upenn.edu/~rob/lance/gaus2d.jpg But I need to be able to precisely control the radius. And for Butterworth I would need to control multiple parameters of the shape.

If there were some tool to draw that shape, I could draw it in a layer mask and then merge the layer with another image's FFT, then use reverse FFT to get the combined image.

It's also a huge plus if I can call a function to do this from a Script-Fu script.

Anyone know of a way to achieve this?

  • Are you looking for an FFT filter? There's one here. Put the files in your gimp plug-ins folder, and restart the application. As for the shape, use the gradient tool and switch the gradient type to radial, or perhaps just create a new brush? – Billy Kerr Apr 4 '18 at 1:16
  • Yeah, I am using that plugin. I was unaware of the radial gradient. Not quite as much control as I was hoping for but it will be helpful. – opusGlass Apr 4 '18 at 13:36
1

There is a FTT transform filter for Gimp.

To blend two images with maximum control you add a layer mask to the top one. You can initially create a plain radial gradient in the mask, and then use the Curves tool to shape it as you wish (consider the initial values of the gradient as being a representation of the distance from the center...).

However, Gimp is not meant to be used for mathematical processing, the code could take shortcuts when there is no visible difference. In addition in current Gimp (v2.8) 1) there are only 8-bit/channel, so round-off errors occur rather quickly and 2) Gimp works in "perceptual" space (there is a "gamma" applied) and this has side effects. The new Gimp 2.10 supports higher bit depths and can work in "linear light".

But no need for Gimp here, there are many image processing libraries around that can be combined with scientific computing libraries.

If you want to stay with Gimp, you can use Python and use numpy and scipy for your heavy processing.

  • I'm using a plugin that adds Fourier transforms. – opusGlass Apr 4 '18 at 13:33
  • 8bit isn't optimal but the tool doesn't need to have scientific precision, just achieve a visual effect. I have an install of 2.9 that I sometimes use for the 16-bit precision. It's disappointing that Gimp doesn't support some basic drawing functions like drawing a Gaussian gradient. Editing images in Frequency Domain is a pretty common part of image processing but even knowing that it lacks that without a plugin I expected more complex drawing functions to be available. Ah well, I suppose I can't expect free software to meet my every need. – opusGlass Apr 4 '18 at 13:48
  • Radial Gradient + curves tool is working, thanks! It's not ideal because I have to approximate Butterworth and Gaussian filters with splines but it will get the job done. – opusGlass Apr 5 '18 at 17:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.