Add adaptive binarization function to nconvert

Discussions on NConvert - the command line tool for image conversion and manipulation

Moderators: XnTriq, helmut, xnview

SAMSAM
Posts: 33
Joined: Sun Sep 15, 2019 5:14 pm

Add adaptive binarization function to nconvert

Post by SAMSAM »

First of all, I want to express my gratitude for your wonderful tool. nconvert has been around for a long time. It has become indispensable in my work due to its simplicity and powerful batch image processing capabilities.

However, I am faced with the need to perform adaptive image binarization, which is currently missing from the nconvert functionality. Adaptive binarization is an important operation for processing images with uneven illumination, and its addition it would significantly expand the capabilities of your tool.

I would like to propose an implementation of the adaptive binarization command with three parameters:

1. Radius is a parameter that determines the size of the area for calculating the local threshold (from 4 to 100).
2. Smooth is a parameter that regulates the degree of smoothing of the image before binarization (from 0 to 100).
3. Binarize is the threshold value for binarization (from 0 to 255).

Example of using the command:
nconvert -adaptive_binarize radius=20 smooth=50 threshold=128 input.jpg -o output.png

Such a feature would be extremely useful for tasks of processing scanned documents, text recognition and other tasks where adaptive binarization is required. I would really appreciate it if you would consider adding this feature in future versions of nconvert. If you need additional information or usage examples, I am ready to provide them.

Thank you for your attention and for your hard work!