What's the math (or code) behind GIMP convolution matrix filter

Viewed 133

I wrote a simple App for applying a convolution Matrix to an image, i have succeeded at it, but i expected it to be much more similar to the GIMP Plugin where the resulting image is more colorful than mine. This is the kernel Im using on Gimp and my Application:

 0  1  0
 1 -4  1
 0  1  1

This is the input Image: https://imgur.com/Vm7TKJs

This is the GIMP result: https://imgur.com/LLPOfrW With these settings: https://imgur.com/l9E3Uyk

This is the result with my app: https://imgur.com/Ml0UUqe

I also tried to look at the GIMP Code to understand but i Failed at it.

doew anyone know whats the math behind this filter?

1 Answers

Gimp uses some other color space than sRGB to apply the filter. Presumably some linear color space. If you apply a simple 2.2 gamma curve before the filter, and apply an inverse 2.2 gamma curve after it, you get a picture like this:filtered image

(All I did is: used pow(rgbValue, 2.2) before the filter. After the filter, I used pow(filterResult, 1/2.2). Note, that the correct sRGB transformation is a little bit more complicated than this.)

You can experiment with other color spaces as well (for example, HSV).

Related