CN107169983B - Multi-threshold image segmentation method based on cross variation artificial fish swarm algorithm - Google Patents

Multi-threshold image segmentation method based on cross variation artificial fish swarm algorithm Download PDF

Info

Publication number
CN107169983B
CN107169983B CN201710238240.9A CN201710238240A CN107169983B CN 107169983 B CN107169983 B CN 107169983B CN 201710238240 A CN201710238240 A CN 201710238240A CN 107169983 B CN107169983 B CN 107169983B
Authority
CN
China
Prior art keywords
threshold
gray value
artificial fish
calculating
gray
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710238240.9A
Other languages
Chinese (zh)
Other versions
CN107169983A (en
Inventor
孙永军
王倩
赵朋俊
周昶
董文欣
刘祖军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xidian University
Original Assignee
Xidian University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xidian University filed Critical Xidian University
Priority to CN201710238240.9A priority Critical patent/CN107169983B/en
Publication of CN107169983A publication Critical patent/CN107169983A/en
Application granted granted Critical
Publication of CN107169983B publication Critical patent/CN107169983B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/136Segmentation; Edge detection involving thresholding

Abstract

The invention discloses a multi-threshold image segmentation method based on a cross variation artificial fish swarm algorithm, which mainly solves the problem that image information after segmentation is seriously lost in the prior art. The method comprises the following implementation steps: 1. inputting an image and acquiring pixel gray values at pixel points of all the images; 2. c threshold values are selected to divide the image into c +1 types; 3. generating n artificial fishes, wherein each artificial fish is a vector with the dimension of 1x c and represents a group of possible solutions of a threshold value; 4. taking a fitness function formulated by a kapur maximum entropy criterion as a target, and searching the maximum value of the fitness function; 5. and performing image segmentation by using a group of possible threshold solutions corresponding to the searched maximum fitness value, classifying the pixel points with the gray values in the same interval into one class, and outputting the segmented image. The method effectively improves the optimization precision of the artificial fish swarm algorithm in the optimization process, is further combined with multi-threshold image segmentation, improves the image segmentation effect, and can be used in computer vision analysis.

Description

Multi-threshold image segmentation method based on cross variation artificial fish swarm algorithm
Technical Field
The invention belongs to the technical field of image processing, and further relates to a multi-threshold image segmentation method which can be used for computer vision analysis.
Background
The multi-threshold image segmentation technology is used for dividing an image into a plurality of meaningful regions, ensuring effective follow-up work and being an important step from image processing to image analysis. The multi-threshold image segmentation method has the main idea that a plurality of proper thresholds are selected, pixel points with gray values between the two thresholds belong to the same class, the selected thresholds after segmentation can meet the maximum kapur entropy or the formula of the Otsu criterion, and then classified results are mapped back to the space of the original image, so that the final image segmentation result is obtained.
The traditional two-dimensional threshold image segmentation method based on the kapur maximum entropy criterion can obtain corresponding thresholds only through an exhaustion method, for the two-dimensional threshold segmentation method which only needs to segment an image into two types, the exhaustion method only needs to traverse all gray values, and only a proper single threshold is selected, but along with the increase of the complexity of the problem, for the multi-threshold image segmentation which needs to segment the image into multiple categories, a plurality of corresponding thresholds need to be solved, but the calculation time of the exhaustion method is too long, and meanwhile, the complexity of a model is increased, so that the requirement of a complex problem cannot be met by adopting the traditional exhaustion method.
The artificial fish swarm algorithm is one of swarm intelligence algorithms, the swarm intelligence algorithm is mainly based on an optimization algorithm for simulating biological living behaviors in nature, a swarm is composed of a plurality of individuals, each individual in the swarm is used as a potential solution of an optimization problem, an initial solution is selected for all the individuals, then the current solution is continuously updated, and the artificial fish swarm algorithm is finished when an optimal solution is searched or the maximum search frequency is reached. Blum in the article "Swarm intelligence optimization," Swarm intelligence, spring Berlin Heidelberg,2008.43-85, mentions that each individual in a Swarm intelligence algorithm is simple in function, but through interaction between individuals, the entire Swarm can solve complex problems, while having greater robustness and efficiency compared to traditional algorithms. Yang in the article "switched networks based algorithms" a clinical analysis, "evolution Intelligent architectures 7.1(2014):17-28 mentions that the initial value selection is more likely and the degree of freedom is greater due to the larger population size in the group intelligence algorithm.
The group intelligent algorithm has the advantages that each individual in the group can be regarded as a group of different possible solutions, the whole group has strong solution diversity, then the solutions of different individuals are updated through a certain behavior mode of the group, and the optimal solution is found out on the basis of meeting the criterion of the objective function. The swarm intelligence algorithm optimizes complex problems without excessive prior knowledge.
Therefore, more and more researchers combine the swarm intelligence algorithm with the multi-threshold image segmentation, for example, Horng proposes in the article "Multilevel threshold selection based on the artificial bee colony algorithm for image segmentation" Expert Systems with Applications 38.11(2011) by combining the artificial bee swarm algorithm, which has stronger exploration capability but weaker development capability and thus poorer optimization efficiency in the iteration process, with the multi-threshold image segmentation idea. In Sun, "GrayscaleImageSegmentation Using Multilevel Thresholding and Nature-InspiredAlgorithms," Hybrid Soft Computing for Image Segmentation. spring International Publishing,2016.23-52, it is proposed to combine a particle swarm and gravity search Hybrid algorithm with a multi-threshold Image Segmentation idea, wherein the particle swarm and gravity search Hybrid algorithm have strong development ability, but weak exploration ability, so that the optimization efficiency is strong only at the initial stage of the iterative process, and it is difficult to maintain high long-term optimization efficiency. According to the kapur maximum entropy criterion, multi-threshold image segmentation is realized, compared with the traditional exhaustion method, the time required by the multi-threshold image segmentation algorithm based on the group intelligent algorithm in the computing process is greatly shortened, but because the multi-threshold image segmentation based on the group intelligent algorithm is difficult to well balance the exploration capability and the development capability in the optimizing process, the problem that the optimal threshold possible solution cannot be found is caused, the obtained image information after threshold segmentation is seriously lost, the segmentation effect is not good enough, and the process of computer vision analysis is further influenced.
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provides a multi-threshold image segmentation method based on a cross variation artificial fish swarm algorithm so as to reduce the loss of image information and improve the image segmentation effect.
The method combines the cross variation-based artificial fish swarm algorithm with the multi-threshold image segmentation idea, and performs image segmentation by utilizing the advantage that the algorithm has the capability of further balancing the exploration capability and the development capability in the optimization process. And (4) following the criterion of the maximum information entropy of the kapur, solving a proper threshold to meet the maximum value of the fitness function, wherein the larger the fitness function value is, the better the segmentation effect is. Firstly, each individual in the artificial fish swarm respectively represents a group of possible solutions with different thresholds, the corresponding fitness is calculated according to a fitness function, iteration and updating are carried out through different behavior modes in an artificial fish swarm algorithm, finally, a searched threshold combination solution corresponding to the maximum fitness is output, then, pixel points in an image are classified according to the threshold combination, and the image is effectively segmented.
In order to achieve the purpose, the technical scheme of the invention is as follows:
(1) inputting a gray image, and extracting the number M × N of pixel points in the gray image, wherein the gray value of any pixel point is dk,k∈[1,M×N]The gray value range of each pixel point is [0, L-1 ]]Wherein M and N respectively represent the row and the column of a pixel point in the image, and L represents the level number of a gray value;
(2) setting the threshold number c of the divided images, and randomly selecting c different gray scales from all gray scales as
A set of possible solutions of the threshold values, and n sets of possible solutions of the threshold values are selected, wherein the possible solutions of each set of threshold values can be expressed as
Figure GDA0002437296250000031
And a ≠ b ≠ q, i ∈ [1, n ≠ q];
(3) Taking n groups of threshold possible solutions selected in the step (2), rearranging the gray values in each group of threshold possible solutions according to the order from small to large to obtain the sorted threshold possible solutions:
Figure GDA0002437296250000032
Figure GDA0002437296250000033
i∈[1,n]and will be
Figure GDA0002437296250000034
As an initial solution for the ith artificial fish in the artificial fish population, wherein
Figure GDA0002437296250000035
To represent
Figure GDA0002437296250000036
Corresponding mth threshold, m ∈ [1, c ] of the set of possible threshold solutions];
(4) Obtaining a gray level histogram h of the image, wherein the number h of pixel points with gray level value j in all the pixel pointsj, j∈[0,L-1];
(5) Calculate all h in (4)jThe proportion P of the total number M × N of the pixels in (1)j:Pj=hj/(M×N), j∈[0,L-1];
(6) According to the initial solution
Figure GDA00024372962500000311
C thresholds in (1) and P in (5)jCalculating the gray value probability sum omega degrees of c +1 gray value intervals in the initial solution;
(7) p according to (5)jCalculating the entropy H degrees of c +1 gray value intervals in the initial solution with the omega degrees in the step (6);
(8) calculating the initial solution of each artificial fish according to the entropy H DEG of the initial solution in the step (7)
Figure GDA0002437296250000037
Is adapted to
Figure GDA0002437296250000038
Saving a set of threshold possible solutions X with maximum fitness among n artificial fish initial solutionsbTo obtain the maximum value f (X) of fitnessb);
(9) Iteratively calculating n artificial fish solutions:
let t denote the current iteration number, t ∈ [0, MaxT]Wherein t is 0 and represents the initial state before starting iteration, and the fitness of the ith artificial fish in the t iteration is set as
Figure GDA00024372962500000312
i∈[1,n]MaxT represents the total number of iterations, V represents the visual field range of all artificial fishes, and the iteration steps are as follows:
(9a) let t be 1;
(9b) selecting n with highest t-1 iteration fitness1N with lowest sum fitness2An artificial fish bait
Figure GDA00024372962500000313
And dissolving the rest of the artificial fish
Figure GDA0002437296250000039
Is updated to
Figure GDA00024372962500000310
i∈[1,n];i∈[1,n];
(9c) N in (9b)1An artificial fish bait
Figure GDA0002437296250000041
Is updated by cross-over behavior
Figure GDA0002437296250000042
(9d) Calculating n in (9b)2An artificial fish bait
Figure GDA0002437296250000043
X in (1) to (7)bEuclidean distance of
Figure GDA0002437296250000044
If it is not
Figure GDA0002437296250000045
Then using local variant behavior will
Figure GDA0002437296250000046
Is updated to
Figure GDA0002437296250000047
Otherwise using global variant behavior will
Figure GDA0002437296250000048
Is updated to
Figure GDA0002437296250000049
(9e) According to all updated
Figure GDA00024372962500000410
C threshold values in the (f), and calculating the gray value probability sum omega of the t iteration c +1 gray value intervalst
(9f) P according to (5)jAnd ω in (9e)tCalculating the entropy H of the t-th iteration c +1 gray value intervalt
(9g) According to the entropy H obtained in (9f)tCalculating each artificial fish solution of the t-th iteration
Figure GDA00024372962500000411
Is adapted to
Figure GDA00024372962500000412
i∈[1,n];
(9h) All fitness in (9g)
Figure GDA00024372962500000413
Maximum value of fitness f (X) in (7)b) And (3) comparison: if it is not
Figure GDA00024372962500000414
The fitness maximum is updated to
Figure GDA00024372962500000416
Update the optimal threshold possible solution to
Figure GDA00024372962500000415
Otherwise, not updating;
(9i) comparing t with MaxT, if t < MaxT, making t be t +1, returning to (9b), otherwise outputting f (X)b) And XbExecuting the step (10);
(10) possible solution X with a set of thresholds with maximum fitness output in (9i)bCalculating gray value d 'of all pixel points'kD in (1)kIs updated to d'kOutput image, k ∈ [1, M × N]。
Compared with the prior art, the invention has the following advantages:
first, because the present invention introduces cross-behavior, it is directed to the top n with the highest fitness in the population1The individuals are crossed, and through information interaction among excellent small-scale groups, a more excellent possible solution is reserved, and the exploration capability in the group optimizing process is improved.
Second, since the present invention introduces variant behaviors and targets the last n with the worst fitness in the population2The individual is mutated, the artificial fish individual with poor convergence search performance can be induced to mutate into a new possible solution to the maximum extent, the influence of the disadvantaged solution on the group optimization result is reduced, the diversity of the whole group is enhanced, and the development capability in the group optimization process is improved to a certain extent.
Thirdly, the invention improves the exploration capability of the group, enhances the diversity of the whole group and the capability of jumping out of local extreme points, thus being capable of better balancing the exploration capability and the development capability in the optimizing process, being capable of selecting a more appropriate threshold value, overcoming the defect of losing too much information of the segmented image and realizing a more efficient image segmentation result.
Drawings
FIG. 1 is a flow chart of the present invention.
FIG. 2 is an input original image;
FIG. 3 is a graph of the segmentation results of FIG. 2 using the present invention and a prior art method;
fig. 4 is a fitness maximum curve during an iteration process of the present invention and the prior art method.
Detailed Description
The present invention will be described in further detail below with reference to the accompanying drawings.
The invention improves the optimizing capability of the original artificial fish swarm algorithm, introduces the cross behavior and the variation behavior, enables each artificial fish individual in the swarm to represent a group of possible solutions of the segmentation threshold by selecting a proper gray value as the segmentation threshold, and updates all the possible solutions based on the cross variation artificial fish swarm algorithm through a certain number of iterations. In each iteration process, each artificial fish updates self information by selecting different behavior modes, outputs the searched optimal threshold solution corresponding to the maximum value of the fitness function when the maximum iteration times is reached, and finally segments the image according to the optimal threshold solution.
Referring to fig. 1, the steps of the present invention will be described in further detail.
Step 1, inputting a gray image.
Acquiring 4 gray images from a gallery, inputting the gray images, extracting M × N pixel points from each gray image, wherein the gray value of each pixel point is dk,k∈[1,M×N]The gray value range of each pixel point is [0, L-1 ]]Wherein M and N represent the row and column of the pixel point in the image respectively, and L represents the level number of the gray value.
Step 2: the threshold number c of the divided images is set.
The number of the targets of image segmentation depends on the number c of threshold values, and the c threshold values can segment the image into c +1 targets, so the number c of the threshold values of the segmented image needs to be set before segmentation, and the implementation steps are as follows:
2.1) randomly selecting c gray values from the gray value range as c threshold values, and then using the c threshold values as a group of threshold possible solutions;
2.2) selecting n groups of threshold possible solutions, and representing each group of threshold possible solutions as
Figure GDA0002437296250000051
Wherein d isa,db,...,dqRepresenting the gray value a, b,. q ∈ [1, M × N ] of the a, b,. q pixel points in the image]And a ≠ b ≠ q, i ∈ [1, n ≠ q]And M × N represents the total number of pixels in the image.
And step 3: and initializing an artificial fish swarm algorithm.
The artificial fish swarm algorithm is a group-based optimization algorithm, and each individual in the group can be used as a solution question
A solution to the problem is to set n artificial fish in a population, wherein each artificial fish represents a set of threshold possible solutions, and the initialization of the artificial fish means obtaining n initial solutions of the artificial fish, and the process is as follows:
taking n groups of threshold possible solutions selected in the step 2, rearranging the gray values in each group of threshold possible solutions according to the order from small to large, wherein the sorted threshold possible solutions are represented as:
Figure GDA0002437296250000061
wherein
Figure GDA0002437296250000062
Figure GDA0002437296250000063
Will be provided with
Figure GDA0002437296250000064
As an initial solution for the ith artificial fish in the artificial fish population, wherein
Figure GDA0002437296250000065
The mth threshold in the representation, m ∈ [1, c]。
And 4, step 4: and acquiring a gray histogram h of the image.
According to all the pixel points and the gray value d of each pixel point acquired in the step 1kAll h with gray value j from 0 to L-1 are obtainedjWherein h isjRepresents the number of pixel points with the gray value of j, j ∈ [0, L-1](ii) a By using hjThe vertical axis represents the gray level j as the horizontal axis, and the obtained diagram is the gray level histogram h.
And 5: calculating the proportion P of the number of the pixels corresponding to each gray value to the total number of the pixels according to the number of the pixels with the gray value jj:Pj=hj/(M×N),j∈[0,L-1]Where M × N represents the total number of pixels and L represents the number of gray levels.
Step 6: according to PjThe gray value probability sum ω ° of the gray value interval is calculated.
Taking n artificial fishes in the step 3 to initially solve X degrees, and representing the ith artificial fish initial solution as
Figure GDA0002437296250000066
Its corresponding set of gray value probability sums is expressed as
Figure GDA0002437296250000067
Each group of
Figure GDA0002437296250000068
Contains c +1 gray value probability sums, i ∈ [1, n]The calculation process is as follows:
6.1) sequentially taking c +2 gray values which are respectively 0,
Figure GDA0002437296250000069
C threshold values and L-1, where the range between every two adjacent gray values represents an interval, the gray value range [0, L-1 ] is represented by c +2 gray values]Dividing the gray value into c +1 gray value intervals, and expressing the sum of the gray value probabilities of the ith group and the qth gray value interval as
Figure GDA00024372962500000610
q∈[1,c+1];
6.2) calculating the gray value probability sum of the 1 st gray value interval:
Figure GDA0002437296250000071
6.2) calculating the gray value probability sum of the r-th gray value interval:
Figure GDA0002437296250000072
6.3) calculating the gray value probability sum of the c +1 th gray value interval:
Figure GDA0002437296250000073
wherein
Figure GDA0002437296250000074
Represents the initial solution of the ith artificial fish
Figure GDA0002437296250000075
Of the r-th threshold value, PjAnd expressing the proportion of the pixel point with the gray value j to the total number of the pixel points.
And 7: the entropy H of the gray value interval is calculated.
Taking P in step 5jAnd (4) calculating the entropy H degree of the n groups of gray value intervals with the n groups of gray value probabilities and the omega degree in the step (6), wherein the entropy of the ith group of gray value intervals is expressed as
Figure GDA0002437296250000076
i∈[1,n]The entropy of the qth interval of gray values in the ith group is expressed as
Figure GDA0002437296250000077
q∈[1,c+1]Wherein
Figure GDA0002437296250000078
The calculation process of (2) is as follows:
(7.1) calculating the entropy of the 1 st gray value interval:
Figure GDA0002437296250000079
(7.2) calculating the entropy of the r-th gray value interval:
Figure GDA00024372962500000710
(7.3) calculating the entropy of the c +1 th gray value interval:
Figure GDA00024372962500000711
wherein
Figure GDA00024372962500000712
Represents the initial solution of the ith artificial fish
Figure GDA00024372962500000713
Of the r-th threshold value, PjRepresenting the proportion of the pixel point with the gray value j to the total number of the pixel points,
Figure GDA00024372962500000714
and representing the gray value probability sum of the ith gray value interval of the ith artificial fish in the initial solution.
And 8: and calculating the fitness of the initial solution of the artificial fish, and storing the maximum value of the fitness and the possible solution of the optimal threshold.
The adaptability can measure the capability of segmenting the image, and the larger the adaptability value is, the better the image segmentation effect is.
8.1) calculating the fitness of the n artificial fish initial solutions according to the entropy H degrees of the n groups of initial solutions in the step 7, wherein the ith artificial fish initial solution
Figure GDA00024372962500000715
Is expressed as
Figure GDA00024372962500000716
The calculation formula is as follows:
Figure GDA00024372962500000717
8.2) calculating the maximum value f (X) of the fitnessb):
Figure GDA0002437296250000081
Wherein XbA set of threshold possible solutions, also called optimal threshold possible solutions,
Figure GDA0002437296250000082
and expressing the entropy of the lambda gray value interval of the ith artificial fish initial solution.
And step 9: and (5) iteratively calculating n artificial fish solutions.
Taking t as the current iteration number, MaxT as the total iteration number,t∈[0,MaxT]wherein t is 0 and represents the initial state before starting iteration, V represents the visual field range of all artificial fishes, and the fitness of the ith artificial fish in the tth iteration is set as
Figure GDA0002437296250000083
i∈[1,n]The iteration steps are as follows:
9.1) initializing the iteration times t, and enabling t to be 1;
9.2) selecting n with the highest fitness of the t-1 th iteration1N with lowest sum fitness2An artificial fish bait
Figure GDA0002437296250000084
And decomposing the rest artificial fishes in the population
Figure GDA0002437296250000085
Is updated to
Figure GDA0002437296250000086
Wherein
Figure GDA0002437296250000087
i∈[1,n];
9.3) updating n in 9.2)1An artificial fish bait
Figure GDA0002437296250000088
Updating n in 9.2) using cross-behavior1An artificial fish bait
Figure GDA0002437296250000089
The update procedure is calculated as follows:
Figure GDA00024372962500000810
where the crossing behavior is a way to update the solution, p ═ 0.5 denotes the crossing factor, XiAnd XjAre all n described in step (9b)1One of the artificial fishes is decomposed,
Figure GDA00024372962500000811
represents the ith artificial fish solution of the t-1 th iteration,
Figure GDA00024372962500000812
represents the ith artificial fish solution of the updated tth iteration, and i, j ∈ [1, n],i≠j;
9.4) updating n in 9.2)2An artificial fish bait
Figure GDA00024372962500000813
For n in 9.2)2An artificial fish bait
Figure GDA00024372962500000814
There are two update modes, including using local and global variant-behavior updates, and the selection of the update mode depends on the comparison
Figure GDA00024372962500000815
And the size of the V is such that,
Figure GDA00024372962500000816
calculated according to the following formula:
Figure GDA00024372962500000817
wherein
Figure GDA0002437296250000091
W-th threshold, X, representing the ith artificial fish solution for the t-1 th iterationb,wRepresenting the w threshold of the optimal threshold possible solution in the step 8), wherein V represents the visual field range of the artificial fish;
if it is not
Figure GDA0002437296250000092
Using local variant behavior will
Figure GDA0002437296250000093
Is updated to
Figure GDA0002437296250000094
Otherwise, using global variant behavior will
Figure GDA0002437296250000095
Is updated to
Figure GDA0002437296250000096
The local variation behavior update formula is as follows:
Figure GDA0002437296250000097
wherein rand (0,1) represents a random number between 0 and 1,
Figure GDA0002437296250000098
representing the ith artificial fish solution X of the t iterationiM threshold value of (2), Xb,mIn which represents XbThe mth threshold of (2).
The global mutation behavior updating process comprises the following steps: randomly selecting c different gray values in the value range of the gray values, arranging the gray values from small to large, and performing ith artificial fish solution after the tth iterative update
Figure GDA0002437296250000099
9.5) calculating the gray value probability sum omega of the t-th iteration gray value intervalt
Taking the updated artificial fish solution X of the nth iteration n groupstThe ith artificial fish initial solution is expressed as
Figure GDA00024372962500000910
Each one of which is
Figure GDA00024372962500000911
Corresponding to a set of gray value probability sums
Figure GDA00024372962500000912
Each group of
Figure GDA00024372962500000913
Contains c +1 gray value probability sums, i ∈ [1, n]The calculation process is as follows:
9.5.1) sequentially taking c +2 gray values which are respectively 0,
Figure GDA00024372962500000914
Wherein the range between every two adjacent gray values represents an interval, and the gray value range [0, L-1 ] is divided by the c +2 gray values]Dividing the gray value into c +1 gray value intervals, and expressing the sum of the probability of the gray value of the ith group of the qth gray value intervals as
Figure GDA00024372962500000915
q∈[1,c+1];
9.5.2) calculate the sum of the gray value probabilities for the 1 st gray value interval:
Figure GDA00024372962500000916
9.5.3) calculating the gray value probability sum of the r-th gray value interval:
Figure GDA00024372962500000917
9.5.4) calculating the sum of the gray value probabilities for the c +1 th gray value interval:
Figure GDA00024372962500000918
wherein
Figure GDA00024372962500000919
Represents the ith artificial fish solution of the t iteration
Figure GDA00024372962500000920
Of the r-th threshold value, PjExpressing the gray value as the proportion of j pixel points in the total number of the pixel points;
9.6) calculating the entropy H of the t-th iteration gray value intervalt
Taking P in step 5jThe gray value probability sum omega of the n groups of gray value intervals in the step 9.5)tCalculating the entropy H of n groups of gray value intervalstWherein the entropy of the i-th group of gray value intervals is expressed as
Figure GDA0002437296250000101
i∈[1,n]The entropy of the qth interval of gray values in the ith group is expressed as
Figure GDA0002437296250000102
q∈[1,c+1]Wherein
Figure GDA0002437296250000103
The calculation process of (2) is as follows:
9.6.1) the entropy of the 1 st interval of gray values is calculated:
Figure GDA0002437296250000104
9.6.2) the entropy of the r-th interval of gray values is calculated:
Figure GDA0002437296250000105
9.6.3) calculating the entropy of the c +1 st gray value interval:
Figure GDA0002437296250000106
wherein
Figure GDA0002437296250000107
Represents the ith artificial fish solution of the t iteration
Figure GDA0002437296250000108
Of the r-th threshold value, PjRepresenting the proportion of the pixel point with the gray value j to the total number of the pixel points,
Figure GDA0002437296250000109
representing the gray value probability sum of the ith iteration ith artificial fish solution of the ith gray value interval;
9.7) calculating the fitness of the n artificial fish solutions of the t iteration.
According to the entropy H of the t-th iteration n groups of gray value intervals obtained in 9.6)tCalculating the fitness of the nth artificial fish solution in the t iteration, wherein the ith artificial fish solution
Figure GDA00024372962500001010
Is expressed as
Figure GDA00024372962500001011
i∈[1,n]The calculation formula is as follows:
Figure GDA00024372962500001012
i∈[1,n],λ∈[1,c+1],
wherein
Figure GDA00024372962500001013
Expressing the entropy of the ith artificial fish solution of the ith gray value interval of the tth iteration;
9.8) judging whether to update the fitness maximum value and the optimal threshold solution:
taking n fitness degrees f (X) in the step 9.7)t) Wherein the ith fitness is expressed as
Figure GDA00024372962500001014
Comparison
Figure GDA00024372962500001015
And the maximum value f (X) of the fitness in the step 8)b) The size of (2):
if it is not
Figure GDA00024372962500001016
The fitness is maximized f (X)b) Is updated to
Figure GDA00024372962500001017
And solving the optimal threshold value in the step 8) into a possible solution XbIs updated to
Figure GDA00024372962500001018
Otherwise, do not go intoAnd (6) updating the rows.
Step 10: and judging whether the iteration process is ended or not.
Comparing t with MaxT, if t<MaxT, let t be t +1, return to step 9.2), otherwise, output f (X) in step 8)b) And XbAnd ending the iteration process, and executing the step (11), wherein t represents the current iteration number, and MaxT represents the total number of iterations.
Step 11: and updating the gray values of all pixel points in the image and outputting the image.
11.1) taking X output in step 10bAnd d in step 1kUpdating gray values of all pixel points to d'k, k∈[1,M×N],d'kIs updated by comparing dkAnd XbThe size of c thresholds is determined:
if d isk<Xb,1,d'k=1;
If X isb,s-1≤dk<Xb,s,d'k=s,s∈[2,c];
If d isk≥Xb,c,d'k=c+1;
Wherein XbRepresenting the optimal threshold possible solution, X) in 8)b,1Represents XbMiddle 1 threshold, Xb,sRepresents XbMiddle(s) threshold value, Xb,cRepresents XbC threshold value;
11.2) outputting the image with the pixel point gray value updated.
The results of the present invention can be further illustrated by the following simulation results:
1. simulation environment and conditions:
matlab2012a was used as simulation software.
Inputting a 481x 321 gray scale image from the gallery, as shown in FIG. 2;
setting the iteration total number MaxT as 150, the population size n as 20, the visual field range V as 31, and the preferred number of individuals n1Number of poor individuals n ═ 626, the parameters of the artificial bee colony algorithm and the particle swarm and gravity search mixed algorithm correspond to each other according to the background technologyAre set forth in the references.
2. Simulation content:
simulation one:
taking the threshold number c as 5, performing 1-time segmentation simulation on the image 2 by using the artificial bee colony algorithm and the particle swarm and gravity search hybrid algorithm respectively, and obtaining a segmented image as shown in fig. 3, wherein (a) in fig. 3 represents the segmented image of fig. 2 by using the artificial bee colony algorithm, (b) in fig. 3 represents the segmented image of fig. 2 by using the artificial bee colony algorithm, and (c) in fig. 3 represents the segmented image of fig. 2 by using the particle swarm and gravity search hybrid algorithm.
Simulation II:
taking the threshold number c as 5, respectively using the artificial bee colony algorithm ABC and the particle swarm and gravity search hybrid algorithm PSOGSA to perform 1-segmentation simulation on the graph 2, wherein the iteration number is MaxT, the simulation curve of the maximum fitness in the simulation iteration process is shown in a result graph 4.
And (3) simulation:
taking the threshold number c as 2, 3, 4 and 5 respectively, and using the artificial bee colony algorithm ABC table and the particle swarm and gravity search hybrid algorithm, the PSOGSA carries out segmentation simulation on the graph 2, 30 times of segmentation simulation is carried out on each threshold number value, each time of segmentation simulation has a corresponding data result, wherein the corresponding data result comprises a fitness maximum value and an optimal threshold possible solution, and the data result corresponding to the time with the best segmentation effect in the 30 times of segmentation simulation is shown as shown in the table 1.
Calculating the average value of the maximum value of the fitness in the 30-time data results
Figure GDA0002437296250000121
And standard deviation std, the results are shown in table 2.
TABLE 1
Figure GDA0002437296250000122
TABLE 2
Figure GDA0002437296250000131
3. And (3) simulation result analysis:
the evaluation criteria of the multi-threshold image segmentation algorithm are as follows: the closer the segmented image is to the original image, the better the segmentation algorithm is. It can be seen from fig. 3 (b) that the image segmented by the artificial bee colony algorithm has the most information loss, and it can be seen from fig. 3 (c) that the image segmented by the particle swarm and the gravity search hybrid algorithm has more information loss, and none of the images can show the content in fig. 2 comprehensively, and it can be seen from fig. 3 (a) that the image information segmented by the invention has less information loss, is closer to the original image, which shows that the segmentation effect of the invention is better, because the invention accelerates the speed of the group to find the optimal result, enhances the diversity of the whole group and the ability of jumping out the local extreme point, so that a more appropriate threshold can be selected, and the segmented image can overcome the defect of losing too much information.
As can be seen from fig. 4, although the ABC curve is continuously rising, the maximum value of the searched fitness is too poor, which indicates that ABC has strong exploratory ability but weak development ability; the PSOGSA curve keeps a rapid growth trend before the 10 th iteration time, but quickly tends to be stable, which shows that the algorithm has strong development capability and weak exploration capability; the maximum value of the fitness searched in the longer iteration process keeps larger slope increase, which shows that the algorithm has stronger development capability, and meanwhile, the invention can find out that the maximum value of the fitness searched in the short-term iteration process has stronger integral search capability, and can better balance the development capability and the exploration capability in the optimization process, so that the segmentation effect is better.
As can be seen from table 1, in the case that the threshold number is the same, the maximum value of the fitness of the present invention is larger, which indicates that the segmentation effect of the present invention is better.
As can be seen from table 2, the mean value of the present invention is the largest and the standard deviation is the smallest under the condition that the number of thresholds is the same, which shows that the effect of the present invention in the multiple segmentation simulation is more stable.

Claims (4)

1. A multi-threshold image segmentation method based on a cross variation artificial fish swarm algorithm comprises the following steps:
(1) inputting a gray image, and extracting the number M × N of pixel points in the gray image, wherein the gray value of any pixel point is dk,k∈[1,M×N]The gray value range of each pixel point is [0, L-1 ]]Wherein M and N respectively represent the row and the column of a pixel point in the image, and L represents the level number of a gray value;
(2) setting the number c of threshold values of the segmented image, randomly selecting c different gray levels from all gray values as a group of possible solutions of the threshold values, and selecting n groups of possible solutions of the threshold values in total, wherein the possible solution of each group of threshold values is represented as
Figure FDA0002437296240000011
And a ≠ b ≠ q, i ∈ [1, n ≠ q];
(3) Taking n groups of threshold possible solutions selected in the step (2), rearranging the gray values in each group of threshold possible solutions according to the order from small to large to obtain the sorted threshold possible solutions:
Figure FDA0002437296240000012
Figure FDA0002437296240000013
and will be
Figure FDA0002437296240000014
As an initial solution for the ith artificial fish in the artificial fish population, wherein
Figure FDA0002437296240000015
To represent
Figure FDA0002437296240000016
Corresponding mth threshold, m ∈ [1, c ] of the set of possible threshold solutions];
(4) Obtaining a gray level histogram h of the image, wherein the number h of pixel points with gray level value j in all the pixel pointsj,j∈[0,L-1];
(5) Calculate all h in (4)jP is the proportion of the total number M × N of the pixel points in (1)j=hj/(M×N),j∈[0,L-1];
(6) According to the initial solution
Figure FDA0002437296240000017
C thresholds in (1) and P in (5)jCalculating the gray value probability sum omega of c +1 gray value intervals in the initial solution0The method comprises the following steps:
(6a) calculating the gray value probability sum of the 1 st gray value interval:
Figure FDA0002437296240000018
(6b) calculating the gray value probability sum of the r-th gray value interval:
Figure FDA0002437296240000019
(6c) calculating the gray value probability sum of the c +1 th gray value interval:
Figure FDA00024372962400000110
wherein
Figure FDA00024372962400000111
Represents the initial solution of the ith artificial fish
Figure FDA00024372962400000112
The nth threshold of (1);
(7) p according to (5)jω in and (6)0Calculating the entropy H of c +1 gray value intervals in the initial solution0The method comprises the following steps:
(7a) calculating the entropy of the 1 st gray value interval:
Figure FDA0002437296240000021
(7b) calculating the entropy of the r-th gray value interval:
Figure FDA0002437296240000022
(7c) calculating the entropy of the (c + 1) th gray value interval:
Figure FDA0002437296240000023
wherein
Figure FDA0002437296240000024
Represents the initial solution of the ith artificial fish
Figure FDA0002437296240000025
The nth threshold of (1);
(8) entropy H according to the initial solution in (7)0Calculating the initial solution of each artificial fish
Figure FDA0002437296240000026
Is adapted to
Figure FDA0002437296240000027
Saving a set of threshold possible solutions X with maximum fitness among n artificial fish initial solutionsbTo obtain the maximum value f (X) of fitnessb) Respectively calculated according to the following formula:
Figure FDA0002437296240000028
Figure FDA0002437296240000029
wherein
Figure FDA00024372962400000210
Indicating the entropy of the ith artificial fish to solve the lambda gray value interval initially,
Figure FDA00024372962400000211
representing the fitness of the initial solution of the ith artificial fish;
(9) iteratively calculating n artificial fish solutions:
let t denote the current iteration number, t ∈ [0, MaxT]Wherein t is 0 and represents the initial state before starting iteration, and the fitness of the ith artificial fish in the t iteration is set as
Figure FDA00024372962400000212
MaxT represents the total number of iterations, V represents the visual field range of all artificial fishes, and the iteration steps are as follows:
(9a) let t be 1;
(9b) selecting n with highest t-1 iteration fitness1N with lowest sum fitness2An artificial fish bait
Figure FDA00024372962400000213
And dissolving the rest of the artificial fish
Figure FDA00024372962400000214
Is updated to
Figure FDA00024372962400000215
Figure FDA00024372962400000216
(9c) N in (9b)1An artificial fish bait
Figure FDA00024372962400000217
Is updated by cross-over behavior
Figure FDA00024372962400000218
(9d) Calculating n in (9b)2An artificial fish bait
Figure FDA00024372962400000219
X in (1) to (7)bEuclidean distance of
Figure FDA00024372962400000220
If it is not
Figure FDA0002437296240000031
Then using local variant behavior will
Figure FDA0002437296240000032
Is updated to
Figure FDA0002437296240000033
Otherwise using global variant behavior will
Figure FDA0002437296240000034
Is updated to
Figure FDA0002437296240000035
(9e) According to all updated
Figure FDA0002437296240000036
C threshold values in the (f), and calculating the gray value probability sum omega of the t iteration c +1 gray value intervalstThe method comprises the following steps:
(9e1) calculating the probability distribution of the pixel points in the 1 st gray value interval:
Figure FDA0002437296240000037
(9e2) calculating the probability distribution of pixel points in the r-th gray value interval:
Figure FDA0002437296240000038
(9e3) calculating the probability distribution of the pixel points in the (c + 1) th gray value interval:
Figure FDA0002437296240000039
wherein
Figure FDA00024372962400000310
Represents the ith artificial fish solution of the t iteration
Figure FDA00024372962400000311
The nth threshold of (1);
(9f) p according to (5)jAnd ω in (9e)tCalculating the entropy H of the t-th iteration c +1 gray value intervaltThe method comprises the following steps:
(9f1) calculating the entropy of the 1 st gray value interval:
Figure FDA00024372962400000312
(9f2) calculating the entropy of the r-th gray value interval:
Figure FDA00024372962400000313
(9f3) calculating the entropy of the (c + 1) th gray value interval:
Figure FDA00024372962400000314
wherein
Figure FDA00024372962400000315
Represents the ith artificial fish solution of the t iteration
Figure FDA00024372962400000316
The nth threshold of (1);
(9g) according to the entropy H obtained in (9f)tCalculating each artificial fish solution of the t-th iteration
Figure FDA00024372962400000317
Is adapted to
Figure FDA00024372962400000318
Calculated according to the following formula:
Figure FDA00024372962400000319
wherein
Figure FDA00024372962400000320
Expressing the entropy of the lambda gray value interval of the ith iteration i-th artificial fish solution;
(9h) all fitness in (9g)
Figure FDA00024372962400000321
Maximum value of fitness f (X) in (8)b) And (3) comparison: if it is not
Figure FDA0002437296240000041
The fitness maximum is updated to
Figure FDA0002437296240000042
Update the optimal threshold possible solution to
Figure FDA0002437296240000043
Otherwise, not updating;
(9i) comparing t with MaxT, if t < MaxT, making t be t +1, returning to (9b), otherwise outputting f (X)b) And XbExecuting the step (10);
(10) possible solution X with a set of thresholds with maximum fitness output in (9i)bCalculating gray value d 'of all pixel points'kD in (1)kIs updated to d'kOutput image, k ∈ [1, M × N]。
2. The method of claim 1, wherein n in step (9c)1An artificial fish bait
Figure FDA0002437296240000044
Is updated by cross-over behavior
Figure FDA0002437296240000045
The update procedure is calculated as follows:
Figure FDA0002437296240000046
wherein p ═ 0.5 denotes a crossover factor, XiAnd XjAre all n as described in step (9c)1One of the artificial fishes is decomposed, and i, j ∈ [1, n],i≠j;
3. The method of claim 1, wherein the use of local variant behavior in step (9d) is to
Figure FDA0002437296240000047
Is updated to
Figure FDA0002437296240000048
The update formula is as follows:
Figure FDA0002437296240000049
wherein rand (0,1) represents a random number between 0 and 1,
Figure FDA00024372962400000410
representing the ith artificial fish solution X of the t iterationiM threshold value of (2), Xb,mIn which represents XbThe mth threshold of (2).
4. The method of claim 1, wherein step (10) is performed using a set of threshold possible solutions X with maximum fitnessb
Calculating gray value d 'of all pixel points'kComparing the gray value d of the pixel points in (1)kAnd XbThe size of c thresholds is determined:
if d isk<Xb,1,d'k=1;
If X isb,s-1≤dk<Xb,s,d'k=s,s∈[2,c];
If d isk≥Xb,c,d'k=c+1;
Wherein Xb,1Represents XbMiddle 1 threshold, Xb,sRepresents XbMiddle(s) threshold value, Xb,cRepresents XbC-th threshold.
CN201710238240.9A 2017-04-13 2017-04-13 Multi-threshold image segmentation method based on cross variation artificial fish swarm algorithm Active CN107169983B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710238240.9A CN107169983B (en) 2017-04-13 2017-04-13 Multi-threshold image segmentation method based on cross variation artificial fish swarm algorithm

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710238240.9A CN107169983B (en) 2017-04-13 2017-04-13 Multi-threshold image segmentation method based on cross variation artificial fish swarm algorithm

Publications (2)

Publication Number Publication Date
CN107169983A CN107169983A (en) 2017-09-15
CN107169983B true CN107169983B (en) 2020-08-11

Family

ID=59849796

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710238240.9A Active CN107169983B (en) 2017-04-13 2017-04-13 Multi-threshold image segmentation method based on cross variation artificial fish swarm algorithm

Country Status (1)

Country Link
CN (1) CN107169983B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107784196B (en) * 2017-09-29 2021-07-09 陕西师范大学 Method for identifying key protein based on artificial fish school optimization algorithm
CN109035249B (en) * 2018-09-10 2021-08-24 东北大学 Pipeline fault parallel global threshold detection method based on image processing
CN109492828B (en) * 2018-12-12 2021-08-13 河南科技学院 Distribution path optimization method considering customer grade and distribution time requirements
CN109712160B (en) * 2018-12-26 2023-05-23 桂林电子科技大学 Method for realizing image threshold segmentation based on generalized entropy combined improved lion group algorithm
CN111932556A (en) * 2020-08-11 2020-11-13 中国科学院微小卫星创新研究院 Multilevel threshold image segmentation method
CN112288754B (en) * 2020-11-09 2023-12-05 珠海市润鼎智能科技有限公司 Real-time binarization threshold selection method for high-speed image

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105007247A (en) * 2015-07-29 2015-10-28 南京信息工程大学 Frequency domain weighted multi-modulus method for optimizing DNA sequence of novel varied DNA genetic artificial fish swarm
CN106409288A (en) * 2016-06-27 2017-02-15 太原理工大学 Method of speech recognition using SVM optimized by mutated fish swarm algorithm

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105007247A (en) * 2015-07-29 2015-10-28 南京信息工程大学 Frequency domain weighted multi-modulus method for optimizing DNA sequence of novel varied DNA genetic artificial fish swarm
CN106409288A (en) * 2016-06-27 2017-02-15 太原理工大学 Method of speech recognition using SVM optimized by mutated fish swarm algorithm

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
基于改进人工鱼群算法的桥式起重机主梁优化设计研究;李瑞祥;《中国优秀硕士学位论文全文数据库(信息科技辑)》;20150715(第7期);第19-30页 *
基于改进的NCSPSO-AFSA对SVM参数的优化及其应用;冯哲等;《江苏科技大学学报(自然科学版)》;20140831;第28卷(第10期);第395-402页 *
基于物联网的中华绒螯蟹水质环境远;掌晓峰;《中国优秀硕士学位论文全文数据库(农业科技辑)》;20170215(第2期);第20-32页 *

Also Published As

Publication number Publication date
CN107169983A (en) 2017-09-15

Similar Documents

Publication Publication Date Title
CN107169983B (en) Multi-threshold image segmentation method based on cross variation artificial fish swarm algorithm
CN108389211B (en) Image segmentation method based on improved whale optimized fuzzy clustering
Aszemi et al. Hyperparameter optimization in convolutional neural network using genetic algorithms
CN108334949B (en) Image classifier construction method based on optimized deep convolutional neural network structure fast evolution
CN109948029B (en) Neural network self-adaptive depth Hash image searching method
Połap An adaptive genetic algorithm as a supporting mechanism for microscopy image analysis in a cascade of convolution neural networks
CN107330902B (en) Chaotic genetic BP neural network image segmentation method based on Arnold transformation
Pare et al. A context sensitive multilevel thresholding using swarm based algorithms
CN111105045A (en) Method for constructing prediction model based on improved locust optimization algorithm
Brajevic et al. Multilevel image thresholding selection based on the cuckoo search algorithm
CN109816087B (en) Strong convection weather discrimination method for rough set attribute reduction based on artificial fish swarm and frog swarm hybrid algorithm
Wang et al. Multilevel thresholding using a modified ant lion optimizer with opposition-based learning for color image segmentation
CN110738662A (en) Pituitary tumor texture image grading method based on fine-grained medical image segmentation and truth value discovery data amplification
CN110110753A (en) Effective hybrid characteristic selecting method of pollination algorithm and ReliefF is spent based on elite
Nayini et al. A novel threshold-based clustering method to solve K-means weaknesses
CN111832817A (en) Small world echo state network time sequence prediction method based on MCP penalty function
CN116170328A (en) Method and device for predicting bandwidth used for graphic coding
US20190205763A1 (en) Information processing device, information processing method and information processing program
CN114241267A (en) Structural entropy sampling-based multi-target architecture search osteoporosis image identification method
Phan et al. Efficiency enhancement of evolutionary neural architecture search via training-free initialization
Risso et al. Channel-wise mixed-precision assignment for dnn inference on constrained edge nodes
WO2021059527A1 (en) Learning device, learning method, and recording medium
O'Connor et al. Biclustering using message passing
CN111488991A (en) Communication community detection method of cuckoo algorithm combined with genetic and discrete difference
CN117611974B (en) Image recognition method and system based on searching of multiple group alternative evolutionary neural structures

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant