C#, image binarization (01) - a review of binarization algorithms and a catalog of twenty-three algorithms

Image binarization is the calculation process of converting color (first converted to gray image) into black and white two-color image.

It seems extremely simple, but people have studied it for decades, but they have never reached the ultimate level. Fortunately, Beijing Liangao Software Development Co., Ltd. has researched and developed the best algorithm for image binarization and color image conversion to grayscale image, and its effect is far superior to those of academic products such as OpenCV and Matlab. The Liangao algorithm is realized and applied in the software " Original Professional Image Bleaching Software ".

This article briefly introduces the algorithm principle, classification and catalog of 23 algorithms of image binarization, and then releases the C# source code and calculation results one by one.

1. Image binarization and color image conversion to grayscale image are the cornerstones of image AI

The two basic functions of image processing: image binarization and color image conversion to grayscale image are the basis of all image (video)-centric AI. Many AI systems fail to achieve good expected results. The reason is not the problem of AI algorithm, nor the problem of training set, but the problem of basic data caused by image binarization and color image conversion to grayscale image.

2. Summary of Image Binarization Algorithm

2.1 Basic concepts

2.1.1 Gray Scale Image

Color images generally store image data in 3 or 4 8-bit bytes. Grayscale images are stored in 3 identical byte values ​​(wasteful!).

Each byte, from 0---255, so the gray level is 256 levels. 0-- is black; 255 is white.

2.1.2 Binary image (black and white image) Binary Image

A binary map is theoretically a 0/1 data map. In order to support various usage environments, it is generally replaced by grayscale images, which are 0 and 255.

2.1.3 Histogram

The gray level histogram is a function of the gray level distribution, which is the statistics of the gray level distribution in the image. The gray histogram is to count all the pixels in the digital image according to the size of the gray value and count the frequency of occurrence. The gray histogram is a function of the gray level, which indicates the number of pixels with a certain gray level in the image, and reflects the frequency of a certain gray level in the image. 

Histogram equalization can make the picture look clearer. 

Many binarization algorithms are based on gray histograms. People have been trying to find the best threshold from the histogram. 

2.1.4 Threshold

Threshold means boundary, so threshold is also called critical value, which refers to the boundary value of a data.

Threshold by gray value of a row of the image:

According to the division of grayscale histogram:

2.2 Classification of image binarization algorithms

The core of binarization is to find the best threshold so that the desired result appears after binarization.

According to the scope of use of the threshold, the binarization algorithm is divided into  two types : global threshold algorithm and local  threshold algorithm .

The global threshold algorithm is simple to calculate and fast, but it cannot handle many special pictures.

The local thresholding algorithm is computationally complex and much slower, but it can handle these special pictures.

2.2.1 Global Threshold Global Threshold

For general pictures, choose an appropriate threshold and calculate with this unique threshold to achieve the effect.

2.2.2 Local Threshold Local Threshold

The local threshold refers to finding a suitable threshold in a window area and calculating the area.

The calculation of the local threshold often designs more slow algorithms such as mean smoothing and Gaussian smoothing.

3. Catalog of twenty-three binarization algorithms

There are many binarization algorithms, according to incomplete statistics, there are more than 200 kinds. This article selects 23 of them to be implemented in C# and gradually releases all C# source programs. You can choose which one is applicable.

3.1 Support functions

C#, image binarization (02) - C# source code of some basic image processing functions for image binarization https://blog.csdn.net/beijinghorn/article/details/128425984?spm=1001.2014 . 3001.5502

3.2 Global Threshold Algorithm Directory

3.2.1 Basic threshold algorithm Threshold_Algorithm

C#, image binarization (03) - the basic algorithm of global threshold and its source program https://blog.csdn.net/beijinghorn/article/details/128426857?spm=1001.2014.3001.5502


3.2.2 Kittler AlgorithmKittler_Algorithm

C#, Image Binarization (04) - Global Threshold Kittler Algorithm and Its Source Program https://blog.csdn.net/beijinghorn/article/details/128428405?spm=1001.2014.3001.5502
3.2.3 Liangao Basic Adaptation Algorithm Automatic_Adaptive_Algorithm

C#, image binarization (05) - joint height adaptive algorithm of global threshold and its source code https://blog.csdn.net/beijinghorn/article/details/128428599?spm=1001.2014.3001.5502
3.2.4 Dajin Algorithm Otsu_Algorithm

C#, image binarization (06) - Otsu OTSU algorithm of global threshold and its source code https://blog.csdn.net/beijinghorn/article/details/128429571?spm=1001.2014.3001.5502
3.2.5 Iteration_Algorithm

C#, image binarization (07) - iterative algorithm of global threshold and its source code https://blog.csdn.net/beijinghorn/article/details/128429659?spm=1001.2014.3001.5502
3.2.6 Global weighted threshold algorithm Global_Threshold_Algorithm

C#, image binarization (08) - grayscale image binarization, global algorithm, global threshold optimization algorithm and its source code https://blog.csdn.net/beijinghorn/article/details/128429746?spm=1001.2014 .3001.5502
3.2.7 Maxium_Entropy_Algorithm

C#, image binarization (09) - grayscale image binarization, global algorithm, maximum entropy threshold algorithm and source program https://blog.csdn.net/beijinghorn/article/details/128473754?spm=1001.2014. 3001.5502
3.2.8 Mean_Algorithm

C#, image binarization (10) - grayscale image binarization, global algorithm, grayscale average algorithm and its source code https://blog.csdn.net/beijinghorn/article/details/128473830?spm= 1001.2014.3001.5502
3.2.9 Percentage_Algorithm

C#, image binarization (11) - grayscale image binarization, global algorithm, percentage threshold algorithm and its source program https://blog.csdn.net/beijinghorn/article/details/128473901?spm=1001.2014. 3001.5502
3.2.10 Valley_Bottom_Algorithm

C#, image binarization (12) - Global threshold algorithm (Valley-Minium Thresholding) and source code based on valley minimum value https://blog.csdn.net/beijinghorn/article/details/128473956?spm=1001.2014. 3001.5501
3.2.11 Intermodes_Algorithm

C#, image binarization (13) - Bimodal Thresholding and source program https://blog.csdn.net/beijinghorn/article/details/128521963?spm=1001.2014.3001.5501
3.2 .12 Best Iterative Algorithm Best_Iteratived_Algorithm

C#, image binarization (14) - the best iterative algorithm for global threshold (Iterate Thresholding) and source code https://blog.csdn.net/beijinghorn/article/details/128522073?spm=1001.2014.3001.5501
3.2. 13 One-dimensional maximum entropy Maxium_Entropy_1D_Algorithm

C#, image binarization (15) - one-dimensional maximum entropy (1D maxent) algorithm and source program of global threshold https://blog.csdn.net/beijinghorn/article/details/128522175?spm=1001.2014.3001.5501
3.2 .14 ​​Moment_Preserving_Algorithm

C#, image binarization (16) - Moment-proserving Thresholding algorithm for global threshold (Moment-proserving Thresholding) and its source code https://blog.csdn.net/beijinghorn/article/details/128522271?spm=1001.2014.3001.5501
3.2.15 IsoData Algorithm IsoData_Algorithm

C#, image binarization (17) - ISODATA algorithm of global threshold (also known as InterMeans method) and its source program https://blog.csdn.net/beijinghorn/article/details/128522610?spm=1001.2014.3001.5501
3.2.16 Fuzzy set theory algorithm Huang_Fuzzy_Algorithm

C#, image binarization (18) - global threshold fuzzy set theory algorithm (Huang Thresholding) and source program https://blog.csdn.net/beijinghorn/article/details/128585456?spm=1001.2014.3001.5501
3.2. 17 Shanbhag Algorithm Shanbhag_Algorithm

C#, image binarization (19) - global threshold Shambhala algorithm (Shanbhag Thresholding) and source code https://blog.csdn.net/beijinghorn/article/details/128585653?spm=1001.2014.3001.5501
3.2. 18 Yen Algorithm Yen_Algorithm

C#, image binarization (20) - global threshold Yen algorithm (Yen Thresholding) and source code https://blog.csdn.net/beijinghorn/article/details/128585816?spm=1001.2014.3001.5501

3.3 List of Local Threshold Algorithms

3.3.1 Wellner Adaptive Algorithm Wellner_Adaptive_Algorithm

C#, image binarization (21) - Wellner Thresholding of local threshold and source code https://blog.csdn.net/beijinghorn/article/details/128585919?spm=1001.2014.3001.5501
3.3. 2 Bernsen adaptive algorithm Bernsen_Algorithm

C#, image binarization (22) - Bernsen Thresholding algorithm of local threshold and source program https://blog.csdn.net/beijinghorn/article/details/128666982?spm=1001.2014.3001.5502
3.3. 3 Sauvola Adaptive Algorithm Sauvola_Algorithm

C#, image binarization (23) - local threshold Sauvola algorithm (Sauvola Thresholding) and source code icon-default.png?t=N176https://blog.csdn.net/beijinghorn/article/details/128667220?spm=1001.2014.3001.5501
3.3. 4 Niblack adaptive algorithm Niblack_Algorithm

C#, image binarization (24) - NiBlack algorithm and source program of local threshold algorithmicon-default.png?t=N176 https://blog.csdn.net/beijinghorn/article/details/128667349?spm=1001.2014.3001.5501

3.3.5 Yanowitz Bruckstein Adaptive Algorithm Yanowitz_Bruckstein_Algorithm
 

The Yanowitz Bruckstein adaptive algorithm is the algorithm with the best effect except the "Original 2.0" algorithm of Liangao .

Even with so many algorithms, all relevant image processing software and image bleaching software that can be purchased and downloaded in the world, such as Almighty. . King "PictureCleaner. . . "" ImageMagic. . . " and so on, its algorithm is just a toy made by children who have been in the valley all their lives in front of the algorithm of Liangao " Original 2.0 ".

The author will gradually release the source code of the above algorithm.

 Next: C#, image binarization (02) - C# source code of some basic image processing functions for image binarization https://blog.csdn.net/beijinghorn/article/details/128425984 

Guess you like

Origin blog.csdn.net/beijinghorn/article/details/128425225