Post Reply 

reading a filter martix - is it possible

Nov 24, 2013, 22:48
Post: #1
reading a filter martix - is it possible
In order to get rid of a smeared background from scanned documents, I frequently use a filter matrix like this:

-0.2 -0.2 -0.2 -0.2 -0.2
-0.2 -0.2 -0.2 -0.2 -0.2
-0.2 -0.2 +8.0 -0.2 -0.2
-0.2 -0.2 -0.2 -0.2 -0.2
-0.2 -0.2 -0.2 -0.2 -0.2

or the like. The centre weight, in the exaple 8.0, has to be adapted to the image to be applied. Another example would be

-0.1 -0.1 -0.1 -0.1 -0.1
-0.1 -0.2 -0.2 -0.2 -0.1
-0.1 -0.2 +5.8 -0.2 -0.1
-0.1 -0.2 -0.2 -0.2 -0.1
-0.1 -0.1 -0.1 -0.1 -0.1

where the centre weight - in this example 5.8 - also has to be adapted to the sample. I see myself entering one of these matrices again and again.

The basic idea: The entries around the middle subtract an average of surrounding pixels from the weighted value of the centre pixel.

Although the matrix operation is a linear one, this works due to "nonlinearity". It would be nice, if one could include only pixels, with a brightness above a certain given level (compared with the centre level) into the average to be subtracted. This would make even better filters to reduce unequal illumination or shade in paper issues. But one would have to add nonexisting features to the matrix operation itself, i.e. generalize it to becone a non-linear function (by virtue of the functions plugged into each matrix-position): Apply a defined function on the pixel rather than only multiply its value by the constant given in the corresponding matrix position.

But even as long as we do not have such a more general matrix filtering function, I am still looking for a way to store a matrix of coefficients of the current filter matrix fuction in order to reuse it without entering it over and over again.

* Is there such a thing?
* Would it be possible to write an extension ("script-fu" ?)

Any help would be very welcome.

Find all posts by this user
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  How do I set the color in the grid filter? beebell 2 340 Mar 18, 2018 15:21
Last Post: paynekj
  Filter > Blur > Average dinosaur 2 477 Jan 17, 2018 02:20
Last Post: dinosaur
  NL filter? marni 1 582 Jun 2, 2014 15:14
Last Post: rich2005
  How To Adjust Filter Intensity in Gimp? UptonO.Goode 2 712 Mar 21, 2014 19:51
Last Post: UptonO.Goode
  Filter the levels of a picture depending on its color Mateos 8 1,399 Feb 14, 2014 21:10
Last Post: Mateos

Forum Jump:

GIMP ForumPortalArchiveContactTermsRSS