Hey I have an image that I will be passing into tesseract, but before passing it in I need to enhance the "clarity" of the image for ocr. I can do this through windows photos "Edit=>Clarity" but want to know how I can get the same effect using sharp
Thanks
Hello, I may be wrong but I think this feature involves a technique called Contrast Limited Adaptive Histogram Equalization.
If so, libvips provides this via hist_local but this is not yet exposed in sharp.
The API could possibly look like something like the following:
.clarity({ width: 5, height: 5, slope: 3.0 })
...where width and height must be odd integers (default requires experimentation, perhaps 5 or 7) and slope will typically be a float between 2.0 and 4.0 (default to 3.0).
Most helpful comment
Hello, I may be wrong but I think this feature involves a technique called Contrast Limited Adaptive Histogram Equalization.
If so, libvips provides this via hist_local but this is not yet exposed in sharp.
The API could possibly look like something like the following:
...where
widthandheightmust be odd integers (default requires experimentation, perhaps 5 or 7) andslopewill typically be a float between 2.0 and 4.0 (default to 3.0).