Artificial rabbit search mechanism image segmentation method based on lotus law
By applying the artificial rabbit search mechanism based on the lotus law in image segmentation, the problem of long convergence time and easy to fall into local optimal solutions in the group intelligence method is solved, and more efficient and accurate image segmentation is achieved.
Patent Information
- Application Number
- CN202510059928.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-15
- Publication Date
- 2025-02-18
AI Technical Summary
The existing group intelligence methods have problems such as long convergence time and are prone to falling into local optimal solutions in image segmentation.
The artificial rabbit search mechanism based on the lotus law is adopted, and the energy consumption law of the artificial rabbit algorithm is improved through the combination of grayscale images, separation threshold division, entropy discrimination function and distance measurement function, and the energy consumption law of the artificial rabbit algorithm is enhanced, and the ability of global exploration and local development is enhanced.
The convergence speed and accuracy of image segmentation are improved, the risk of falling into local optimal solutions is reduced, and the segmentation effect is significantly improved.
Smart Images

Figure CN119477956A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of image processing, and in particular to an artificial rabbit search mechanism image segmentation method based on the lotus law. Background Art
[0002] Image segmentation is a technique and process to divide an image into several specific regions with unique properties and propose targets of interest. It is also a key step from image processing to image analysis. Existing image segmentation methods are mainly divided into the following categories: threshold-based segmentation methods, region-based segmentation methods, edge-based segmentation methods, and segmentation methods based on specific theories. Image segmentation is a process of assigning the same number to pixels belonging to the same region. From a mathematical point of view, image segmentation can also be regarded as the process of dividing a digital image into non-intersecting regions. Common image segmentation methods include the maximum inter-class variance method, the maximum entropy method, the minimum cross entropy method, and the K-means clustering method.
[0003] With the rise of swarm intelligence methods, traditional image segmentation methods are gradually used as the objective function of swarm intelligence methods, and the optimal segmentation effect is obtained within a specified time or number of iterations by participating in the iterative process of the group. Image segmentation methods combined with swarm intelligence methods have become one of the mainstream methods in the field of image segmentation because they can obtain more accurate segmented images in a shorter time. Therefore, designing a high-precision image segmentation method with high accuracy and strong robustness has important theoretical value and practical significance.
[0004] However, existing swarm intelligence methods have the problems of long convergence time and easy to fall into local optimal solutions.
[0005] Therefore, it is urgent to provide a solution to improve the above problems. Summary of the invention
[0006] The purpose of the present invention is to provide an artificial rabbit search mechanism image segmentation method based on the lotus law, so as to improve the problems of long convergence time and easy falling into local optimal solution in the swarm intelligence algorithm in the prior art.
[0007] The present invention provides an artificial rabbit search mechanism image segmentation method based on the lotus law, which adopts the following technical solutions: Converting the data type of the input image into a double-precision floating-point gray image based on grayscale conversion, obtaining the number of rows and columns of pixels in the gray image, and generating a matrix representation of the gray image based on the number of rows and columns; The grayscale histogram of the gray image is divided into a single background area and multiple target areas based on the separation threshold, and the grayscale value of the whole image is The probability of the appearance of the pixel points in the background area and the target area and The target area has a gray value of The probability of a pixel point; Based on the background area, target area and The target area has a gray value of The probability of the pixel points is used to obtain the grayscale mean of the background area, the The grayscale mean of the target area and the After calculating the grayscale means of the target areas, a total grayscale mean is obtained, and a distance measurement function is obtained based on the total grayscale mean; Based on The entropy discriminant function is obtained by calculating the entropy of each target area, and a joint discriminant function is obtained by weighted summing the entropy discriminant function and the distance measurement function based on a weight coefficient; The inverse of the joint discriminant function is used as the fitness function, and the individual positions of the artificial rabbits are updated based on the lotus law to obtain an improved artificial rabbit algorithm, and the fitness function is iteratively optimized based on the improved artificial rabbit algorithm to obtain a segmentation threshold corresponding to the minimum value of the fitness function; The segmentation thresholds are sorted to obtain a sorting sequence, and the input image is segmented in sequence according to the order of the sorting sequence.
[0008] The beneficial effects of the artificial rabbit search mechanism image segmentation method based on the lotus law provided by the present invention are as follows: (1) The traditional artificial rabbit search mechanism has problems such as slow convergence speed, low convergence accuracy, and easy to fall into the local optimal solution. Since the energy contraction mechanism of the original artificial rabbit search mechanism has a relatively random energy change when the number of iterations is low, it is difficult to achieve a balance between exploration and development. Therefore, the lotus law is used to improve the energy change of the rabbit in segments during the energy contraction stage. In the first stage of the iteration process, the rabbit's energy decreases exponentially. When the iteration enters the end, the rabbit has been hiding randomly for a long time and the food is about to run out. It is necessary to forage for food in a detour when there is no natural enemy. The energy will increase linearly by a small amount until it reaches a peak and remains stable. This energy calculation method makes the present invention more in line with the survival law of natural organisms, and it has been verified by simulation that it can increase the convergence of the method. In the detour foraging stage, the exploration method of the original artificial rabbit search mechanism selecting a random individual area for foraging is changed to moving to the average position of the population, which enhances the ability of global exploration; in the random hiding stage, the development method of the original artificial rabbit search mechanism randomly hiding in a cave near itself is changed to hiding in a cave near itself while moving towards the optimal solution, effectively avoiding falling into the local optimal solution.
[0009] (2) The traditional Otsu method only considers the grayscale difference between classes. When combined with the swarm intelligence method for image segmentation, it is easy to have a large maximum inter-class variance but poor segmentation effect. Based on the traditional Otsu method, the present invention combines it with the maximum entropy method to design the Otsu-maximum entropy image segmentation method. By establishing a joint discrimination criterion and combining it with the artificial rabbit search mechanism based on the lotus law, a more reasonable and accurate segmentation threshold is searched. Under the condition of setting the same maximum number of iterations, the artificial rabbit search mechanism based on the lotus law is better than the original artificial rabbit search mechanism and some classic swarm intelligence optimization methods such as the particle swarm mechanism in terms of peak signal-to-noise ratio, feature similarity and structural similarity. The segmentation results shown are better, which can show that the present invention has a relatively strong practical value in the field of image segmentation.
[0010] Optionally, the process of updating the individual positions of the artificial rabbits based on the Lotus Law includes: Initialize the position of each rabbit in the artificial rabbit population, and use the inverse of the joint discriminant function as the fitness function; Initialize the first generation Rabbit The dimension position is A random integer between , Indicates the maximum number of preset target areas. For the The upper bound of dimension, For the The lower bound of the dimension is obtained, the position of the first generation artificial rabbit individual is substituted into the fitness function as the segmentation threshold, the initial fitness function value of each artificial rabbit is obtained, and the position of the artificial rabbit individual with the smallest fitness function value in the initial population is set as the initial optimal position; The energy consumption law of rabbits is improved by using the lotus law, and the energy is used to determine whether the rabbit will enter the detour foraging stage or the random hiding stage. In the detour foraging stage, the position of the artificial rabbit is updated based on the average position of the population to obtain the first artificial rabbit individual position; in the random hiding stage, the position of the artificial rabbit is updated based on the optimal solution movement to obtain the second artificial rabbit individual position, and the updated artificial rabbit individual position is obtained based on the first artificial rabbit individual position and the second artificial rabbit individual position; The fitness function value is iterated based on the updated artificial rabbit individual position until the current iteration number reaches a preset maximum iteration number, and the updating is stopped to output the optimal position.
[0011] Optionally, the mathematical expression of the energy consumption law of the rabbit is: ; in, For the The energy of the prey at the iteration, , , It is in The selected A random number between When the rabbit enters the detour foraging stage, otherwise the rabbit enters the random hiding stage. Indicates the preset maximum number of iterations, Indicates the current iteration number.
[0012] Optionally, the mathematical expression of the first artificial rabbit individual position is: ; in, is the walking length of the first artificial rabbit, represents the position of the first artificial rabbit individual, represents the position of the first artificial rabbit individual before updating, represents the average position of all individuals in the first artificial rabbit population, and Represents a random number between (0,1), represents random numbers that follow a standard normal distribution, and is a fixed exploration factor, Indicates the current iteration number, Indicates the preset maximum number of iterations, Indicates the floor symbol; The mathematical expression of the second artificial rabbit individual position is: ; in, , ; in, Indicates The individual position of the second artificial rabbit in the iteration, , and Represents a random number between (0,1), Indicates The position of the second artificial rabbit in the iteration, Indicates the maximum number of preset target areas. Indicates that the The location of the optimal solution of the iteration, The second artificial rabbit A cave, for Any integer in , Indicates the round-up symbol.
[0013] Optional, based on the grayscale value of the entire image The probability of the appearance of the pixel points in the background area and the target area and The target area has a gray value of The process of calculating the probability of a pixel point includes: The probability of the pixel appearing is: ; in, Indicates that the gray value in the entire image is The probability of a pixel appearing is Indicates the gray value is The number of pixels, Indicates the number of all pixels in the entire picture; No. The target area has a gray value of The probability of a pixel is: ; in, Indicates The target area has a gray value of The probability of a pixel is Indicates pixel segmentation threshold components, Indicates pixel segmentation threshold components, ; No. The target area has a gray value of The probability of a pixel is: ; in, Indicates The target area has a gray value of The probability of a pixel is Indicates the upper limit of the gray level value. Indicates Pixel segmentation threshold component.
[0014] Optional, based on background area, target area and The target area has a gray value of The probability of the pixel points is used to obtain the grayscale mean of the background area, the The grayscale mean of the target area and the The process of calculating the grayscale mean of a target area includes: The mathematical expression of the grayscale mean of the background area is: ; in, represents the grayscale mean of the background area, Indicates that the gray value in the background area is The probability of a pixel is represents the first pixel segmentation threshold component, Indicates the gray value size, Indicates that the gray value in the entire image is The probability of a pixel appearing; The said The mathematical expression of the grayscale mean of the target area is: ; in, Indicates The grayscale mean of the target area, Indicates The target area has a gray value of The probability of a pixel is Indicates pixel segmentation threshold components, Indicates Pixel segmentation threshold component; The said The mathematical expression of the grayscale mean of the target area is: ; in, Indicates The grayscale mean of the target area, Indicates The target area has a gray value of The probability of a pixel is Indicates the upper limit of the gray level value. Indicates Pixel segmentation threshold component; The total grayscale mean The mathematical expression is: .
[0015] Optionally, when obtaining the distance measurement function based on the total grayscale mean, The mathematical expression of the distance measurement function is: ; ; in, represents the distance measure function, Indicates The grayscale mean of the target area, represents the total grayscale mean, Indicates The target area has a gray value of The probability of a pixel is Indicates the upper limit of the gray level value. Represents the gray value, Indicates that the gray value in the entire image is The probability of a pixel appearing is Indicates the maximum number of preset target areas.
[0016] Optionally, the The process of obtaining an entropy discriminant function by calculating the entropy of each target area, and obtaining a joint discriminant function by weighted summing the entropy discriminant function and the distance measurement function based on a weight coefficient includes: The entropy discriminant function The mathematical expression is: ; in, Indicates The entropy of the target area, , Indicates the maximum number of preset target areas; The joint discriminant function The mathematical expression is: ; in, and are the weight coefficients of Otsu method and maximum entropy method respectively.
[0017] Optionally, the process of sorting the segmentation thresholds to obtain a sorting sequence, and sequentially segmenting the input image according to the order of the sorting sequence includes: The threshold obtained when the discriminant function takes the maximum value is the optimal segmentation threshold, and then all the The grayscale value of pixels within the grayscale range is set to 0; will belong to The grayscale value of the pixel within the grayscale range is set to , , is the maximum gray value of the image; The grayscale value of the pixel within the grayscale range is set to , reconstruct the image after resetting the gray value of the pixel and complete the image segmentation. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1It is a flow chart of an artificial rabbit search mechanism image segmentation method based on the lotus law provided by the present invention; Figure 2 It is a 4-threshold segmentation convergence performance comparison curve diagram of an artificial rabbit search mechanism image segmentation method based on the lotus law provided by the present invention; Figure 3 It is a comparison curve diagram of the convergence performance of 8-threshold segmentation provided by the present invention; Figure 4 This is the 8-threshold segmentation grayscale image provided by the present invention. DETAILED DESCRIPTION
[0019] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention. Unless otherwise defined, the technical terms or scientific terms used herein should be understood by people with general skills in the field to which the present invention belongs. "Including" and similar words used in this article mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects.
[0020] The embodiment of the present invention provides an artificial rabbit search mechanism image segmentation method based on the lotus law, comprising: S1. Converting the data type of the input image into a double-precision floating-point gray image based on grayscale conversion, obtaining the number of rows and columns of pixels in the gray image, and generating a matrix representation of the gray image based on the number of rows and columns; S2, dividing the grayscale histogram of the gray image into a single background area and multiple target areas based on the separation threshold, and The probability of the appearance of the pixel points in the background area and the target area and The target area has a gray value of The probability of a pixel point; S3, based on the background area, target area and The target area has a gray value of The probability of the pixel points is used to obtain the grayscale mean of the background area, the The grayscale mean of the target area and the After calculating the grayscale means of the target areas, a total grayscale mean is obtained, and a distance measurement function is obtained based on the total grayscale mean; S4. Based on The entropy discriminant function is obtained by calculating the entropy of each target area, and a joint discriminant function is obtained by weighted summing the entropy discriminant function and the distance measurement function based on a weight coefficient; S5, taking the inverse of the joint discriminant function as the fitness function, and updating the individual positions of the artificial rabbits based on the lotus law, obtaining an improved artificial rabbit algorithm, and iteratively optimizing the fitness function based on the improved artificial rabbit algorithm to obtain a segmentation threshold corresponding to the minimum value of the fitness function; S6. Sort the segmentation thresholds to obtain a sorting sequence, and segment the input image in sequence according to the order of the sorting sequence.
[0021] See also Figure 1 First, input the image, grayscale the image and convert the image data type to double-precision floating point type, and model the Otsu-maximum entropy image segmentation method. Then initialize the artificial rabbit population, determine the fitness function, calculate the fitness value of each rabbit, and obtain the initial optimal position of the artificial rabbit population. In the energy contraction stage, calculate the energy of the artificial rabbit population. When the energy is greater than or equal to 1, the artificial rabbit population will enter the exploration stage of detour foraging, and obtain enough food by searching for grass in the territory near the average position of the artificial rabbit population.
[0022] Furthermore, when the energy is less than 1, it enters the random hiding stage, and the artificial rabbit population enters the random hiding development stage, moving closer to the rabbit with the best position to avoid being hunted by natural enemies. Then, the fitness value of each artificial rabbit individual after updating its position is calculated, the position of the optimal solution is updated, and it is determined whether the maximum number of iterations has been reached. If reached, the position of the last generation of optimal solutions is output and arranged in order from small to large as the separation threshold to complete the image segmentation. If not reached, it returns to the energy contraction stage, recalculates the energy of the artificial rabbit population, and determines whether the energy is greater than or equal to 1.
[0023] In some embodiments, when executing step S1, the input image is divided into two types: color image and gray image. If it is a color image, the color image is converted into a gray image and the image data type is converted into a double-precision floating point type. The row number of the pixel points in the gray image is extracted. and the number of columns , assuming the gray level range is , the grayscale image is represented as , Represents the number of all pixels. For the pixels, .
[0024] In some embodiments, when executing step S2, based on the gray value of the entire image The probability of the appearance of the pixel points in the background area and the target area and The target area has a gray value of The process of calculating the probability of a pixel point includes: The probability of the pixel appearing is: ; in, Indicates that the gray value in the entire image is The probability of a pixel appearing is Indicates the gray value is The number of pixels, Indicates the number of all pixels in the entire picture; The said The target area has a gray value of The probability of a pixel is: ; in, Indicates The target area has a gray value of The probability of a pixel is Indicates pixel segmentation threshold components, Indicates pixel segmentation threshold components, ; The said The target area has a gray value of The probability of a pixel is: ; in, Indicates The target area has a gray value of The probability of a pixel is Indicates the upper limit of the gray level value. Indicates Pixel segmentation threshold component.
[0025] In some embodiments, in step S3, based on the background area, target area and The target area has a gray value of The probability of the pixel points is used to obtain the grayscale mean of the background area, the The grayscale mean of the target area and the The process of calculating the grayscale mean of a target area includes: The mathematical expression of the grayscale mean of the background area is: ; in, represents the grayscale mean of the background area, Indicates that the gray value in the background area is The probability of a pixel is represents the first pixel segmentation threshold component, Indicates the gray value size, Indicates that the gray value in the entire image is The probability of a pixel appearing; The said The mathematical expression of the grayscale mean of the target area is: ; in, Indicates The grayscale mean of the target area, Indicates The target area has a gray value of The probability of a pixel is Indicates pixel segmentation threshold components, Indicates Pixel segmentation threshold component; The said The mathematical expression of the grayscale mean of the target area is: ; in, Indicates The grayscale mean of the target area, Indicates The target area has a gray value of The probability of a pixel is Indicates the upper limit of the gray level value. Indicates Pixel segmentation threshold component.
[0026] In fact, since the probability of edge points and noise points appearing is very small, they can be ignored, that is, , so the grayscale mean of the entire image approximately satisfies ,Right now .
[0027] Furthermore, when obtaining the distance measurement function based on the total grayscale mean, The mathematical expression of the distance measurement function is: ; ; in, represents the distance measure function, Indicates The grayscale mean of the target area, represents the total grayscale mean, Indicates The target area has a gray value of The probability of a pixel is Indicates the upper limit of the gray level value. Represents the gray value, Indicates that the gray value in the entire image is The probability of a pixel appearing is Indicates the maximum number of preset target areas.
[0028] In some embodiments, in step S4, based on The entropy discriminant function is obtained by calculating the entropy of the target area, and the joint discriminant function is obtained by weighted summing the entropy discriminant function and the distance measurement function based on the weight coefficient. The entropy discriminant function The mathematical expression is: ; in, Indicates The entropy of the target area, ; The joint discriminant function The mathematical expression is: ; in, and are the weight coefficients of Otsu method and maximum entropy method respectively. The segmentation method is the maximum entropy method. The time division method is the Otsu method.
[0029] In some embodiments, the specific steps of obtaining the improved artificial rabbit algorithm in step S5 include: S5-1. Initialize the position of each rabbit in the artificial rabbit population and use the inverse of the joint discriminant function as the fitness function.
[0030] Specifically, suppose the number of rabbits in the artificial rabbit population is , the maximum number of iterations is , the lower bound , upper bound , is the maximum dimension to search.
[0031] No. The iteration The position of the rabbit is ,in is the current iteration number, .
[0032] Furthermore, since the joint discriminant function of the Otsu-maximum entropy method obtains the optimal segmentation threshold when the maximum value is obtained, the inverse of the joint discriminant function is selected as the fitness function of the artificial rabbit search mechanism based on the lotus law. It can be expressed as: ; in, represents the joint discriminant function.
[0033] S5-2, Initialize the first generation Rabbit The dimension position is A random integer between , Indicates the maximum number of preset target areas. For the The upper bound of dimension, For the The lower bound of the dimension is obtained by substituting the position of the first generation artificial rabbit individual as the segmentation threshold into the fitness function. , obtaining the initial fitness function value of each artificial rabbit, and setting the position of the artificial rabbit individual with the smallest fitness function value in the initial population as the initial optimal position; Specifically, the fitness function value is the smallest and the individual position of the artificial rabbit is optimal.
[0034] S5-3. Use the lotus law to improve the energy consumption pattern of rabbits, and judge whether the rabbit will enter the detour foraging stage or the random hiding stage through energy. In the detour foraging stage, the individual position of the artificial rabbit is updated based on the average position of the population to obtain the first individual position of the artificial rabbit; in the random hiding stage, the individual position of the artificial rabbit is updated based on the optimal solution to obtain the second individual position of the artificial rabbit, and the updated individual position of the artificial rabbit is obtained based on the first individual position of the artificial rabbit and the second individual position of the artificial rabbit.
[0035] Specifically, when executing step S5-3, in the original artificial rabbit search mechanism, the energy change of the rabbit is relatively random, which does not conform to the law of change of biological energy in nature. The energy of the rabbit determines whether the artificial rabbit population will conduct global exploration or local development next. In order to maintain the balance between global exploration and local development of artificial rabbits, the energy of the rabbit is first changed to an exponential decline mode, and then the lotus law is introduced for further optimization.
[0036] Furthermore, by introducing the lotus law into the calculation of rabbit energy, the following optimization can be made: when the lotus grows, its daily growth rate is twice that of the previous day. On the 30th day, the entire lotus pond is in full bloom, and on the 29th day, half of the lotus pond is in full bloom. Based on this revelation, the energy changes of prey can be divided into two stages: an exponential decline stage and an upward-stable stage.
[0037] Furthermore, from the time relationship between 29 days and 30 days, we can get that the former stage accounts for 97% of the total number of iterations, and the latter stage accounts for 3% of the total number of iterations. When the first stage ends, the iteration is about to come to an end. At this time, the rabbit will choose to leave the cave to find food when there are no predators because the food stored in the detour foraging is about to be consumed. The energy will be slightly increased, and the energy of the rabbit in the latter stage can be set to linear growth. However, the energy growth of the rabbit has a certain limit, so after reaching a certain threshold, the rabbit's energy will remain stable until the end of the iteration.
[0038] In fact, the energy of the rabbit can be defined by the following expression: ; in, For the The energy of the prey at the iteration, , , It is in The selected A random number between When the rabbit enters the detour foraging stage, otherwise the rabbit enters the random hiding stage. Indicates the preset maximum number of iterations, Indicates the current iteration number.
[0039] Specifically, when executing step S5-3, in the detour foraging stage, the rabbits search for the required food in the distance. In the original artificial rabbit search mechanism, the rabbits choose to detour foraging in the territory of random individuals in the population, and the global exploration ability is poor. In order to enhance the global exploration ability, the artificial rabbits are divided into the first artificial rabbit and the second artificial rabbit. The detour foraging strategy of the first artificial rabbit population is to move to the average position of the population, and the detour foraging strategy of the second artificial rabbit is to build a cave while moving in the direction of the optimal solution. The mathematical expressions of the update speed of the two are different, as follows: The detour foraging strategy of the first artificial rabbit population is to move towards the average position of the population, and the position update formula is: ; in, is the walking length of the first artificial rabbit, represents the position of the first artificial rabbit individual, represents the position of the first artificial rabbit individual before updating, represents the average position of all individuals in the first artificial rabbit population, and Represents a random number between (0,1), represents random numbers that follow a standard normal distribution, and is a fixed exploration factor, Indicates the current iteration number, Indicates the preset maximum number of iterations, Indicates the floor symbol; Furthermore, in the random hiding stage, the second artificial rabbit population will conduct a random hiding development stage, moving closer to the rabbit with the best position to avoid being hunted by natural enemies. Each second artificial rabbit will build In the original artificial rabbit search mechanism, the second artificial rabbit built caves within its own territory, and its development ability was poor. In order to enhance the local development ability, the random hiding strategy of the second artificial rabbit population was changed to building caves while moving in the direction of the optimal solution, so as to avoid being preyed upon by natural enemies to a greater extent.
[0040] Among them, the mathematical expression of the individual position of the second artificial rabbit is: ; in, , ; in, Indicates The individual position of the second artificial rabbit in the iteration, , and Represents a random number between (0,1), Indicates The position of the second artificial rabbit in the iteration, Indicates the maximum number of preset target areas. Indicates that the The location of the optimal solution of the iteration, The second artificial rabbit A cave, for Any integer in , Indicates the round-up symbol.
[0041] S5-4, iterating the fitness function value based on the updated artificial rabbit individual position until the current iteration number reaches a preset maximum iteration number, stopping the updating, and outputting the optimal position.
[0042] Specifically, the In the iteration The location of the artificial rabbit individuals Set it as the segmentation threshold vector, substitute it into the fitness function to calculate the corresponding fitness function value, set the position of the individual with the best fitness function value in the artificial rabbit population as the optimal position, and record the The optimal position of the artificial rabbit population in iterations.
[0043] Furthermore, if The fitness function value of the optimal position of the artificial rabbit population in the iteration is better than that in the The optimal position fitness function value of the artificial rabbit population in the iteration is The optimal position of the artificial rabbit population in the iteration is equal to The optimal position of the artificial rabbit population in the iteration; otherwise, The optimal position of the artificial rabbit population in the iteration is equal to The optimal position of the artificial rabbit population in iterations.
[0044] In some embodiments, the process of performing step S6 of segmenting the input image in sequence according to the order of the sorting sequence includes: The threshold obtained when the discriminant function takes the maximum value is the optimal segmentation threshold, and then all the The grayscale value of the pixels within the grayscale range is set to 0; The grayscale value of the pixel within the grayscale range is set to , , is the maximum gray value of the image, which belongs to The grayscale value of the pixel within the grayscale range is set to , reconstruct the image after resetting the gray value of the pixel, take the optimal position of the artificial rabbit population in the last generation as the optimal segmentation threshold of the image, and sort them in order from small to large to obtain the segmentation threshold , complete the image segmentation.
[0045] For the convenience of description, the artificial rabbit search mechanism based on the lotus law proposed in the present invention is abbreviated as LARO, and the search mechanisms used for comparison are the artificial rabbit search mechanism and the particle swarm mechanism, which are abbreviated as ARO and PSO respectively.
[0046] In order to comprehensively compare the performance of the three methods, the three methods are initialized identically, and the parameters of the artificial rabbit search mechanism based on the lotus law are set as , , , , , The population size, maximum number of iterations, upper bound and lower bound of the three mechanisms are the same, and their values are , , , Each method was run independently for 30 times, and the average fitness of the 30 runs was taken to draw the fitness curve. The average value of the individual position of the best fitness of the 30 independent runs was used as the segmentation threshold for image segmentation.
[0047] See also Figure 2 , which represents the fitness curve simulation result diagram of the same image with different segmentation methods under the same initial value and taking the threshold number as 4, and takes the average value of 30 runs to draw the figure.
[0048] See also Figure 3 , which represents the fitness curve simulation result diagram of the same image with different segmentation methods under the same initial value and taking the threshold number as 8, and takes the average value of 30 runs to draw the figure.
[0049] Depend on Figure 2 and Figure 3 It can be seen that under different segmentation thresholds, compared with ARO and PSO, LARO has the advantages of fast convergence speed and high convergence accuracy, which fully demonstrates that LARO has superior convergence.
[0050] See also Figure 4 , which represents the grayscale image of the 8-threshold segmentation result after the same image is independently run 30 times by three different methods under the same initial value and the average value is taken as the segmentation threshold.
[0051] Figure 4 The segmentation effect shown is difficult to distinguish with the naked eye, so three indicators, namely peak signal-to-noise ratio, feature similarity and structural similarity, are selected to comprehensively measure the quality of the segmentation results. The English expressions of the three indicators are PSNR, FSIM and SSIM respectively.
[0052] PSNR is the most commonly used and widely used objective image evaluation index, which is the dB form of mean square error. It is based on the error between corresponding pixels, that is, it is an error-sensitive image quality evaluation. Although it has a wide range of applications, it does not take into account the visual characteristics of the human eye, so the evaluation results are often inconsistent with people's subjective feelings. Therefore, two other indicators, FSIM and SSIM, were selected as evaluation indicators. FSIM is the feature similarity of the image, which mainly measures the similarity of features between images. SSIM measures the similarity of two images from three aspects: brightness, contrast, and structure. It is a full-reference objective image evaluation indicator.
[0053] Furthermore, the three index evaluation results of the three methods for 4-threshold segmentation, 8-threshold segmentation and 12-threshold segmentation of the same image are shown in Table 1, and the three index evaluation results of the three methods for 6-threshold segmentation of different images are shown in Table 2. The larger the PSNR value, the better the segmentation result, and the closer the FSIM and SSIM values are to 1, the better the segmentation result. The bold font indicates the best result among the three methods.
[0054] Table 1 Evaluation table of 4-threshold segmentation, 8-threshold segmentation and 12-threshold segmentation indicators
[0055] , Table 2 Evaluation table of three indicators for 6-threshold segmentation
[0056] , It can be seen from Table 1 and Table 2 that among the 63 sets of data tested under the same conditions, the test data of this method is better than that of the comparison method in 62 sets. Therefore, the following conclusion can be drawn: the result of segmenting the input image by the artificial rabbit search mechanism image segmentation method based on the lotus law is significantly better than that of the artificial rabbit search mechanism image segmentation method and the particle swarm mechanism image segmentation method.
[0057] Although the embodiments of the present invention are described in detail above, it is obvious to those skilled in the art that various modifications and variations can be made to these embodiments. However, it should be understood that such modifications and variations are within the scope and spirit of the present invention as described in the claims. Moreover, the present invention described herein may have other embodiments and may be implemented or realized in a variety of ways.
Claims
1. An artificial rabbit search mechanism image segmentation method based on the lotus law, characterized in that: include: Converting the data type of the input image into a double-precision floating-point gray image based on grayscale conversion, obtaining the number of rows and columns of pixels in the gray image, and generating a matrix representation of the gray image based on the number of rows and columns; The grayscale histogram of the gray image is divided into a single background area and multiple target areas based on the separation threshold, and the grayscale value of the whole image is The probability of the appearance of the pixel points in the background area and the target area and The target area has a gray value of The probability of a pixel point; Based on the background area, target area and The target area has a gray value of The probability of the pixel points is used to obtain the grayscale mean of the background area, the The grayscale mean of the target area and the After calculating the grayscale means of the target areas, a total grayscale mean is obtained, and a distance measurement function is obtained based on the total grayscale mean; Based on The entropy discriminant function is obtained by calculating the entropy of each target area, and a joint discriminant function is obtained by weighted summing the entropy discriminant function and the distance measurement function based on a weight coefficient; The inverse of the joint discriminant function is used as the fitness function, and the individual positions of the artificial rabbits are updated based on the lotus law to obtain an improved artificial rabbit algorithm, and the fitness function is iteratively optimized based on the improved artificial rabbit algorithm to obtain a segmentation threshold corresponding to the minimum value of the fitness function; The segmentation thresholds are sorted to obtain a sorting sequence, and the input image is segmented in sequence according to the order of the sorting sequence.
2. The image segmentation method of the artificial rabbit search mechanism based on the lotus law according to claim 1 is characterized in that: The process of updating the individual positions of the artificial rabbits based on the lotus law to obtain the improved artificial rabbit algorithm includes: Initialize the position of each rabbit in the artificial rabbit population, and use the inverse of the joint discriminant function as the fitness function; Initialize the first generation Rabbit The dimension position is A random integer between , Indicates the maximum number of preset target areas. For the The upper bound of dimension, For the The lower bound of the dimension is obtained, the position of the first generation artificial rabbit individual is substituted into the fitness function as the segmentation threshold, the initial fitness function value of each artificial rabbit is obtained, and the position of the artificial rabbit individual with the smallest fitness function value in the initial population is set as the initial optimal position; The energy consumption law of rabbits is improved by using the lotus law, and the energy is used to determine whether the rabbit will enter the detour foraging stage or the random hiding stage. In the detour foraging stage, the position of the artificial rabbit is updated based on the average position of the population to obtain the first artificial rabbit individual position; in the random hiding stage, the position of the artificial rabbit is updated based on the optimal solution movement to obtain the second artificial rabbit individual position, and the updated artificial rabbit individual position is obtained based on the first artificial rabbit individual position and the second artificial rabbit individual position; The fitness function value is iterated based on the updated artificial rabbit individual position until the current iteration number reaches a preset maximum iteration number, and the updating is stopped to output the optimal position.
3. The image segmentation method of the artificial rabbit search mechanism based on the lotus law according to claim 2 is characterized in that: The mathematical expression of the energy consumption law of the rabbit is: ; in, For the The energy of the prey at the iteration, , , It is in The selected A random number between When the rabbit enters the detour foraging stage, otherwise the rabbit enters the random hiding stage. Indicates the preset maximum number of iterations, Indicates the current iteration number.
4. The image segmentation method of artificial rabbit search mechanism based on lotus law according to claim 2 is characterized in that: The mathematical expression of the individual position of the first artificial rabbit is: ; in, , is the walking length of the first artificial rabbit, represents the position of the first artificial rabbit individual, represents the position of the first artificial rabbit individual before updating, represents the average position of all individuals in the first artificial rabbit population, and Represents a random number between (0,1), represents random numbers that follow a standard normal distribution, and is a fixed exploration factor, Indicates the current iteration number, Indicates the preset maximum number of iterations, Indicates the floor symbol; The mathematical expression of the second artificial rabbit individual position is: ; in, , ; in, Indicates The individual position of the second artificial rabbit in the iteration, , and express A random number between Indicates The position of the second artificial rabbit in the iteration, Indicates the maximum number of preset target areas. Indicates that the The location of the optimal solution of the iteration, The second artificial rabbit A cave, for Any integer in , Indicates the round-up symbol.
5. The image segmentation method of artificial rabbit search mechanism based on lotus law according to claim 1 is characterized in that: Based on the gray value of the entire image The probability of the appearance of the pixel points in the background area and the target area and The target area has a gray value of The process of calculating the probability of a pixel point includes: The probability of the pixel appearing is: ; in, Indicates that the gray value in the entire image is The probability of a pixel appearing is Indicates the gray value is The number of pixels, Indicates the number of all pixels in the entire picture; No. The target area has a gray value of The probability of a pixel is: ; in, Indicates The target area has a gray value of The probability of a pixel is Indicates pixel segmentation threshold components, Indicates pixel segmentation threshold components, ; No. The target area has a gray value of The probability of a pixel is: ; in, Indicates The target area has a gray value of The probability of a pixel is Indicates the upper limit of the gray level value. Indicates Pixel segmentation threshold component.
6. The image segmentation method of artificial rabbit search mechanism based on lotus law according to claim 1 is characterized in that: Based on the background area, target area and The target area has a gray value of The probability of the pixel points is used to obtain the grayscale mean of the background area, the The grayscale mean of the target area and the The process of calculating the grayscale mean of a target area includes: The mathematical expression of the grayscale mean of the background area is: ; in, represents the grayscale mean of the background area, Indicates that the gray value in the background area is The probability of a pixel is represents the first pixel segmentation threshold component, Indicates the gray value size, Indicates that the gray value in the entire image is The probability of a pixel appearing; The said The mathematical expression of the grayscale mean of the target area is: ; in, Indicates The grayscale mean of the target area, Indicates The target area has a gray value of The probability of a pixel is Indicates pixel segmentation threshold components, Indicates Pixel segmentation threshold component; The said The mathematical expression of the grayscale mean of the target area is: ; in, Indicates The grayscale mean of the target area, Indicates The target area has a gray value of The probability of a pixel is Indicates the upper limit of the gray level value. Indicates Pixel segmentation threshold component; The total grayscale mean The mathematical expression is: 。 7. The image segmentation method of artificial rabbit search mechanism based on lotus law according to claim 1 is characterized in that: When obtaining the distance measurement function based on the total grayscale mean, The mathematical expression of the distance measurement function is: ; ; in, represents the distance measure function, Indicates The grayscale mean of the target area, represents the total grayscale mean, Indicates The target area has a gray value of The probability of a pixel is Indicates the upper limit of the gray level value. Represents the gray value, Indicates that the gray value in the entire image is The probability of a pixel appearing is Indicates the maximum number of preset target areas.
8. The image segmentation method of artificial rabbit search mechanism based on lotus law according to claim 1 is characterized in that: The The process of obtaining an entropy discriminant function by calculating the entropy of each target area, and obtaining a joint discriminant function by weighted summing the entropy discriminant function and the distance measurement function based on a weight coefficient includes: The entropy discriminant function The mathematical expression is: ; in, Indicates The entropy of the target area, , Indicates the maximum number of preset target areas; The joint discriminant function The mathematical expression is: ; in, and are the weight coefficients of Otsu method and maximum entropy method respectively.
9. The image segmentation method of artificial rabbit search mechanism based on lotus law according to claim 1 is characterized in that: The process of sorting the segmentation thresholds to obtain a sorting sequence, and sequentially segmenting the input image according to the order of the sorting sequence includes: The threshold obtained when the discriminant function takes the maximum value is the optimal segmentation threshold, and then all the images belonging to The grayscale value of pixels within the grayscale range is set to 0; will belong to The grayscale value of the pixel within the grayscale range is set to , is the maximum gray value of the image; The grayscale value of the pixel within the grayscale range is set to , reconstruct the image after resetting the gray value of the pixel and complete the image segmentation.
Citation Information
Patent Citations
Threshold segmentation method and system based on regional variance weight
CN114742844A
Harris eagle mechanism image segmentation method based on bamboo law and entropy
CN115937493A
Eagle search mechanism image segmentation method and system based on population entropy and catkin drift operator
CN118096808A