Adaptive Thresholding Using the Integral Image.
Based on https://github.com/phryniszak/AdaptiveIntegralThresholding Converted to Python.
For more details, please read this papaer Adaptive Thresholding Using the Integral Image.
This method can preserve more image details as the table shows.
test image | OTSU Thresholding |
---|---|
Adaptive Thresholding | Adaptive Thresholding Using the Integral Image |
The code is simple but the speed is insanely slow when the image is very large; and I use numba to speed up. The original code consumes more than 3 minutes for processing this test image while it only costs about 1 second with numba.