An efficient adaptive multi-threshold image segmentation method

By filtering candidate thresholds based on the valley characteristics of the image histogram and transforming the threshold search into a matrix search, combined with dynamic programming and divide-and-conquer algorithms, the problems of manually specifying the number of classes and large search space in existing technologies are solved, and efficient adaptive multi-threshold image segmentation is achieved.

CN118967733BActive Publication Date: 2026-11-17CHONGQING UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410985980.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-23
Publication Date
2026-11-17
Estimated Expiration
2044-07-23

AI Technical Summary

Technical Problem

Existing threshold segmentation methods require manual specification of a fixed number of threshold segmentation classes, and the threshold search space is large, resulting in high computational complexity and insufficient real-time performance.

Method used

Based on the valley characteristics of image histograms, candidate thresholds are selected. By combining dynamic programming and divide-and-conquer algorithms, the threshold search problem is transformed into a matrix search problem. The SMAWK algorithm is used to reduce the time complexity, thereby achieving adaptive multi-threshold image segmentation.

Benefits of technology

It effectively reduces the threshold search space, improves segmentation efficiency and accuracy, achieves the global optimal threshold with low time complexity, solves the problem of manually specifying the number of classes, and realizes adaptive segmentation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118967733B_ABST
    Figure CN118967733B_ABST
Patent Text Reader

Abstract

This invention provides an efficient adaptive multi-threshold image segmentation method. It includes filtering image gray levels by utilizing the characteristic that segmentation thresholds typically appear at the valleys of the image histogram, thus narrowing the threshold search space and confining it to the valley range. Based on this narrowed threshold search space, the threshold search problem, which would normally be solved using dynamic programming and divide-and-conquer algorithms, is transformed into a matrix search problem. The SMAWK algorithm is then used to reduce the matrix search time complexity to linear time complexity. A global search is performed within the narrowed threshold search space for different numbers of thresholds to determine the globally optimal number of thresholds and the corresponding optimal thresholds. This effectively avoids manually specifying the number of segmentation classes beforehand, achieving adaptive segmentation. This invention effectively reduces the threshold search space and search complexity, improving the feasibility and applicability of threshold segmentation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image segmentation technology, and specifically to an efficient adaptive multi-threshold image segmentation method. Background Technology

[0002] Image segmentation, a key technology in computer vision, aims to divide an image into non-overlapping regions based on various features such as grayscale value, spatial texture complexity, and geometric shape. These features exhibit consistency or similarity within the same region, while showing significant differences between different regions.

[0003] Thresholding segmentation, a classic method, classifies image pixels into different regions by determining one or more pixel values ​​as thresholds. The OTSU method (also known as the maximum inter-class variance method) is a representative example, widely used and achieving outstanding segmentation results among various thresholding methods. As the application scope of thresholding segmentation expands, the requirements for segmentation quality also increase. To address this, researchers have proposed various improvement methods, such as the neighborhood valley emphasis method proposed by Fan et al., which considers not only the threshold but also the neighborhood information surrounding the threshold; and Xing et al., which proposed using a modified valley value metric based on the second derivative to improve the OTSU algorithm. However, when dealing with multi-class segmentation problems, OTSU's computation time increases exponentially with the number of gray levels and classes because it uses an exhaustive threshold search. To address the computational time cost issue, Liao et al. proposed an optimized inter-class variance criterion; Xu et al., based on the property that the OTSU threshold equals the average of the average levels of the two classes it divides, limited the search range of gray levels and proposed an improved OTSU algorithm; Huang et al. proposed the TSMO method, which significantly reduces the number of iterations required to calculate the inter-class variance of the image, thereby improving the efficiency of OTSU; Wang et al. simplified Tsallis entropy and Redyi entropy, thus reducing computational time overhead; and Merzban et al., combining dynamic programming algorithms, provided an effective solution for multi-threshold segmentation. Threshold segmentation also has wide applications in specific image domains. For example, Maciel et al. proposed the SWOT method by combining histograms of different parts for independent threshold estimation, which is used to segment pigmented skin lesions in images; Fan et al., based on the characteristics of aquatic plant images on pond surfaces, proposed an improved OTSU method based on a combination of hue and saturation components.

[0004] In recent years, to reduce the computational complexity and time cost of image thresholding, researchers have combined heuristic algorithms for threshold search, resulting in a plethora of methods such as Multiverse of Elements (MVO), Flower Pollination (FP), Gray Wolf Optimization (GWO), Whale Optimization (WOA), Genetic Algorithm (GA), Harmony Search (HS), Wind Optimization (WDO0), and Ant Colony Optimization (ACO). While these methods have achieved some success in improving segmentation efficiency, their real-time performance still needs improvement. Furthermore, they are prone to getting trapped in local optima and require manual selection of the number of segmentation classes, failing to achieve the goal of adaptive segmentation.

[0005] The method proposed by Luessi et al. aims to obtain a globally optimal solution, using the DP (dynamic programming) algorithm and the SMAWK algorithm to find M-1 optimal thresholds in the interval [1,L] (where L is the image gray level and M is the number of segmentation classes). However, the inventors of this application have found through research that this method still requires manually specifying a fixed number of threshold segmentation classes, i.e., the number of thresholds, and the threshold search space is still relatively large. Summary of the Invention

[0006] To address the technical problems of existing threshold segmentation methods, which typically require manually specifying a fixed number of threshold segmentation classes for image segmentation and still have a large threshold search space, this invention provides an efficient adaptive multi-threshold image segmentation method based on the valley characteristics of image histograms and global optimization.

[0007] To solve the above-mentioned technical problems, the present invention adopts the following technical solution:

[0008] An efficient adaptive multi-threshold image segmentation method includes the following steps:

[0009] S1. By utilizing the characteristic that the segmentation threshold usually appears at the bottom of the image histogram, the image gray levels are filtered to select candidate thresholds from the image gray levels, thereby narrowing the threshold search space and limiting the threshold search space to the valley range, so as to reduce computational complexity and improve search efficiency.

[0010] S2. Based on the threshold search space that is narrowed down and restricted to the trough range, the threshold search problem that is solved by dynamic programming and divide-and-conquer algorithms is transformed into a matrix search problem, that is, the problem of finding the maximum value of a matrix row. The SMAWK algorithm is combined to reduce the time complexity of matrix search to the linear time complexity level, thereby further improving the effectiveness of segmentation and the efficiency of the algorithm.

[0011] S3. Perform a global search for different numbers of thresholds within the narrowed threshold search space to determine the global optimal number of thresholds and the corresponding optimal thresholds. This effectively avoids manually specifying the number of threshold segmentation classes or the optimal number of thresholds in advance, thereby achieving adaptive segmentation.

[0012] Furthermore, in step S1, the process of selecting candidate thresholds from image grayscale levels by utilizing the characteristic that segmentation thresholds typically appear at the bottom of the image histogram specifically includes:

[0013] First, calculate the valley metric function value valley(x) according to the defined valley metric function. Then, sort the points valley(x) > 0 from largest to smallest. The valley metric function is defined as follows:

[0014] valley(x)=(p[x-Δ]-p[x])+(p[x+Δ]-p[x])

[0015] Where x is the image brightness value, p(·) is the probability of the corresponding brightness value, and Δ is the window size for calculating the difference;

[0016] Then, the portion of valley(x) > 0 is denoted as set S. The top k brightness values ​​in set S are selected from largest to smallest as candidate threshold space denoted as Ω, where Ω = top{S,k}.

[0017] Furthermore, in step S2, the threshold search problem solved using dynamic programming and divide-and-conquer algorithms is transformed into a matrix search problem. The resulting matrix is ​​represented in the following form:

[0018]

[0019] Where x∈{k,k+1,…,k+LM} represents the starting brightness value; y∈{k,k+1,…,k+LM} represents the ending brightness value; L k The value represents the maximum value in the previous stage; l(y+k-1,x+k) represents the cost between pixel y+k-1 and the brightness value x+k.

[0020] Furthermore, in step S3, the optimal number of segmentation classes, i.e., the number of globally optimal thresholds, is calculated by defining the following global class number metric function O(M):

[0021]

[0022] in, For the valley emphasis term, M represents the number of distinct segmentation classes. Indicates brightness value The probability, L M (t M ) represents the total value of each M.

[0023] Compared with existing technologies, the efficient adaptive multi-threshold image segmentation method provided by this invention has the following advantages:

[0024] 1. By using valley screening, the search range for the threshold is narrowed from the entire gray level to the possible gray levels, which effectively reduces the threshold search space and the complexity of the search.

[0025] 2. The threshold search problem is transformed into a matrix search problem. The matrix properties are used for efficient searching, which further improves the efficiency of segmentation and ensures the accuracy and speed of finding the optimal threshold in the threshold search space.

[0026] 3. By performing a global threshold count search in the candidate threshold space, the optimal global threshold count is determined, thereby achieving adaptive segmentation.

[0027] 4. The proposed algorithm can obtain the globally optimal threshold with low time complexity. The selected threshold can effectively segment the image and has a fast running speed, thus significantly alleviating the dilemma of threshold segmentation speed. Attached Figure Description

[0028] Figure 1 This is a schematic diagram of the efficient adaptive multi-threshold image segmentation method provided by the present invention.

[0029] Figure 2 This is a histogram grayscale change state diagram provided by the present invention.

[0030] Figure 3 This is the possible path diagram for the k-th stage provided by the present invention.

[0031] Figure 4 This is an example diagram of the 9×9 matrix Reduce process provided by the present invention.

[0032] Figure 5 This is an example diagram provided by the present invention, which shows how to determine the maximum value of odd rows sequentially from even rows.

[0033] Figure 6 These are the adaptation values ​​of the eight images provided by this invention under different thresholds. Detailed Implementation

[0034] To make the technical means, creative features, objectives and effects of this invention easier to understand, the invention will be further described below with reference to specific illustrations.

[0035] Please refer to Figure 1 As shown, this invention provides an efficient adaptive multi-threshold image segmentation method, comprising the following steps:

[0036] S1. The inventors of this application discovered through research and analysis that valleys correspond to the boundaries of different categories in an image. Therefore, this invention uses valley screening to limit the threshold search space to a smaller range for screening. Specifically, it utilizes the characteristic that the segmentation threshold usually appears at the valley of the image histogram to screen the image gray levels, thereby selecting candidate thresholds from the image gray levels, thus narrowing the threshold search space and limiting the threshold search space to the valley range, thereby reducing computational complexity and improving search efficiency.

[0037] S2. Based on the threshold search space that is narrowed down and restricted to the trough range, the threshold search problem that is solved by dynamic programming (DP) and divide-and-conquer algorithm is transformed into a matrix search problem, that is, the problem of finding the maximum value of the row of the matrix. The SMAWK algorithm is combined to reduce the time complexity of matrix search to the linear time complexity level, thereby further improving the effectiveness of segmentation and the efficiency of the algorithm.

[0038] S3. Perform a global search for different numbers of thresholds within the narrowed threshold search space to determine the global optimal number of thresholds and the corresponding optimal thresholds. This effectively avoids manually specifying the number of threshold segmentation classes or the optimal number of thresholds in advance, thereby achieving adaptive segmentation.

[0039] In detail, in the thresholding segmentation method, the threshold is chosen to achieve clear segmentation of foreground objects and background in an image. According to the inventors' analysis, the threshold typically appears at the valleys of the histogram. This is because the valleys of the histogram are located in gray-level ranges with fewer pixels, and these valleys usually correspond to transition areas between two different categories in the image. Therefore, the valleys can be used to segment the image. In image segmentation, these gray levels may precisely correspond to the boundary between background or foreground pixels in the image. Therefore, based on the above analysis, this invention can utilize valleys to separate different categories, thereby completing the segmentation task.

[0040] Between-class variance measures the difference between different classes, and the OTSU method determines the optimal threshold by calculating the maximum between-class variance. In other words, the larger the between-class variance, the greater the difference between the two segments, and the better the segmentation result. This difference can be intuitively mapped to the valley in the histogram, i.e., the transition region between the two classes. In the OTSU method, the transition region between two peaks in the histogram, i.e., the valley, is found by maximizing the between-class variance, and the gray value corresponding to this position is one of the choices for the optimal threshold. As the above analysis shows, the optimal threshold is often located at the valley, thus limiting the threshold search space to the valley range.

[0041] However, noise causes numerous local fluctuations in the histogram, increasing the complexity of the threshold search. To reduce the impact of small troughs in the histogram and effectively determine their locations, a local weighted mean filter is applied. Histogram smoothing aims to further eliminate unnecessary spikes or isolated noise points caused by noise, making the histogram more continuous and smooth. This process effectively suppresses the interference of local noise on the search, helps determine significant trough locations, and thus improves search efficiency.

[0042] In a specific embodiment, step S1, which utilizes the characteristic that the segmentation threshold usually appears at the bottom of the image histogram to select candidate thresholds from the image grayscale levels, specifically includes:

[0043] Traditional thresholding segmentation selects a threshold from the total gray levels L of the image, typically L = 256. However, not all 256 pixel values ​​are useful for the segmentation process. Based on the above analysis, the threshold mostly appears at the valleys of the image histogram; this characteristic can be used to filter gray levels. This invention categorizes histogram gray level changes into four states based on the relationship between the pixel's neighbor values ​​and the histogram: rising state, falling state, maximum state, and valley state. To filter candidate thresholds, this invention defines the following valley metric function:

[0044] valley(x)=(p[x-Δ]-p[x])+(p[x+Δ]-p[x])

[0045] Where x is the image brightness value, p(·) is the probability of the corresponding brightness value, and Δ is the window size for calculating the difference. In this invention, Δ = 1.

[0046] like Figure 2 The diagram illustrates four states of grayscale variation in the histogram. In the rising and falling states, `valley(i)` and `valley(j)` are both sums of a negative and a positive number. Since the negative value cancels out some of the positive value, the trough metric function in these two cases is generally close to zero. The third state is the peak state, where `valley(k)` < 0. The fourth state is the trough state, where `valley(l)` is positive. Analysis of the trough metric functions for the four states reveals that the trough metric function corresponding to a trough is always greater than zero, while the trough metric function corresponding to a peak is always less than zero. The trough metric functions for the rising and falling states can be either negative or positive.

[0047] Based on the above analysis, the magnitude relationship of the measurement functions in these four cases is generally as follows:

[0048] valley(k)<{valley(i),valley(j)}<valley(l)

[0049] Therefore, when valley(x) > 0, the larger the value, the more obvious the corresponding valley, while valley(x) < 0 is definitely not the bottom of the valley. To more accurately determine the candidate threshold range, the brightness values ​​corresponding to smaller valley(x) will not be considered, because the probability of these brightness values ​​being the bottom of the valley is very small. Therefore, this invention first calculates the valley metric function value valley(x) according to the defined valley metric function, and sorts the points valley(x) > 0 from largest to smallest; then, the part of valley(x) > 0 is denoted as set S, and the top k brightness values ​​in set S are selected from largest to smallest as the candidate threshold space denoted as Ω, Ω = top{S,k}.

[0050] As a specific embodiment, step S2, which combines the SMAWK algorithm to reduce the matrix search time complexity to the linear time complexity level, includes:

[0051] For an image, the total gray levels are L, i is the gray value, N is the total number of pixels in the image, and n is the number of pixels in the image. i Let p be the number of all pixels with a grayscale value of i, and p be the probability of grayscale value i occurring. i Represented as:

[0052]

[0053] Given a threshold {t1, t2, ..., t M-1 The image is segmented into M classes {C1, C2, ..., C}. M}, where C k ∈{t k-1 ,…,t k}(k∈{1,2,…,M}), where t0=0, t M =L,C k Class probability ω k and class mean μ k Calculated by the following formula:

[0054]

[0055]

[0056] Considering the existence of the following formula:

[0057]

[0058]

[0059] The inter-class variance function with multiple thresholds can be rearranged as follows:

[0060]

[0061] Because μ T It is a constant, so it can be written as Then the optimal threshold It can be obtained from the following formula:

[0062]

[0063] Calculate and store the required data in advance, that is:

[0064]

[0065]

[0066] Where u is the starting brightness value and v is the ending brightness value;

[0067] Therefore, L(t1,t2,…,t) can be defined as follows: M-1 Let D(u,v) and N(u,v) represent this as follows:

[0068]

[0069] in,

[0070] Liao et al. proposed a recursive algorithm to solve the multi-threshold segmentation problem, but the time complexity of this method is still O(LM). (M-1) The computational complexity is quite high. Considering that the OTSU objective function first calculates the class cost of each small segment and finally finds the maximum total cost over the interval [1,L], this problem can be broken down into sub-intervals. The maximum and minimum values ​​are then calculated within each sub-interval, with each sub-interval's maximum and minimum value calculated based on the previous stage's maximum and minimum value. Therefore, a dynamic programming algorithm can be used to search for the threshold, transforming the multi-threshold search problem into finding the maximum class cost for each sub-interval, denoted as L. M (t M ) is the interval [0, t M The maximum total cost within [ ] is given by the following transition equation:

[0071]

[0072] Therefore, the optimal threshold {t1,t2,…,t} M-1 This can be obtained using a dynamic programming algorithm:

[0073]

[0074] Using dynamic programming accelerates the search for the threshold, reducing the time complexity to O(ML). 2 However, the time complexity still increases exponentially with the increase of image gray levels and number of classes, and the real-time performance still needs to be improved.

[0075] In the process of searching for the threshold, the dynamic programming algorithm calculates the maximum cost of the k-th stage based on the maximum cost of all stages up to k. For example... Figure 3 As shown, the maximum cost is found among all possible costs. These possible costs are represented as a (L-M+1)×(L-M+1) matrix. Finding the maximum cost within an interval is equivalent to finding the maximum value in the corresponding row of this matrix. Therefore, the threshold search problem can be transformed into a matrix search problem. Thus, in a specific embodiment, step S2 transforms the threshold search problem, which utilizes dynamic programming and divide-and-conquer algorithms, into a matrix search problem. The resulting matrix is ​​represented in the following form:

[0076]

[0077] Where x∈{k,k+1,…,k+LM} represents the starting brightness value; y∈{k,k+1,…,k+LM} represents the ending brightness value; L k This represents the maximum value in the previous stage; l(y+k-1,x+k) represents the cost between pixel y+k-1 and the brightness value x+k. Because 0 < t1 < ... t M If the value is less than L, then there is no cost from a node to a node with a smaller value, so matrix A is a lower triangular matrix.

[0078] Conventionally, searching this matrix involves comparing all row elements to find the maximum value in a row. For example, in dynamic programming, nested loops are used to compare each row element to find the maximum value. Analysis of the objective function reveals that it possesses certain properties that can reduce the search range of the matrix. Assume the cost function l(t) k ,t k+1 It has the following relationship:

[0079] l(a,c)+l(b,d)≥l(a,d)+l(b,c)

[0080] If 1 ≤ a < b < c < d ≤ L, then the cost function is said to satisfy the quadrilateral inequality. It can be verified that if l(a,c) < l(b,c), then l(b,d) > l(a,d); and if l(a,d) > l(b,d), then l(a,c) > l(b,c). Therefore, for both of these cases, l(a,d) and l(b,c) cannot be the maximum values, thus effectively avoiding the calculation of these two cost values. If the class cost function of the interval transition equation in dynamic programming satisfies this property, then the matrix composed of class costs also satisfies the quadrilateral inequality.

[0081] A[x1,y1]+A[x2,y2]≥A[x1,y2]+A[x2,y1]

[0082] Where 1 ≤ x1 < x2 < y1 < y2 ≤ L, when A[x1,y1] < A[x2,y1], we can obtain A[x2,y2] > A[x1,y2]; when A[x1,y2] > A[x2,y2], we can obtain A[x1,y1] > A[x2,y1], and every submatrix of the matrix satisfies this inequality relationship. Similarly, we can conclude that A[x1,y2] and A[x2,y1] cannot be the row maximum values.

[0083] The SMAWK algorithm effectively utilizes the property that matrices and their submatrices satisfy the quadrilateral inequality to process matrix elements, thereby reducing the time complexity of matrix search. In this algorithm, based on the quadrilateral inequality, two cases are handled for matrix columns.

[0084] 1. When A(r,j1)>A(r,j2), the inequality A(r-1,j1)+A(r,j2)>A(r-1,j2)+A(r,j1) gives A(r-1,j1)<A(r-1,j2); further, the inequality A(r-2,j1)+A(r-1,j2)>A(r-2,j2)+A(r-1,j1) gives A(r-2,j1)>A(r-2,j2). Similarly, we can obtain A(r-3,j1)>A(r-3,j2), A(r-4,j1)>A(r-4,j2), ..., A(1,j1)>A(1,j2). Therefore, it can be determined that the values ​​from row 1 to row r in column j2 are not the maximum values ​​of the corresponding rows. If column j2 cannot be the maximum value of the corresponding row when r = m, then there is no need to calculate and compare the elements of column j2.

[0085] 2. When A(r,j1) < A(r,j2), the inequality A(r,j1) + A(r+1,j2) < A(r,j2) + A(r+1,j1) yields A(r+1,j1) < A(r+1,j2). Similarly, we can obtain A(r+2,j1) < A(r+2,j2), A(r+3,j1) > A(r+3,j2), ..., A(m,j1) < A(m,j2). Therefore, when r = 1, we can determine that column j1 is not the maximum value of the matrix. Since A is a lower triangular matrix, we compare downwards from the top left corner in a stepwise manner. When A(r,j1) < A(r,j2), because the comparisons at the upper levels have reached the r-th level, even if r > 1, column j1 will definitely not be the maximum value of the corresponding row, thus avoiding the calculation and comparison of column j1.

[0086] By processing the matrix at each stage through the above process, the search space can be effectively reduced, useless searches can be avoided, and thus search efficiency can be improved. This process is named the REDUCE operation.

[0087] Let's illustrate the matrix search process with a detailed example. Assume L = 14, M = 6, resulting in a 9×9 cost matrix. Using a divide-and-conquer approach, the matrix is ​​divided into two submatrices: one containing only even-numbered rows and the other containing only odd-numbered rows. Utilizing the two properties of the quadrilateral inequality mentioned above, we only need to recursively process the even-numbered rows using the REDUCE operation, while the maximum row value of the odd-numbered row submatrix is ​​determined by the position of the maximum value in the even-numbered rows. For example... Figure 4 As shown, the even-numbered rows of the matrix 9 = 9 are taken as the submatrix to be processed. Using the `REDUCE` operation, a 4×4 square matrix is ​​obtained. Further partitioning this 4×4 matrix into its even-numbered rows results in the next stage of processing, and performing another `REDUCE` operation on this submatrix yields a 2×2 submatrix. Finally, partitioning this 2×2 submatrix results in a 1×1 square matrix, where the corresponding element is the maximum value.

[0088] Next, by backtracking and utilizing the position of the maximum value in the even-row submatrix and two properties of matrix search, we can determine the possible range of the maximum value in the odd-row submatrix of the previous level, and thus determine the maximum value in the odd-row. For example... Figure 5 As shown, the range of maximum values ​​in the odd-numbered rows of the 2×2 matrix (marked in blue) can be determined by the two properties of matrix search and the position of the maximum value in the eighth row (marked in yellow). Then, by comparing the elements in the blue part, the maximum value of the odd-numbered rows can be determined. Backtracking this 2×2 matrix to the 4×4 matrix of the previous stage, the range of maximum values ​​in the odd-numbered rows (marked in blue) can be determined by identifying the maximum and minimum values ​​of the even-numbered rows (marked in yellow), thus obtaining the maximum value of the odd-numbered rows. This process continues, backtracking step by step to determine the maximum value of the odd-numbered rows in the previous submatrix, until the maximum value of all rows is determined.

[0089] The cost matrix avoids calculating a large number of elements that are unlikely to be maximum values ​​by using the REDUCE operation. Then, by returning the result of each REDUCE operation to determine the range of odd rows of the corresponding submatrix, the search efficiency is further improved.

[0090] Many previous thresholding segmentation methods require manually specifying the number of segmentation classes for image segmentation, which fails to achieve adaptability. To address this issue, this paper proposes a global search within a reduced search space to find the optimal number of segmentation classes. Building upon the reduced search space and improved search efficiency, L is calculated using different numbers of classes M (M∈{2, 3, ..., |Ω|) within the reduced search space. M (t M Each M corresponds to a segmentation threshold {t1, t2, ..., t}. M-1} and the value of the general agent L M (t MTo determine the optimal number of segmentation classes, a global class number metric function O(M) is defined, and O(M) is calculated for different numbers of classes. Specifically, in step S3, the optimal number of segmentation classes, i.e., the number of global optimal thresholds, is calculated by defining the following global class number metric function O(M):

[0091]

[0092] in, For the valley emphasis term, M represents the number of distinct segmentation classes. Indicates brightness value The probability, L M (t M Let M represent the total generation value corresponding to each M. Since thresholds often occur at valleys, the valley emphasis term becomes larger when calculating the threshold, thus increasing the cost. A global search is performed on each M within the search space Ω, selecting the class number M corresponding to the maximum O(M). * This method effectively solves the problem of manually specifying the threshold for the number of segmentation classes, while ensuring the accuracy and reliability of the segmentation results. Based on the method described above, this application proposes this invention, abbreviated as AdaOstu, by reducing the search space and quickly performing a global search for the optimal number of segmentation classes.

[0093] This invention was implemented in Visual Studio (2022), and experiments were conducted on a computer running Microsoft Windows 11 with an 11th generation Intel Core i5-10500 3.10GHz CPU and 8GB RAM. To verify the efficiency and adaptability of the algorithm, this invention will be experimentally compared with algorithms such as DP+AMasi, HGJO, HHO, CS, ABC, and PSO on the BSDS500 dataset.

[0094] Furthermore, this application conducted comparative experiments on the exhaustive search threshold algorithm and the method of this invention. Under the experimental conditions and the limitations of the exhaustive method, when the threshold number exceeds five, the exhaustive algorithm consumes a significant amount of time and cannot operate normally. Therefore, the performance of the two methods was compared only when the threshold number is less than five.

[0095] The parameters of algorithms such as DP+AMasi, HGJO, HHO, CS, ABC, and PSO are shown in Table 1.

[0096] Table 1 Parameter Settings

[0097] algorithm parameter value HGJO Pop.N 30 HHO Pop.N 30 CS Pop.N 30 Abandon probability 0.25 Step size 1 Scale factor 1.5 ABC Pop.N 30 Limit Parameter 0.6 Damping Ratio 1 PSO Pop.N 30 Inertia Weight 1 Damping Ratio 0.99 Personal Lrn.Coe 1.5 Global Lrn.Coef 2

[0098] To verify the segmentation performance of the algorithm of this invention, experimental testing will be conducted on the following test data:

[0099] (1) Berkeley Segmentation Dataset and Benchmark 500 (BSDS500), which contains 500 images of size 481×321.

[0100] (2) Commonly used images (cameraman, Lena, Baboon, Pirate, Jetplane, Peppers, LivingRoom, and Butterfly). Histogram analysis can reveal differences in intensity between different grayscale images, which contributes to the comprehensiveness and accuracy of experimental results.

[0101] PSNR (Peak Signal-to-Noise Ratio) is a widely used metric in image processing. It is used to evaluate how well a segmented image matches a standard segmentation. A higher PSNR value indicates better segmentation quality. UM (Uniformity Measure) primarily measures the uniformity of pixels within each region of the segmentation result. A higher UM indicates a more uniform segmentation result with smaller differences in pixel values; a lower UM indicates a less uniform segmentation result with larger differences in pixel values. RI (Rand Index) is a metric used to evaluate the performance of segmentation algorithms. It measures the similarity between the segmentation results of two datasets and is typically used to compare the similarity between the segmentation result and a known standard segmentation (i.e., the ground truth).

[0102] Table 2 presents a comparison of the average UM values ​​for the seven methods under different threshold numbers (n).

[0103] Table 2. Average UM of different methods on BSDS500

[0104] AdaOtsu(n) DP+AMasi HGJO HHO CS ABC PSO n=1 0.97595 0.96545 0.97585 0.97261 0.96582 0.96406 0.96545 n=2 0.97825 0.96733 0.97813 0.97326 0.96795 0.96604 0.96738 n=3 0.98135 0.97161 0.98129 0.97648 0.97199 0.96961 0.97195 n=4 0.98404 0.97565 0.98399 0.97922 0.97626 0.97230 0.97605 n=5 <![CDATA[0.98589 2 ]]> 0.97864 0.98602 0.98165 0.97962 0.97517 0.97955 n=6 0.98756 0.98148 0.98747 0.98343 0.98214 0.97774 0.98233 n=7 0.98894 0.98370 0.98886 0.98496 0.98382 0.97896 0.98427 n=8 <![CDATA[0.98987 2 ]]> 0.98537 0.98993 0.98599 0.98542 0.97998 0.98574 n=9 <![CDATA[0.99066 2 ]]> 0.98662 0.99078 0.98710 0.98654 0.98124 0.98704 n=10 0.99186 0.98766 0.99151 0.98810 0.98725 0.98319 0.98803

[0105] In the table above, AdaOstu achieved optimal performance in almost all cases, particularly between n=2 and n=7, maintaining its leading position. The HGJO algorithm performed similarly to AdaOstu, achieving its best performance at n=5, 8, and 9. Other algorithms such as DP+AMasi, HHO, CS, ABC, and PSO showed stable performance but no significant lead. Overall, the AdaOstu algorithm exhibited good performance under the UM metric.

[0106] Table 3 presents a comparison of the average RI values ​​for the seven methods under different threshold numbers (n).

[0107] Table 3. Average RI of different methods on BSDS500

[0108] AdaOtsu(n) DP+AMasi HGJO HHO CS ABC PSO n=1 <![CDATA[0.7371 2 ]]> 0.6567 0.7359 0.7452 0.6265 0.6351 0.5870 n=2 0.7990 0.7510 0.7875 0.7904 0.7433 0.7432 0.7424 n=3 0.8076 0.7794 0.7969 0.7995 0.7727 0.7819 0.7748 n=4 0.8036 0.7893 0.7986 0.8008 0.7869 0.7910 0.7871 n=5 <![CDATA[0.8004 2 ]]> 0.7916 0.7871 0.8011 0.7915 0.7952 0.7929 n=6 0.7996 0.7946 0.7948 0.7996 0.7931 0.7990 0.7927 n=7 <![CDATA[0.7986 3 ]]> 0.7938 0.7936 0.7989 0.7948 0.7999 0.7949 n=8 <![CDATA[0.7979 2 ]]> 0.7930 0.7930 0.7976 0.7957 0.8015 0.7967 n=9 <![CDATA[0.7972 2 ]]> 0.7927 0.7922 0.7961 0.7959 0.7995 0.7966 n=10 0.7964 0.7923 0.7913 0.7954 0.7955 0.7948 0.7955

[0109] In most cases, the AdaOstu algorithm performs well, especially reaching its best performance when n=2, 3, 4, 6, and n=10. In other cases, AdaOstu performs relatively well, but not optimally. In contrast, DP+AMasi consistently performs worse than AdaOstu, without a clear best performance; its performance is relatively stable but lacks a significant advantage. HHO is comparable to AdaOstu and DP+AMasi, but slightly worse in most cases. At n=6, HHO is tied for best with AdaOstu. The HGJO, CS, ABC, and PSO algorithms perform relatively similarly, without a clear best performance. CS and PSO slightly outperform HHO and ABC in some cases, but the difference is not significant.

[0110] Table 4 presents a comparison of the average PSNR values ​​for the seven methods under different threshold numbers (n).

[0111] Table 4. Average PSNR of different methods on BSDS500

[0112] AdaOtsu(n) DP+AMasi HGJO HHO CS ABC PSO n=1 18.3100 17.9611 18.2867 18.3032 18.0007 17.9522 18.1481 n=2 18.2280 17.8556 17.943 17.9527 17.8361 17.8241 17.8819 n=3 18.2615 17.8556 17.8585 17.9059 17.7404 17.7337 17.7591 n=4 18.2764 17.7873 17.8183 17.8565 17.7026 17.7236 17.7316 n=5 18.2926 17.7587 17.8109 17.8259 17.6913 17.7745 17.6982 n=6 18.2866 17.7768 17.7784 17.8089 17.7058 17.7692 17.7046 n=7 18.2835 17.7602 17.7629 17.7895 17.7127 17.7796 17.7075 n=8 18.2761 17.7784 17.7529 17.7781 17.6907 17.7849 17.7206 n=9 18.2741 17.7646 17.7416 17.7641 17.7162 17.7759 17.7152 n=10 18.2576 17.7562 17.7309 17.7513 17.7104 17.6169 17.7158

[0113] In the table above, AdaOstu exhibits the highest and most stable average PSNR value for all n values, demonstrating superior performance. DP+AMasi shows relatively lower average PSNR values ​​for all values, lagging behind AdaOstu. The HGJO algorithm maintains a stable average PSNR value at a mid-to-high level, but is slightly lower overall than AdaOstu and DP+AMasi. HHO, CS, ABC, and PSO show relatively stable average PSNR values, but are generally slightly lower than the aforementioned methods.

[0114] In conclusion, AdaOstu performed exceptionally well in this experiment, significantly outperforming other algorithms across various threshold values, especially at higher threshold values. DP+AMasi, HGJO, and other algorithms showed varying performance within their respective threshold value ranges, but overall, they were slightly inferior to AdaOstu.

[0115] Furthermore, Table 5 compares the average running time of different algorithms and AdaOstu on the BSDS500 dataset. Compared to DP+AMasi, AdaOstu's running time shows little difference under different threshold numbers. However, as the number of thresholds increases, the running time of DP+AMasi slows down, while the running time of AdaOstu tends to stabilize. In contrast, the running speeds of the five methods, including CS and ABC, are relatively slow. Table 6 presents the performance metrics obtained after adaptive segmentation of the benchmark images in the BSDS500 database. Each image was segmented using the optimal number of segmentation classes, and the maximum number of thresholds in all image segmentation results was n=7. It can be seen that the obtained UM, RI, and PSNR are mostly higher than the values ​​obtained by other methods between n=1 and n=7, indicating that the method has good robustness and segmentation performance. The overall average running time is shorter than the running time of all the compared methods, further demonstrating the efficiency of this invention in the threshold search process.

[0116] Table 5. Average CPU run time (s) on BSDS500 for different methods

[0117] AdaOtsu(n) DP+AMasi HGJO HHO CS ABC PSO n=1 0.0056 0.0073 0.717086443 0.0300 4.1219 2.9910 3.3877 n=2 0.0058 0.0108 0.86941662 0.0366 4.5493 3.4062 3.8441 n=3 0.0059 0.0139 0.935560929 0.0381 4.9311 3.6928 4.2738 n=4 0.0058 0.0171 0.993279858 0.0388 5.3857 4.0126 4.7415 n=5 0.0064 0.0205 1.08808383 0.0392 5.9873 4.3535 5.1692 n=6 0.0052 0.0237 1.159750087 0.0399 6.2804 4.5596 5.6429 n=7 0.0067 0.0273 1.233269692 0.0402 6.6915 4.7796 6.0415 n=8 0.0058 0.0307 1.30569753 0.0415 7.4434 5.1907 6.5628 n=9 0.0058 0.0346 1.375768996 0.0422 7.8829 5.5303 7.0293 n=10 0.0060 0.0379 1.449395135 0.0430 8.3497 6.3264 7.4992

[0118] Table 6 shows the average UM, PSNR, RI, and CPU run time (s) of AdaOstu on BSDS500.

[0119] index value UM 0.98260 PSNR 18.2347 RI 0.8075 CPU run time (s) 0.0112

[0120] Figure 6 The figure shows the fitness values ​​of eight images under different thresholds. It can be seen from the figure that each image has a maximum fitness value, and the number of thresholds corresponding to this maximum value is the optimal threshold number. After determining the optimal threshold number using the algorithm of this invention, the number of segmentation classes under the exhaustive method is specified. Table 7 provides the optimal thresholds obtained by these two methods on eight images and the corresponding CPU running time. Analysis of the results in Table 7 shows that the thresholds obtained by the algorithm of this invention are very close to those of the recursive exhaustive method, and the running time of this invention is significantly less than that of the exhaustive method. This indicates that this invention has high efficiency and accuracy in threshold selection, providing a more optimized option for image processing.

[0121] Table 7 Optimal Thresholds and CPU Run Time for AdaOstu and Exhaustive Search

[0122]

[0123] Overall, the method proposed in this invention demonstrates comprehensive superiority across multiple image processing tasks, excelling not only in preserving image structure and content but also in terms of runtime efficiency compared to other methods. These results strongly support the widespread application of this invention in practical image processing and provide important reference for further in-depth research and optimization of image processing algorithms. Finally, comparatively, the target segmentation extracted by the method proposed in this invention is more complete and accurate.

[0124] Compared with existing technologies, the efficient adaptive multi-threshold image segmentation method provided by this invention has the following advantages:

[0125] 1. By using valley screening, the search range for the threshold is narrowed from the entire gray level to the possible gray levels, which effectively reduces the threshold search space and the complexity of the search.

[0126] 2. The threshold search problem is transformed into a matrix search problem. The matrix properties are used for efficient searching, which further improves the efficiency of segmentation and ensures the accuracy and speed of finding the optimal threshold in the threshold search space.

[0127] 3. By performing a global threshold count search in the candidate threshold space, the optimal global threshold count is determined, thereby achieving adaptive segmentation.

[0128] 4. The proposed algorithm can obtain the globally optimal threshold with low time complexity. The selected threshold can effectively segment the image and has a fast running speed, thus significantly alleviating the dilemma of threshold segmentation speed.

[0129] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.

Claims

1. An efficient adaptive multi-threshold image segmentation method, characterized in that, Includes the following steps: S1. By utilizing the characteristic that the segmentation threshold usually appears at the bottom of the image histogram, the image gray levels are filtered to select candidate thresholds from the image gray levels, thereby narrowing the threshold search space and limiting the threshold search space to the valley range, so as to reduce computational complexity and improve search efficiency. S2. Based on the threshold search space that is narrowed down and restricted to the trough range, the threshold search problem that is solved by dynamic programming and divide-and-conquer algorithms is transformed into a matrix search problem, that is, the problem of finding the maximum value of a matrix row. The SMAWK algorithm is combined to reduce the time complexity of matrix search to the linear time complexity level, thereby further improving the effectiveness of segmentation and the efficiency of the algorithm. S3. Within the narrowed threshold search space, perform a global search for different numbers of thresholds to determine the globally optimal number of thresholds and the corresponding optimal threshold. This effectively avoids manually specifying the number of threshold segmentation classes (i.e., the optimal number of thresholds) in advance, thereby achieving adaptive segmentation. In step S1, the process of selecting candidate thresholds from image gray levels by utilizing the characteristic that segmentation thresholds typically appear at the bottom of the image histogram specifically includes: First, calculate the trough metric function value based on the defined trough metric function. For those The points are sorted from largest to smallest, and the trough metric function is defined as follows: in, It is the image brightness value. This represents the probability of the corresponding brightness value. The window size for calculating the difference; Then The part is denoted as a set In the set Select from largest to smallest The luminance values ​​are used as the candidate threshold space, denoted as . , ; In step S2, the threshold search problem, which is solved using dynamic programming and divide-and-conquer algorithms, is transformed into a matrix search problem. The resulting matrix is ​​represented in the following form: in, Indicates the starting brightness value; Indicates the brightness value at the end; This indicates the maximum value in the previous stage; Represents pixels To brightness value The cost between them; In step S3, the following global class number measurement function is defined. To calculate the optimal number of segmentation classes, i.e., the number of globally optimal thresholds: in, The emphasis is on the bottom of the valley. Indicates the number of distinct segmentation classes. Indicates brightness value The probability, Represents each The corresponding value of the master agent.