For images with uneven lighting, converting images to black and white with one threshold cannot achieve a good result.
For such cases, we can use adaptive thresolding, which calculates the threshold for each pixel based on neighbouring pixels.
The demo in this repo contains two solutions to perform adaptive thresholding.
- A pure JavaScript solution.
- A WASM solution based on Dynamsoft Barcode Reader.