Super-pixel method based on probability distribution
1. A superpixel method based on probability distribution, characterized by: calculating pixel point distribution probability by using pixel point characteristics and superpixel block parameters, and obtaining a final superpixel block segmentation result by iterative clustering in a probability soft distribution mode; the method specifically comprises the following steps:
the method comprises the following steps: giving an input image, uniformly dividing the input image into N square grids, and taking a central pixel point of each square grid as an initial pixel point at the center of a super-pixel block; traversing all pixel points in the image, and calculating the characteristics and standardized parameters of the pixel points one by one;
step two: calculating pixel point distribution probability p according to standardized parameters in a preset range around each superpixel block;
step three: distributing the pixel points to the super pixel blocks with the maximum corresponding distribution probability, and recording a Lab color characteristic matrix of the pixel points of the super pixel blocks and an augmented coordinate position matrix of the pixel points;
step four: updating the pixel point at the center of the super pixel block, and recalculating the distribution probability p of each pixel point;
step five: the iteration step three and the step four reach the appointed step number;
step six: and post-processing, namely combining the isolated superpixel blocks.
2. A probability assignment based superpixel method in accordance with claim 1, characterized by: the specific method for calculating the characteristics and the standardized parameters of the pixel points comprises the following steps:
each pixel point feature includes two:
1) lab color feature xLab=(xL,xa,xb) Calculating according to the RGB color characteristics of the pixel points in the input image;
2) augmented coordinate position x1xyThe method comprises the following steps of (1, x, y), adding a constant term 1 to a coordinate position (x, y) of a pixel point in an input image;
the standardized parameters of each pixel point comprise three parameters:
1)to use the pixel point as the center, the side length is S0In the square area, the Gaussian weighted average value of all the pixel point Lab color characteristics;
2)εLab=(εL,εa,εb) To use the pixel point as the center, the side length is S0In the square area, the Gaussian weighted average value of the Lab color characteristic gradient absolute values of all the pixel points;
3) s is the expected width of the superpixel block with the pixel point as the center, and has S as mS0,σ is sigmoid function, S0In order to uniformly divide the width of the super pixel block,for in the input imageEpsilon of all pixelsLabIs a small amount, 10 is taken-3。
3. A probability assignment based superpixel method in accordance with claim 1, characterized by: in a preset range around each superpixel block, predicting the pixel point distribution probability p according to the standardized parameters, wherein the specific method comprises the following steps:
traversing all the super-pixel blocks, and for pixel points in a square area range with the side length of 1.5S and taking each super-pixel block as the center:
by x of a pixel point at the center of the super-pixel block1xyTaking S as variance, calculating the augmented coordinate position x of each pixel point by a one-dimensional normal distribution model1xyProbability of (2), probability p of the pixel point being the position of the corresponding super-pixel block1xy;
Respectively with pixel points in the centre of the superpixel blockIn (1)Is a mean value of ∈LabOfL,εa,εbCalculating Lab color characteristic x of each pixel point through a one-dimensional normal distribution model as varianceLabX in (2)L,xa,xbProbability of, take xL,xa,xbThe product of the probabilities is the probability p that the pixel point corresponds to the Lab color feature of the super-pixel blockLab;
Then the distribution probability p of the pixel point relative to the central point is p1xypLab。
4. A probability assignment based superpixel method in accordance with claim 1, characterized by: the method comprises the following steps of updating the pixel point and the standardized parameter at the center of the super pixel block, and recalculating the distribution probability p of each pixel point, wherein the specific method comprises the following steps:
updating the pixel point at the center of the superpixel block as a pixel point of which the coordinate is the mean value of coordinate positions of all pixels in the superpixel block, and recalculating three standardized parameters of the pixel point, wherein the three standardized parameters are as follows:
predicting the Lab color characteristics of the pixel points under the assumption that the Lab color characteristics are related or unrelated to the coordinate positions, and taking the interpolation of the Lab color characteristics as Lab color characteristic prediction; wherein the prediction matrix and the variance vector under the uncorrelated hypothesis are respectively thetaindAnd εind:
And εLabThe standardized parameters of the pixel points at the center of the super pixel block are obtained;
considering Lab color characteristics as a linear function of the position of the augmented coordinate under the related assumption, and respectively setting a prediction matrix and a variance vector as thetadepAnd epsilondepThe color feature matrix is obtained by performing linear regression on a Lab color feature matrix of a pixel point of the superpixel block and an augmented coordinate position matrix of the pixel point;
prediction matrix theta of Lab color features obtained by interpolationLabAnd a prediction variance vector ε'LabComprises the following steps:
wherein the content of the first and second substances,Tcurrfor the current number of cycles, TtotalIs a specified number of iterations;
prediction matrix theta according to Lab color characteristics of superpixel blockLabAnd the prediction variance vector ε'LabUpdating the probability p of the pixel point corresponding to the Lab color feature of the super pixel block through the multivariate normal distribution modelLab;
Updating the distribution probability p ═ p of the pixel points1xypLab。
Background
The super-pixel block is a sub-area which has consistency and embodies the local characteristics of the picture in the picture, and the super-pixel division is a process of dividing the picture space into a certain number of areas according to the characteristics of texture, gray level and the like. Compared with the traditional image processing method taking pixel points as basic units, the super-pixel blocks are used as the basic units, so that the local information of the image can be saved, and the calculation amount is reduced. The quality of the segmentation of the superpixel blocks directly determines the effect of these superpixel block-based image algorithms, which generally requires that the superpixel blocks fit the boundaries of objects in the picture and have regular shapes and similar sizes.
The existing super-pixel segmentation method usually calculates the attribution of pixel points based on distance and can not accurately fit the object boundary: if the SLIC algorithm is realized based on the distance between a pixel point and a superpixel block, the superpixel blocks with uniform shapes can be obtained, but the boundary of the superpixel blocks is not well attached; the FH algorithm achieves superpixel segmentation through spanning trees based on inter-pixel distance, is sensitive to changes in pictures, but the edges of generated superpixel blocks are irregular. According to the method, the division result is obtained in a soft distribution mode, and the pixel point information and the image local information are fused through the distribution probability, so that the edge fitting capability of the super-pixel block division is improved.
Disclosure of Invention
The invention aims to provide a superpixel method based on probability distribution, which improves the edge fitting capability of superpixel block segmentation.
In order to achieve the above purpose, the invention adopts the following technical scheme:
a super-pixel method based on probability distribution is characterized in that pixel point distribution probability is calculated by utilizing pixel point characteristics and super-pixel block standardized parameters, and a final super-pixel block segmentation result is obtained by iterative clustering in a probability soft distribution mode. The method specifically comprises the following steps:
the method comprises the following steps: giving an input image, uniformly dividing the input image into N square grids, taking a central pixel point of each square grid as an initial central point of a superpixel block, and calculating the characteristics and standardized parameters of the pixel points one by one;
step two: calculating the distribution probability of each pixel point corresponding to the central point according to the standardized parameters within a preset range around each central point;
step three: distributing the pixel points to the super pixel blocks with the maximum corresponding distribution probability, and recording a Lab color characteristic matrix of the pixel points of the super pixel blocks and an augmented coordinate position matrix of the pixel points;
step four: updating the center point and the standardized parameters of the superpixel block, and recalculating the distribution probability of each pixel point;
step five: the iteration step three and the step four reach the appointed step number;
step six: and post-processing, namely combining the isolated superpixel blocks.
The invention has the beneficial effects that:
the invention adopts a soft distribution mode to obtain a division result, and integrates pixel point information and image local information through distribution probability. Compared with the traditional super-pixel segmentation method, the method can obtain better super-pixel edge fitting effect.
Drawings
FIG. 1 is an algorithmic flow chart of the non-uniform superpixel method of the present invention based on assignment probability.
FIG. 2(a) is an original picture; FIG. 2(b) is a segmentation result of the non-uniform superpixel method based on the distribution probability; FIG. 2(c) is a conventional SLIC algorithm segmentation result; fig. 2(d) is a true experimental picture.
Fig. 3(a) is the edge retention comparison of the present invention with the conventional SLIC algorithm; fig. 3(b) is the comparison result of the maximum segmentation accuracy of the present invention with the conventional SLIC algorithm; fig. 3(c) is a comparison of the under-segmentation error rate of the present invention and the conventional SLIC algorithm.
Detailed Description
The details of the steps of the present invention are described in detail below with reference to the accompanying drawings.
The invention provides a super-pixel method based on probability distribution, and the whole flow of the method is shown in figure 1.
The method mainly comprises the following steps:
the method comprises the following steps:
giving an input image, uniformly dividing the input image into N square grids, and taking a central pixel point of each square grid as an initial pixel point at the center of a super-pixel block;
traversing all pixel points in the image, and calculating the characteristics and standardized parameters of the pixel points one by one, wherein:
each pixel point feature includes two:
1) lab color feature xLab=(xL,xa,xb) Calculating according to the RGB color characteristics of the pixel points in the input image;
2) increaseBroad coordinate position x1xyThe method comprises the following steps of (1, x, y), adding a constant term 1 to a coordinate position (x, y) of a pixel point in an input image;
the standardized parameters of each pixel point comprise three parameters:
1)to use the pixel point as the center, the side length is soIn the square area, the Gaussian weighted average value of all the pixel point Lab color characteristics;
2)εLab=(εL,εa,εb) To use the pixel point as the center, the side length is soIn the square area, the Gaussian weighted average value of the Lab color characteristic gradient absolute values of all the pixel points;
3) the expected width s, s ═ ms of superpixel block centered on the pixel pointo,Where σ is sigmoid function, soIn order to uniformly divide the width of the super pixel block,is epsilon of all pixel points in the imageLabIs a small amount, 10 is taken-3(ii) a The standardized parameters reflect local characteristics of the image, and pixel point attribution prediction can be given according to the standardized parameters of the pixel points at the center of the superpixel block and by combining the characteristics of the pixel points.
Step two: calculating pixel point distribution probability
Supposing that the mean value and the variance of the characteristics in the super-pixel block are Gaussian distribution of the pixel point standardization parameters at the center of the super-pixel block, and calculating the distribution probability from the pixel point to the super-pixel block; in order to reduce the amount of computation, only the pixel points within a certain range around the superpixel block are calculated:
traversing all superpixel blocks in the image, traversing pixel points within 1.5 times of expected width range by taking each superpixel block as center, wherein the distribution probability is Lab color feature probability pLabAnd positionProbability p1xyWherein:
1) color probability: for Lab arbitrary components
2) Position probability:
xi,x1xyis the characteristic of the pixel point and is,ε′is ' is a normalized parameter, x ' of a pixel point at the center of the super pixel block '1xyAn augmented coordinate position of a pixel point at the center of the superpixel block.
Step three: allocating pixel points
Distributing the pixel points to the corresponding super pixel blocks with the maximum distribution probability by adopting a maximum likelihood estimation method so as to realize the maximization of the product of the distribution probabilities of all the pixel points in the picture;
for each superpixel block, the Lab color characteristics and the augmented coordinate positions of all the pixel points belonging to the superpixel block are recorded and used for predicting the pixel points in the superpixel block. Respectively recording Lab color characteristics and the augmented coordinate positions into a Lab color characteristic matrix XLabCoordinate position matrix X with pixel point augmentation1xy:
XLab=(xLab,ji T)n
X1xy=(x1xy,ji T)n
Wherein the content of the first and second substances,is a pixel point jiX ofLabAnd x1xy,jiThe ith pixel point contained in the super pixel block.
Step four: updating pixel points at the center of a superpixel block
And updating the pixel point at the center of the superpixel block as the pixel point of which the coordinate is the mean value of the coordinate positions of all pixels in the superpixel block. Recalculating the three standardized parameters according to the standardized parameter method of the superpixel block;
setting probability prediction obtained by Lab color characteristics obeying Gaussian distribution of the same mean value and variance as prediction under an irrelevant assumption, and setting probability prediction obtained by Lab color characteristics of pixel points in a superpixel block obeying multivariate Gaussian distribution as prediction under the relevant assumption; because the accuracy of predicting the color features of the pixel points under the assumption that the Lab color features and the coordinate positions are irrelevant is low, the overfitting problem is easy to occur in the prediction under the relevant assumption, and in order to make up for the defects of the two methods, the interpolation of the two methods is used as the final prediction:
setting prediction matrix theta under irrelevance assumption for each super-pixel blockindAnd the prediction variance vector εind:
WhereinAnd εLabThe normalized parameters of the pixel points at the center of the superpixel block.
Setting a prediction matrix theta under a correlation assumptiondepSum variance vector εdepIs provided with DdepThe error matrix for the correlation hypothesis is:
wherein I3Is a third order identity matrix.
Then the prediction matrix theta of Lab color characteristicsLabAnd a prediction variance vector ε'LabComprises the following steps:
wherein the content of the first and second substances,Tcurrfor the current number of cycles, TtotalIs a specified number of iterations; in the iteration, the proportion of the correlation hypotheses in the final prediction is gradually increased, maintaining accuracy while avoiding overfitting.
Calculating p1xyThe method is the same as the step two;
prediction matrix theta according to Lab color characteristics of superpixel blockLabAnd the prediction variance vector ε'LabUpdating the probability p of the pixel point corresponding to the Lab color feature of the central point through a normal distribution modelLab:
Wherein the prediction variance vector ε 'is recorded'LabIs of ∈'L,ε′a,ε′b,);
Updating the distribution probability p ═ p of the pixel points1xypLab;
Step five: the third step and the fourth step of iteration reach the specified step number
Step six: merging isolated superpixel blocks
Detecting and merging isolated superpixel blocks by a graph theory method: traversing all the superpixel blocks, recording the upper, lower, left and right adjacent pixel points belonging to the superpixel blocks as connected pixel points, and calculating the sizes of all connected branches in the superpixel blocks; for the number of pixels less thanAnd the connected branch enables all pixel points in the connected branch to belong to the super pixel block adjacent to the super pixel block again.
The following examples were used to demonstrate the beneficial effects of the present invention:
the first embodiment is as follows:
the super-pixel method based on probability distribution is specifically prepared according to the following steps:
the data used in the experiment are test pictures of BSDSS00, and the original pictures and the true pictures are shown in fig. 2(a) and fig. 2(d), fig. 2(b) is the super-pixel segmentation result of the method of the present invention, and fig. 2(c) is the super-pixel segmentation result of the conventional SLIC algorithm; the data comparison of the present invention with the conventional SLIC algorithm on three performance indexes, namely, the edge retention rate, the maximum segmentation accuracy and the under-segmentation error rate, is shown in fig. 3(a), fig. 3(b) and fig. 3(c), respectively; the experimental result verifies the effectiveness of the super-pixel method based on the distribution probability.
The present invention is capable of other embodiments, and various changes and modifications may be made by one skilled in the art without departing from the spirit and scope of the invention.