brandonmpetty / Doxa

A Local Adaptive Thresholding framework for image binarization written in C++, with JS and Python bindings. Implementing: Otsu, Bernsen, Niblack, Sauvola, Wolf, Gatos, NICK, Su, T.R. Singh, WAN, ISauvola, Bataineh, Chan and Shafait.
https://brandonmpetty.github.io/Doxa/WebAssembly
Creative Commons Zero v1.0 Universal
168 stars 37 forks source link

FYI: Phansalkar Thresholding, a descendant of Sauvola #38

Open andreas-kupries opened 3 months ago

andreas-kupries commented 3 months ago

https://craftofcoding.wordpress.com/2021/09/28/thresholding-algorithms-phansalkar-local/

A descendant of Sauvola.

brandonmpetty commented 1 month ago

@andreas-kupries - Thank you for the reference. I am actually really interested to see if it can pick up faint details. However, the blog really only references the mathematical aspect of the algorithm, but if you go to the original paper, there is much more to it (working with RGB and LAB color-space images, and even Otsu)

https://www.researchgate.net/publication/224226466_Adaptive_local_thresholding_for_detection_of_nuclei_in_diversity_stained_cytology_images#:~:text=The%20adaptive%20local%20thresholding%20approach%20of%20the%20Phansalkar

I will try to take a look. Thank you.

andreas-kupries commented 1 month ago

You are welcome. Not sure if I managed to locate the paper ... Saved now, and looks to be short too. Marked for reading.

zvezdochiot commented 1 month ago

Hi @andreas-kupries and @brandonmpetty .

See also EdgeDiv (BlurDiv + EdgePlus(+Adapt)) threshold = image pre-processing ruler before the Otsu threshold/optimal global threshold and "Gradient Snip" threshold = ruler of hybrid (global/local) thresholds . These thresholds have a significant advantage over the Sauvola threshold when processing scanned images, both in terms of results and in terms of adjustability. At this moment, these are the two main thresholds in the tool at the link.

brandonmpetty commented 1 month ago

Thank you @zvezdochiot , I am familiar with ScanTailor. At some point I'd like to pull out the binarization implementations of a few open source projects, like ScanTailor, and compare them on accuracy and speed and see how this project stacks up. One of my problems is that, for this project, I am supporting so many platforms and so many bindings, it is really difficult to add new features. I have to bubble up support for every binding, on every platform. I am about 75% done with AdOtsu, which is currently viewable as a PR. I can't make any promises on when I can get these in, but I will try. Thank you for the support.

zvezdochiot commented 1 month ago

Hi @brandonmpetty .

Initially, it was also not easy for me to understand the thresholds in STEX. But when I decomposed the histogram (global) methods into a function for obtaining a value from a histogram and a function for cutting off an image based on this value, and into functions for constructing a threshold surface for local methods and a function for cutting off using this image surface, then everything became dramatically simplified. And after I isolated BoxBlur from the functions for constructing threshold surfaces based on IntegralImages, the threshold system became completely simpler. Later I was able to easily overcome the poor frequency response of BoxBlur by simply replacing it with GaussBlur.