Search code examples
pluginsdetectionedge-detectiongimp

code for Image Gradient plugin in Gimp 2.10.8


I wrote a C++ code where I perform edge detection on color or gray images (ppm files).

My code works well but is not as good as a specific Gimp plugin, especially when detecting more faint edges (low luminosity gradient). The plugin I am referring to is under Filters/Edge-Detect/Image Gradient in Gimp 2.10.8. Mouse hover says "Compute gradient magnitude and/or direction by central differences".

Below I embedded a gray test image to compare the results (i.e. gradient intensity), although my work is in color as well. The test image consists of some 13 circular rings with various luminosities (constant for each ring). The difference in luminosity between two adjacent rings increases from 2 luminosity units (for the inner rings) to 30 luminosity units (for the outer rings) in the outward radial direction.

As expected, the detected gradient is small for the inner rings and higher for the outer rings. The problem is that my C++ code is less sensitive to small gradients than the Gimp plugin is, as can be seen from the other two images below.

Where can I find the code for the Gimp Image Gradient plugin so I can learn something from it? I am not interested in the other Gimp plugins for edge detection (I verified that they are not quite as good as the Image Gradient, at least for my application).

enter image description here


Solution

  • It is in the GEGL package

    File is operations/common/image-gradient.c