4lex4 / scantailor-advanced

ScanTailor Advanced is the version that merges the features of the ScanTailor Featured and ScanTailor Enhanced versions, brings new ones and fixes.
GNU General Public License v3.0
1.15k stars 128 forks source link

GreyWorld filter? #120

Closed zvezdochiot closed 3 years ago

zvezdochiot commented 4 years ago

:question: Maybe should include in the 4:“Useful area” the optional GreyWorld filter for old books?

origin to greyworld

PS: It would also be nice to have controls: brightness and contrast :low_brightness: :high_brightness:.

jeremydmoore commented 4 years ago

@zvezdochiot Could you provide a link to the GreyWorld algorithm you're talking about? I'm very interested.

zvezdochiot commented 4 years ago

Hi, @jeremydmoore

GreyWorld algorithm:

https://github.com/ImageProcessing-ElectronicPublications/imthreshold/blob/64bbd4e5ab707b22a9b99d2ccd93ed27f769fcd9/src/lib/color.c#L407-L457

:information_source: The meaning of the algorithm: calculate the average of the channels, put the resulting average "color" in line with the "gray value". The ratio of the gray value to the average of the channels will be the color coefficient. By simply multiplying the coefficient by the color value, recalculate the values. Do not forget to check the value for validity.

jeremydmoore commented 4 years ago

Thank you,@zvezdochiot! I hadn't heard of this filter before, but I do digitization work with old materials so this is quite interesting.

zvezdochiot commented 4 years ago

Hi, @jeremydmoore

:information_source: There is also a slightly different version of this filter, which does not use color multiplication by a factor, but color shift by the corresponding value. Such a filter is less dependent on the original image and stably produces a "gray" average. But in practice, I have not seen the use of this modification.

PS: :warning: In the original sources, from the maximum values to "white": kR=255/Rmax, kG=255/Gmax, kB=255/Bmax.

zvezdochiot commented 3 years ago

no actual