The invention discloses an adaptive
particle swarm algorithm-based
grayscale threshold obtaining method and an
image segmentation method, and belongs to the technical field of
image processing. The
grayscale threshold obtaining method is characterized by comprising the following steps of S01, performing
population initialization on a
grayscale value of an image; S02, calculating a fitness value of an individual in a
population; S03, calculating an optimal position and a
global optimal position of the individual in the
population; S04, updating the optimal position and the
global optimal position of the individual in the population; and S05, judging whether a stop condition is met or not, and if the stop condition is met, obtaining an optimal solution and obtaining an optimal grayscale threshold, otherwise, executing the step S02 to enter a next-generation population, wherein the optimal position and the
global optimal position of the individual are dynamically adjusted by adopting an inertial weight in the step S04. The grayscale threshold obtaining method has autonomic learning property, adaptivity and relatively high robustness, can concurrently solve the grayscale threshold globally and better avoid
local optimum, and is accurate and efficient.