An image segmentation method based on adaptive block partitioning and probability redistribution
Through adaptive blocking and probability reallocation technology, the size and shape of the image segmentation area blocks are dynamically adjusted, and the problems of high computational complexity and small local correlation in the prior art are solved, achieving a more efficient and accurate image segmentation effect.
Patent Information
- Application Number
- CN202410663602.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-27
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2044-05-27
AI Technical Summary
In the prior art, the image segmentation method has high computational complexity, small local correlation between pixels, and it is difficult to adapt to the complexity and noise environment of the image.
The image segmentation method based on adaptive chunking and probability redistribution is adopted to dynamically adjust the size and shape of the area blocks, and resample them with color and space characteristics to improve the reliability of model parameters, and optimize the posterior probability through probability redistribution.
It improves the accuracy and consistency of image segmentation, reduces the influence of noise, and can capture the details and structure of the image more accurately, taking into account the overall statistical characteristics of the image and the local detail distribution.
Smart Images

Figure CN118628734B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to an image segmentation method based on adaptive block division and probability redistribution, and belongs to the technical field of image segmentation. Background Art
[0002] Image segmentation is a key task in the field of image processing and plays an important role in the subsequent image content analysis. Although there are a variety of image segmentation technologies, challenges in this field still exist. Unsupervised image segmentation tasks mainly rely on the visual similarity between pixels and the position correlation between adjacent pixels to determine whether the categories of pixels are the same. The clustering method based on the Gaussian mixture model using the visual similarity between pixels has shown effectiveness. On this basis, the introduction of the Markov model can well reflect the local correlation between pixels. However, from the perspective of the Bayesian method, the model still has the problem of prior probability coupling and cannot be solved directly. Iterative conditional mode (ICM) is an approximate solution method that simplifies the solution process by using the pseudo-likelihood method to approximate the target likelihood function. A coordinate descent method is used to obtain a set of optimized objective function solutions. It has the advantages of simple operation and fast convergence speed. This method has a good segmentation effect when processing images with less noise and simple texture, but it is sensitive to the selection of initial values and is not suitable for the segmentation of images with large primitive scales and strong contrast texture areas, as well as the segmentation of images with high noise. The blocking strategy can reduce ICM's sensitivity to noise and enhance local connections between pixels, but this method is a fixed division and may mistakenly divide the foreground and background into the same area, reducing the effectiveness of the model. Summary of the invention
[0003] A brief overview of the present invention is provided below in order to provide a basic understanding of certain aspects of the present invention. It should be understood that this overview is not an exhaustive overview of the present invention. It is not intended to identify key or important parts of the present invention, nor is it intended to limit the scope of the present invention. Its purpose is merely to present certain concepts in a simplified form as a prelude to a more detailed description discussed later.
[0004] In view of this, in order to solve the technical problems of high computational complexity and low local correlation between pixels in the prior art, the present invention provides an image segmentation method based on adaptive blocking and probability redistribution. The present invention is different from the existing blocking methods, such as the blocking method based on thresholds, the blocking method based on multi-scales, or the blocking method based on fixed blocking. The present invention allows pixels to adaptively select neighborhoods and resample in combination with color, space and other features, so that the prior probability and posterior probability distribution are more reasonable, which greatly improves the reliability of the model parameters.
[0005] Solution 1: An image segmentation method based on adaptive block segmentation and probability redistribution, comprising the following steps:
[0006] S1. Initialize the Gaussian mixture model parameters and the initial estimated value of the segmentation category of each pixel based on the image to be segmented and the number of segmentation categories;
[0007] S2. Use a sliding window of a fixed shape to divide the image to be segmented into fixed blocks and construct a block region likelihood matrix;
[0008] S3. Convert the image to be segmented into a grayscale image, calculate the variance within the neighborhood of each pixel, generate a matching vector for each pixel, select the region block with the minimum value in the matching vector and establish a mapping relationship and a pixel-block region likelihood matrix with the corresponding pixel;
[0009] S4, constructing a Markov random field to characterize the local correlation between pixel block categories, and obtaining the category probability of the image to be segmented and the image segmentation result of this round;
[0010] S5. assigning the posterior probability of the image to be segmented to each pixel in the region block according to the mapping relationship between the pixel and the region block, and updating the model parameters using the pixel-level posterior probability obtained after the assignment;
[0011] S6. Repeat S2 to S5 until convergence.
[0012] Preferably, S1 specifically includes: assuming that the pixel observation value of each image segmentation area obeys a specific Gaussian distribution:
[0013]
[0014] δ k =(μ k ,Σ k )
[0015] Among them, μ k and Σ k are the mean vector and covariance matrix of the kth Gaussian distribution, Σ k -1 is Σ k The inverse matrix, x i is the pixel observation value in the region, which is regarded as a sample generated under the probability distribution; if the image is segmented into K regions, each region corresponds to a Gaussian distribution, then the pixel observation value of the image to be segmented corresponds to a Gaussian mixture model, and K is a hyperparameter.
[0016] Preferably, S2 is specifically: the segmented image is fixedly divided into blocks according to a window of size s*s, assuming that each pixel observation value in the area block obeys the same Gaussian distribution in an independent manner, using a sliding window of fixed size s*s to traverse the image, calculating the joint probability density distribution of the pixels in the window, calculating the joint probability density distribution of block areas of different blocks, and constructing a block area likelihood matrix.
[0017] Preferably, S3 is specifically: converting the image to be segmented into a grayscale image, each pixel will be included in s*s area blocks, calculating the variance of the grayscale values corresponding to the s*s pixels in each area block, and generating a matching degree vector c for each pixel j , is an s*s dimensional binary vector, which indicates the matching degree between the pixel at position j and the s*s area blocks containing it. The smaller the value in the vector, the higher the matching degree.
[0018] Use the matching degree vector to map each pixel to the region block, establish the mapping relationship between the pixel and the region block, and obtain the mapping identification vector l i is an s*s dimensional binary vector with only one element being 1 and the other elements being 0. If the pixel x at position i i is more compatible with the jth region block, then otherwise
[0019] The pixel-block regional likelihood matrix is obtained by taking the joint probability density distribution of the regional block corresponding to the minimum value in the matching degree vector of the pixel at position i as the likelihood probability of the pixel at position i.
[0020] Preferably, S4 specifically comprises: considering the category labeling result z of the initialization or the previous iteration as the category of the pixel block in the image, is a K-dimensional binary vector, K is the number of categories, There can only be one element in 1 and the other elements are 0. If x N(i) The category of x is k, indicating that N(i) comes from the kth mixture component, then otherwise The local correlation of the Markov field is used to capture the local spatial features of the image to be segmented. The joint distribution p(g) of the pixel block categories is assumed to be the Gibbs distribution, that is:
[0021] p(g)=G -1 exp(-E(g))
[0022] Where E is the energy function, E(g) = ∑ c V c (g c), g c represents the random variable g defined on the potential energy cluster c, V c is the potential function, used to calculate the potential energy of the potential energy group, G = ∑ g exp(-E(g)) is the partition function, i.e. a normalization constant; using pseudo-likelihood Substitute p(g) where g N(i) neighborhood, effectively decompose p(g), Represents the category g at the pixel block i N(i) The prior probability of The conditional probability of ; the simplified second-order same-direction neighborhood Potts model is used to describe it. g in N(i) There are K values, when 1, then f k (x N(i) |g N(i) ) = f k (x N(i) |δ k ),and Recorded as Probability distribution:
[0023]
[0024] in, is the neighborhood of N(i) blocks, Z N(i) is the number of occurrences of category k in the neighboring blocks of block N(i), i = 1, 2...N, N represents the number of pixels, and β is a constant;
[0025] According to Bayesian theory, the posterior probability is calculated. The specific formula is:
[0026]
[0027] Among them, P(x N(i) ) is a constant, and a new label field g is obtained by the maximum a posteriori probability method, and then the category identification result is updated. The specific formula of the maximum a posteriori probability is:
[0028]
[0029] The segmentation result is obtained by maximizing the posterior probability, which is equivalent to minimizing the energy function:
[0030]
[0031] Preferably, S5 specifically comprises: calculating the posterior probability P(k|x N(i) ) is allocated to each pixel in the regional block according to the mapping relationship between the pixel and the regional block. The specific method is as follows:
[0032] Create a key-value pair corresponding to the index z and the position offset (Δa, Δb):
[0033] 0→(-1,-1), 1→(-1,0), 2→(-1,1), 3→(0,-1), 4→(0,0), 5→(0,1), 6→(1,-1), 7→(1,0), 8→(1,1);
[0034] Assume that the position of the i pixel block is (a, b), then the posterior probability P(k|x N(i) ) is denoted as P(k|x N(a,b) ), based on the mapping identification vector, obtain the mapping position of the i pixel block (a v ,b v ):
[0035]
[0036] (Δa, Δb) = Map(z)
[0037] (a v ,b v )=(a+Δa,b+Δb)
[0038] Where Map(·) represents the mapping between index z and position offset (Δa, Δb);
[0039] The posterior probability after offset correction is:
[0040]
[0041] During the offset correction process, the positions of multiple regional blocks correspond to the position of the same regional block, and are superimposed. The mean filter with a convolution kernel size of s*s completes the redistribution of the a priori probability:
[0042]
[0043] in, Represents the posterior probability of each area block in the neighborhood of the current area block;
[0044] After traversing the image, we get the pixel-level posterior probability P(k|x i ), and use the pixel-level posterior probability to update the model parameters.
[0045] Preferably, the method for updating the model parameters using pixel-level posterior probability is:
[0046]
[0047]
[0048] Where N is the total number of pixels in the image and T is the transposition operator.
[0049] Solution 2: An electronic device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, it implements the steps of an image segmentation method based on adaptive blocking and probability redistribution described in Solution 1.
[0050] Solution three: A computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the image segmentation method based on adaptive blocking and probability redistribution described in Solution one is implemented.
[0051] The beneficial effects of the present invention are as follows: the present invention can dynamically adjust the size and shape of the regional block according to the complexity and local characteristics of the image content to more accurately capture the details and structure of the image; on the basis of regular block division, the present invention evaluates the key features of each block, including color, texture, edge information, etc., obtains the consistency and difference of each pixel in different blocks, dynamically adjusts the size and shape of each block, keeps the boundary of the block consistent with the real boundary in the image, so as to avoid over-segmentation or under-segmentation. Secondly, since the adaptive block division method changes the original posterior probability, in order to improve the accuracy of the posterior probability, the present invention designs a method for redistribution of the probability of block area-pixel category to redistribute the posterior probability. Finally, in order to better implement the adaptive block division strategy, suppress noise and accurately conform to the image edge, the present invention proposes an interactive information sharing strategy, utilizes the spatial relationship and similarity between blocks in the image, optimizes the processing strategy of each block by sharing and updating information, takes into account the overall statistical characteristics of the image and the distribution of local details, and thus improves the accuracy and consistency of the overall segmentation. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0053] Figure 1 This is a flow chart of an image segmentation method based on adaptive blocking and probability redistribution. DETAILED DESCRIPTION
[0054] In order to make the technical solutions and advantages of the embodiments of the present invention more clearly understood, the exemplary embodiments of the present invention are further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than an exhaustive list of all the embodiments. It should be noted that the embodiments of the present invention and the features in the embodiments can be combined with each other without conflict.
[0055] Example 1: Reference Figure 1 The present embodiment is described as an image segmentation method based on adaptive block segmentation and probability redistribution, comprising the following steps:
[0056] S1. Initialize the Gaussian mixture model parameters and the initial estimated value of the segmentation category of each pixel based on the image to be segmented and the number of segmentation categories;
[0057] For the input image to be segmented and the number of segmentation categories K, the K-Means algorithm is used to initialize the model parameters and the initial estimated value of the category of each pixel;
[0058] Assume that the pixel observations of each image segmentation area obey a specific Gaussian distribution:
[0059]
[0060] δ k =(μ k ,Σ k )
[0061] Among them, μ k and Σ k are the mean vector and covariance matrix of the kth Gaussian distribution, Σ k -1 is Σ k The inverse matrix, x i is the pixel observation value in the region, which is regarded as a sample generated under the probability distribution; if the image is segmented into K regions, each region corresponds to a Gaussian distribution, then the pixel observation value of the image to be segmented corresponds to a Gaussian mixture model; the parameter value K is a hyperparameter and is directly specified;
[0062] S2. Use a fixed-shape sliding window to divide the image into overlapping blocks and construct a block region likelihood matrix;
[0063] The segmented image is fixedly divided into blocks according to a window of size s*s. Assume that each pixel observation value in the regional block obeys the same Gaussian distribution in an independent manner. Use a sliding window of fixed size s*s to traverse the image and calculate the joint probability density distribution of the pixels in the window: the sliding step of the sliding window is 1, and each block area has overlapping pixels; calculate the joint probability density distribution of block areas of different blocks, and construct the block area likelihood matrix. The calculation formula of the joint probability density distribution is:
[0064]
[0065] Among them, x N(i) represents the pixel observation value of the i-th region block, is the jth pixel observation value in the ith region block, s*s can be regarded as the number of pixels in the region block. By calculating the block region joint likelihood of different blocks, the block region likelihood matrix is constructed.
[0066] From the traversal method, we can see that each pixel will be divided into s*s different area blocks. Therefore, for an image to be segmented of size (h, w), when the joint probability density distribution of fixed blocks in the image is stored in the form of a matrix, the pixel x ij , that is, the joint probability density distribution of the corresponding regional block group of pixels in the i-th row and j-th column will be stored in a window of s*s centered at (i, j);
[0067] S3. Convert the image to be segmented into a grayscale image, calculate the variance within the neighborhood of each pixel, generate a matching vector for each pixel, select the region block with the minimum value in the matching vector and establish a mapping relationship and a pixel-block region likelihood matrix with the corresponding pixel;
[0068] Convert the image to be segmented into a grayscale image. Each pixel will be included in s*s area blocks. Calculate the variance of the grayscale values corresponding to the s*s pixels in each area block to generate the matching vector c for each pixel. j , is an s*s dimensional binary vector, which indicates the matching degree between the pixel at position j and the s*s area blocks containing it. The smaller the value in the vector, the higher the matching degree:
[0069]
[0070] is the matching degree between the jth pixel and the ith region block containing it, d j is the gray value corresponding to the pixel at position j, t i is the mean grayscale value of pixels in the i-th regional block. The discrete degree between each pixel value in the block and the mean of all pixel values in the block is used to characterize and measure the consistency between a certain pixel in the block and other pixels in the block, and the blocks are optimized and adjusted to make them more consistent with the image edge.
[0071] The matching degree vector is used to construct the pixel-block region likelihood matrix, that is, each pixel is mapped to the region block to obtain the mapping identification vector l i is an s*s dimensional binary vector with only one element being 1 and the other elements being 0. If the pixel x at position i i is more compatible with the jth region block, then otherwise
[0072] The pixel-block regional likelihood matrix is obtained by taking the joint probability density distribution of the regional block corresponding to the minimum value in the matching degree vector of the pixel at position i as the likelihood probability of the pixel at position i;
[0073] The pixel likelihood probability calculation formula is:
[0074] The joint probability density distribution of the area block corresponding to the minimum value in the matching degree vector of the pixel at position i is taken as the likelihood probability of the pixel at position i. With the help of the mapping identification vector, the function is implemented in a filtering manner. After calculation, the previous fixed blocks can be further adjusted to reduce the occurrence of misclassified scenes;
[0075] S4, constructing a Markov random field to characterize the local correlation between pixel categories, and obtaining the category probability of the image to be segmented and the image segmentation result of this round;
[0076] In order to better integrate the category annotation information passed down from the previous iteration into the current category unsupervised learning process, this implementation method will use the category annotation result z of the initialization or previous iteration and regard it as the category of the pixel block in the image. is a K-dimensional binary vector There can only be one element in 1 and the other elements are 0. If x N(i) The category of x is k, indicating that N(i) comes from the kth mixture component, then otherwise The local correlation of the Markov field is used to capture the local spatial features of the image to be segmented. The joint distribution p(g) of the pixel block categories is assumed to be the Gibbs distribution, that is:
[0077] p(g)=G -1 exp(-E(g))
[0078] Where E is the energy function, E(g) = ∑ c V c (g c ), g c represents the random variable g defined on the potential energy cluster c, V c is the potential function, used to calculate the potential energy of the potential energy group, G = ∑ g exp(-E(g)) is the partition function, that is, a normalized constant. Due to the mutual coupling between the parameters, the computational complexity of the joint distribution is extremely high and it is not computationally feasible. To replace p(g), where g N(i) neighborhood, effectively decompose p(g), Represents the category g at the pixel block i N(i)The prior probability of The conditional probability of . The simplified second-order same-direction neighborhood Potts model is used to describe it. g in N(i) There are K possible values, when When f k (x N(i) |g N(i) ) = f k (x N(i) |δ k ),and Can be recorded as The probability distribution is as follows:
[0079]
[0080] in is the neighborhood of N(i) blocks, Z N(i) It represents the number of occurrences of category k in the neighboring blocks (usually 8 neighborhoods) of the N(i) block, i = 1, 2...N, N represents the number of pixels, β is a constant used to control the correlation between neighborhoods, and is taken as 1.5 in the specific implementation;
[0081] According to Bayesian theory, the posterior probability is calculated. The specific formula is:
[0082]
[0083] Among them, P(x N(i) ) is a constant, and a new label field g is obtained by the maximum a posteriori probability method, and then the category identification result is updated. The specific formula of the maximum a posteriori probability is:
[0084]
[0085] The segmentation result is obtained by maximizing the posterior probability, which is equivalent to minimizing the energy function:
[0086]
[0087] S5. Assign the posterior probability of the image to be segmented to each pixel in the region block according to the mapping relationship between pixels and region blocks, and use the pixel-level posterior probability obtained after assignment to update the model parameters; since the posterior probability P(k|x N(i) ) is essentially the posterior probability of the region block, but this system needs to use the pixel-level posterior probability P(k|x i ) is used to update the model parameters, and the mapping relationship between the area blocks and pixels is not regular, so it is necessary to use the mapping identification vector l in S3 i To correct this "offset" phenomenon, the specific method is:
[0088] Create key-value pairs corresponding to index z and position offset (Δa, Δb): 0→(-1,-1), 1→(-1,0), 2→(-1,1), 3→(0,-1), 4→(0,0), 5→(0,1), 6→(1,-1), 7→(1,0), 8→(1,1);
[0089] Assume that the position of the i pixel block is (a, b), then the posterior probability P(k|x N(i) ) is denoted as P(k|x N(a,b) ), with the help of the mapping identification vector l in S3 i , get the mapping position of the i pixel block (a v ,b v ):
[0090]
[0091] (Δa, Δb) = Map(z)
[0092] (a v ,b v )=(a+Δa,b+Δb)
[0093] Where Map(·) represents the mapping between index z and position offset (Δa, Δb);
[0094] The posterior probability after offset correction is:
[0095]
[0096] During the offset correction process, the positions of multiple regional blocks correspond to the position of the same regional block, and are superimposed. The mean filter with a convolution kernel size of s*s completes the redistribution of the a priori probability:
[0097]
[0098] in, Represents the posterior probability of each area block in the neighborhood of the current area block;
[0099] After traversing the image, we get the pixel-level posterior probability P(k|x i ), using pixel-level posterior probability to update the model parameters;
[0100] The method of updating the model parameters using pixel-level posterior probability is:
[0101]
[0102] Among them, N is the total number of pixels in the image, and T is the transposition operator.
[0103] S6. Repeat S2 to S5 until convergence. Specifically, the convergence condition is reached when the number of iterations is set to 60.
[0104] This embodiment is essentially a kind of unsupervised algorithm. The setting of the number of image categories or the size of the blocks is non-adaptive and needs to be further adjusted according to the results to obtain the optimal segmentation solution.
[0105] This embodiment ensures the improvement of the accuracy of the posterior probability, can suppress noise and accurately conform to the image edge, takes into account the overall statistical characteristics of the image and the distribution of local details, and thus improves the accuracy and consistency of the overall segmentation.
[0106] Embodiment 2: The computer device of the present invention may be a device including a processor and a memory, such as a single chip microcomputer including a central processing unit, etc. Furthermore, the processor is used to implement the steps of the above-mentioned image segmentation method based on adaptive block division and probability redistribution when executing the computer program stored in the memory.
[0107] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0108] The memory may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0109] Embodiment 3: Computer readable storage medium embodiment.
[0110] The computer-readable storage medium of the present invention can be any form of storage medium that can be read by a processor of a computer device, including but not limited to non-volatile memory, volatile memory, ferroelectric memory, etc. A computer program is stored on the computer-readable storage medium. When the processor of the computer device reads and executes the computer program stored in the memory, the steps of the above-mentioned image segmentation method based on adaptive blocking and probability redistribution can be implemented.
[0111] The computer program includes computer program code, which may be in source code form, object code form, executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer readable media do not include electric carrier signals and telecommunication signals.
[0112] Although the present invention has been described according to a limited number of embodiments, it will be apparent to those skilled in the art, with the benefit of the above description, that other embodiments may be envisioned within the scope of the invention thus described. In addition, it should be noted that the language used in this specification is selected primarily for readability and teaching purposes, rather than for explaining or defining the subject matter of the present invention. Therefore, many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the appended claims. The disclosure of the present invention is illustrative, not restrictive, with respect to the scope of the present invention, which is defined by the appended claims.
Claims
1. An image segmentation method based on adaptive block partitioning and probability redistribution, characterized in that: The following steps are involved: S1. Initialize the Gaussian mixture model parameters and the initial estimated value of the segmentation category of each pixel based on the image to be segmented and the number of segmentation categories; S2. Use a sliding window of a fixed shape to divide the image to be segmented into fixed blocks and construct a block region likelihood matrix; S3. Convert the image to be segmented into a grayscale image, calculate the variance within the neighborhood of each pixel, generate a matching vector for each pixel, select the region block with the minimum value in the matching vector and establish a mapping relationship and a pixel-block region likelihood matrix with the corresponding pixel; S4, constructing a Markov random field to characterize the local correlation between pixel block categories, and obtaining the posterior probability of the image to be segmented and the image segmentation result of this round; S5. Assign the posterior probability of the image to be segmented to each pixel in the region block according to the mapping relationship between the pixel and the region block. The specific method is as follows: Create key-value pairs corresponding to index z and position offset (Δa, Δb): 0→(-1,-1), 1→(-1,0), 2→(-1,1), 3→(0,-1), 4→(0,0), 5→(0,1), 6→(1,-1), 7→(1,0), 8→(1,1); Assume that the position of the i pixel block is (a, b), then the posterior probability P(k|x N(i) ) is denoted as P(k|x N(a,b) ), based on the mapping identification vector, obtain the mapping position of the i pixel block (a v ,b v ): (Δa, Δb) = Map(z) (a v ,b v )=(a+Δa,b+Δb) Where Map(·) represents the mapping between index z and position offset (Δa, Δb), l i is the mapping identification vector, i=1,2...N; The posterior probability after offset correction is: During the offset correction process, the positions of multiple regional blocks correspond to the position of the same regional block, and are superimposed. The mean filter with a convolution kernel size of s*s completes the redistribution of the a priori probability: Among them, β is a constant, Represents the posterior probability of each area block in the neighborhood of the current area block; After traversing the image, we get the pixel-level posterior probability P(k|x i ), using the pixel-level posterior probability to estimate the model parameters μ k ,Σ k Update, μ k and Σ k are the mean vector and covariance matrix of the kth Gaussian distribution, x i is the pixel observation value in the region, which is regarded as a sample generated under the probability distribution, and N is the total number of pixels in the image; S6. Repeat S2 to S5 until convergence.
2. The image segmentation method based on adaptive block segmentation and probability redistribution according to claim 1, characterized in that: S1 is specifically: Assume that the pixel observation value of each image segmentation area obeys a specific Gaussian distribution: d k =(μ k ,S k ) Among them, Σ k -1 is Σ k If the image is divided into K regions and each region corresponds to a Gaussian distribution, then the pixel observation value of the image to be segmented corresponds to a Gaussian mixture model, and K is a hyperparameter.
3. The image segmentation method based on adaptive block segmentation and probability redistribution according to claim 1, characterized in that: S2 is specifically as follows: the segmented image is fixedly divided into blocks according to a window of size s*s, and each pixel observation value in the area block is assumed to obey the same Gaussian distribution in an independent manner. The image is traversed using a sliding window of fixed size s*s, and the joint probability density distribution of the pixels in the window is calculated. The joint probability density distribution of block areas of different blocks is calculated, and a block area likelihood matrix is constructed.
4. The image segmentation method based on adaptive block segmentation and probability redistribution according to claim 1, characterized in that: S3 is as follows: convert the image to be segmented into a grayscale image, each pixel will be included in s*s area blocks, calculate the variance of the grayscale values corresponding to the s*s pixels in each area block, and generate the matching degree vector c for each pixel j , is an s*s dimensional binary vector, which indicates the matching degree between the pixel at position j and the s*s area blocks containing it. The smaller the value in the vector, the higher the matching degree. Use the matching degree vector to map each pixel to the region block, establish the mapping relationship between the pixel and the region block, and obtain the mapping identification vector l i is an s*s dimensional binary vector with only one element being 1 and the other elements being 0. If the pixel x at position i i is more compatible with the jth region block, then otherwise The pixel-block regional likelihood matrix is obtained by taking the joint probability density distribution of the regional block corresponding to the minimum value in the matching degree vector of the pixel at position i as the likelihood probability of the pixel at position i.
5. The image segmentation method based on adaptive block segmentation and probability redistribution according to claim 1, characterized in that: S4 specifically: regard the category labeling result z of the initialization or previous iteration as the category of the pixel block in the image, is a K-dimensional binary vector, There can only be one element in 1 and the other elements are 0. If x N(i) The category of x is k, indicating that N(i) comes from the kth mixture component, then otherwise The local correlation of the Markov field is used to capture the local spatial features of the image to be segmented. The joint distribution p(g) of the pixel block categories is assumed to be the Gibbs distribution, that is: p(g)=G -1 exp(-E(g)) Where E is the energy function, E(g) = ∑ c V c (g c ), g c represents the random variable g defined on the potential energy cluster c, V c is the potential function, used to calculate the potential energy of the potential energy group, G = ∑ g exp(-E(g)) is the partition function, i.e. a normalization constant; using pseudo-likelihood Substitute p(g) where g N(i) neighborhood, effectively decompose p(g), Represents the category g at the pixel block i N(i) The prior probability of The conditional probability of ; the simplified second-order same-direction neighborhood Potts model is used to describe it. g in N(i) There are K values, when When f k (x N(i) |g N(i) ) = f k (x N(i) |δ k ),and Recorded as Probability distribution: in, is the neighborhood of N(i) blocks, Z N(i) is the number of times category k appears in the neighboring blocks of block N(i); According to Bayesian theory, the posterior probability is calculated. The specific formula is: Among them, P(x N(i) ) is a constant, and a new label field g is obtained by the maximum a posteriori probability method, and then the category identification result is updated. The specific formula of the maximum a posteriori probability is: The segmentation result is obtained by maximizing the posterior probability, which is equivalent to minimizing the energy function:
6. The image segmentation method based on adaptive block segmentation and probability redistribution according to claim 1, characterized in that: The method of updating the model parameters using pixel-level posterior probability is: Where T is the transposition operator.
7. An electronic device, characterized in that: The invention comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of an image segmentation method based on adaptive blocking and probability redistribution as described in any one of claims 1 to 6 when executing the computer program.
8. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor, the image segmentation method based on adaptive block division and probability redistribution as described in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Singular value decomposition image matching algorithm based on region partitioning
CN109118528A
Super-pixel method based on probability allocation
CN113409338A