OTSU Three Threshold Image Segmentation Based on Improved Genetic Algorithm and Its Implementation in MATLAB

AGA vs. SGA insert image description here
AGA
insert image description here

SGA
insert image description here

This article is the second series of image segmentation. In the first series, three image segmentation algorithms and their GA-optimized MATLAB implementations are introduced. When the information of the image needs to be segmented carefully, one threshold obviously cannot meet the requirements, and multi-threshold segmentation is used. The commonly used exhaustive search method has poor effectiveness and cannot meet the requirements of practical applications. Therefore, it is necessary to seek a faster and more accurate optimization method combined with the threshold method for image segmentation.

Genetic Algorithm is an intelligent algorithm for solving complex optimization problems, and it is fully competent in the field of image segmentation. The genetic algorithm has fast optimization speed and strong robustness, and is suitable for various threshold segmentation criteria. However, the application of genetic algorithm is limited due to its randomness and premature maturity, so it is necessary to improve the genetic algorithm to improve the convergence performance of the algorithm.

Similarly, for the improvement of genetic algorithm, the author introduced 6 kinds in total, one of which is introduced here - adaptive genetic algorithm applied to OTSU three-threshold image segmentation, and compared with traditional genetic algorithm, and the remaining 2 will be introduced later Multi-threshold segmentation method of this algorithm. If you need to customize, you can also contact the author.

00 Article Directory

1 OTSU multi-threshold image segmentation method
2 Adaptive genetic algorithm
3 Program catalog
4 Application of improved genetic algorithm in OTSU multi-threshold segmentation
5 Source code acquisition
6 Outlook

01 OTSU multi-threshold image segmentation method

The multi-threshold segmentation of images is an extension of the single-threshold category. If the target image is to be segmented into K layers, the inter-class variance f (t) of the image multi-threshold segmentation can be expressed as:
insert image description here

After the image is segmented, the pixel probability ω of each category, the mean value of the K category μ, and the variance σ can be expressed as follows
insert image description here

Finally, the formula can be obtained, that is, the inter-class variance of the target segmentation image multi-threshold is expressed as:
insert image description here

02 Adaptive Genetic Algorithm

The theory of adaptive genetic algorithm has been discussed in Adaptive Genetic Algorithm and its MATLAB implementation , so it will not be repeated here.

03 Program directory

insert image description here

03 Application of improved genetic algorithm in OTSU multi-threshold segmentation

In order to test the performance of the improved strategy proposed in this paper, this paper selects 5 classic images for multi-threshold image segmentation test, as shown in the figure, of which 4 are Berkeley classic color images.
insert image description here

4.1 Image segmentation quality evaluation index

The image quality is evaluated by Peak Signal-to-Noise Ratio (PSNR), Structural Similarity Index (SSIM) and Feature Similarity Index (FSIM) to objectively evaluate the algorithm.
PSNR is used to verify the similarity between the original image I and the segmented image K, and its expression is
insert image description here

Among them, MSE is the mean square error (Mean Square Error) between the original image I and the processed image K.

SSIM is used to compare the structural similarity between the original image and the segmented image, that is, the relationship between adjacent pixels in the image, and its expression is:
insert image description here

Among them, μI and μK are the mean value of the original image and the segmented image pixels respectively, σI and σK correspond to the standard deviation of the image, σIK represents the covariance between the original image I and the segmented image K pixels, λ1 and λ2 is a constant.

FSIM is used to compare the feature similarity between images, that is, the phase consistency (Phase Congruency, PC) and the gradient feature (Gradient Magnitude, G), the expression is as follows:
insert image description here
insert image description here

in
insert image description here

These three indicators have one thing in common, that is, the larger the obtained value, the higher the quality of the image obtained by segmentation.

4.2 Experimental results
Run multi_OTSU_AGA.m and multi_OTSU_SGA.m in sequence, and then run compare.m to return the corresponding results. Here are some results and images (note, due to the randomness of the optimization algorithm, the uniqueness of the results cannot be guaranteed)

insert image description here
insert image description here
insert image description here
insert image description here

insert image description here
insert image description here

It can be seen from the fitness curve and the value of the evaluation index that the image threshold segmentation result obtained by the improved genetic algorithm is better than that of the traditional genetic algorithm, and the improvement is effective. At the same time, other improved methods proposed by the author can also be used to try, such as the improved quantum genetic algorithm based on niche and catastrophe.

05 Source code acquisition

https://mbd.pub/o/bread/mbd-ZJqalJtq

06 Outlook

This paper implements the OTSU three-threshold image segmentation algorithm, and introduces an improved genetic algorithm for optimization, which improves performance. The subsequent author will also update the multi-threshold algorithm implementation of the other two image segmentation algorithms. Welcome to pay attention.

微信公众号:KAU的云实验台

Guess you like

Origin blog.csdn.net/sfejojno/article/details/131386033