CN109345536B - Image super-pixel segmentation method and device - Google Patents

Image super-pixel segmentation method and device Download PDF

Info

Publication number
CN109345536B
CN109345536B CN201810935803.4A CN201810935803A CN109345536B CN 109345536 B CN109345536 B CN 109345536B CN 201810935803 A CN201810935803 A CN 201810935803A CN 109345536 B CN109345536 B CN 109345536B
Authority
CN
China
Prior art keywords
pixel
seed
super
image
superpixel
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810935803.4A
Other languages
Chinese (zh)
Other versions
CN109345536A (en
Inventor
邹超洋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Shiyuan Electronics Thecnology Co Ltd
Original Assignee
Guangzhou Shiyuan Electronics Thecnology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Shiyuan Electronics Thecnology Co Ltd filed Critical Guangzhou Shiyuan Electronics Thecnology Co Ltd
Priority to CN201810935803.4A priority Critical patent/CN109345536B/en
Publication of CN109345536A publication Critical patent/CN109345536A/en
Application granted granted Critical
Publication of CN109345536B publication Critical patent/CN109345536B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10024Color image

Abstract

The invention relates to an image super-pixel segmentation method and device. The method comprises the following steps: dividing a plurality of initial superpixel blocks in an image, and numbering each seed; calculating the distance measurement factor value of each pixel of the image relative to various seeds in the neighborhood of the pixel, and selecting the serial number of the seed with the minimum distance measurement factor value as the label of the pixel; according to the label of each pixel, a plurality of super pixel blocks are formed in the image again, and the seed pixel coordinates and the pixel values in each super pixel block are determined; and returning to the distance calculation step and performing multiple iterations. The super-pixel block is constructed in a mode of searching the neighborhood super-pixel seeds by taking the pixel as the center, the super-pixel can be segmented by only reading in the pixel of one line of the image or one pixel at each time, the slicing optimization fine granularity is higher, and the super-pixel segmentation method is beneficial to engineering implementation on the premise of ensuring the super-pixel segmentation effect.

Description

Image super-pixel segmentation method and device
Technical Field
The invention belongs to the technical field of digital image processing, and particularly relates to an image superpixel segmentation method and device.
Background
Superpixels (superpixels) are an image preprocessing technique that has rapidly developed in recent years, and can rapidly divide an image into a certain number of image sub-regions (sets of pixels). Compared with a basic unit, namely a pixel, in the traditional processing method, the superpixel is more beneficial to the extraction of the characteristic and the expression of the structural information, can greatly reduce the computational complexity of subsequent processing, and is widely applied to the field of computer vision, especially to image segmentation.
In the field of computer vision, a digital image is subdivided into a plurality of image sub-regions (sets of pixels) (also called superpixels). Wherein, the superpixel is a small area formed by a series of pixel points with adjacent positions and similar characteristics of color, brightness, texture and the like. Most of these small regions retain effective information for further image segmentation, and generally do not destroy the boundary information of objects in the image. The result of image segmentation is a set of sub-regions on the image (the totality of these sub-regions covers the entire image), or a set of contour lines extracted from the image (e.g. edge detection). Each pixel in a sub-area is similar under some measure of a property or a property derived by calculation, e.g. color, brightness, texture. The adjacent regions differ greatly in some measure of the characteristic.
The superpixel generation algorithm mainly comprises watershed, mean shift, graph cut, k-means and the like. The method comprises the steps of converting a color image into a 5-dimensional feature vector under a CIELAB color space and XY coordinates, constructing a distance measurement standard for the 5-dimensional feature vector, and performing local clustering on image pixels, wherein an SLIC (simple linear iterative clustering) algorithm is a simple algorithm with simple thought and convenient realization based on k-means. The SLIC algorithm can generate compact and approximately uniform superpixels, has higher comprehensive evaluation in the aspects of operation speed, object contour maintenance and superpixel shape, and is more in line with the expected segmentation effect of people.
As shown in fig. 1, the conventional image superpixel segmentation method includes the following steps:
step 1: initializing an input image with the pixel size of W multiplied by H, dividing the image into M multiplied by N superpixel blocks at equal intervals, uniformly distributing a plurality of corresponding seeds, and taking the pixel at the geometric center coordinate of each superpixel block as the initial seed of the current superpixel block. If the number of the side length pixels of the superpixel block is S pixels, the number Num of the superpixel blocks is W/S multiplied by H/S.
And numbering the pixels in each super pixel block according to the initialized M multiplied by N super pixel blocks, initializing the pixels into a label image, and setting all label image values corresponding to the pixels in each super pixel block as the number values of the super pixel block.
Step 2: and calculating the distance measurement factor value of the pixel and the seed for the pixel in a certain neighborhood range of each seed, wherein the distance measurement factor is the weighting of distance proximity and color similarity and is a five-dimensional vector (x, y, l, a, b), the (x, y) represents the pixel coordinate, and the (l, a, b) represents the three-channel color value of the lab color space.
The distance metric factor calculation formula is as follows:
Figure BDA0001767798260000021
wherein:
Figure BDA0001767798260000022
Figure BDA0001767798260000023
(xj,yj,lj,aj,bj) Pixel coordinates and pixel value representing the currently processed pixel, (x)i,yi,li,ai,bi) Representing the seed pixel coordinates as well as the pixel values. dcIndicating the color distance, dsRepresents the spatial distance, NsIs the maximum spatial distance within the class, defined as NsMaximum color distance N ═ ScThe constant m (value range [1,40 ]) is usually fixed according to different pictures and different clusters]Generally, 10) is taken instead.
For example, with a super-pixel block size of S × S, the neighborhood range is typically set to 2S × 2S for a seed in which the neighborhood is set to be larger than the super-pixel block size. Thus, a pixel may be included in the neighborhood of the plurality of seeds, a distance metric between the currently processed pixel and the current seed is determined, and if greater than the previous distance metric relative to another seed, the label value of the pixel is not changed; and if the distance metric factor is smaller than that of the other seed, updating the label value of the pixel currently processed to the number of the current seed.
And step 3: and recalculating the central coordinates and the pixel mean value of each superpixel block as new seeds according to the updated label image.
And 4, step 4: and repeating the steps 2 and 3 in an iterative manner.
The superpixels generated by the image superpixel segmentation method are generally compact and regular, the neighborhood characteristics are relatively easy to express, and not only can a color image be segmented, but also a gray image can be compatibly segmented. However, in the conventional scheme, slicing optimization is performed, the seed update requires information of a neighborhood, and at least a pixel of 3SxW or 3Sx3S needs to be read each time to ensure that a superpixel block corresponding to the currently processed seed is accurately updated, so that a larger storage space is required for slicing optimization.
Disclosure of Invention
The invention provides an image superpixel segmentation method and a device thereof, aiming at solving the technical problem of overlarge required storage space, further improving the image segmentation speed and optimizing the fine granularity. The image super-pixel segmentation method comprises the following steps:
super pixel block seed initialization: dividing a plurality of super pixel blocks in an image, setting a seed in each super pixel block, and numbering each seed;
distance calculation step: calculating a distance metric factor value of each pixel of the image with respect to each seed in a neighborhood of the pixel, the neighborhood size of each pixel being larger than the size of the superpixel block in which the pixel is located;
a pixel label setting step: for each pixel, selecting the number of the seed with the minimum distance metric factor value as the label of the pixel;
and (3) seed updating: reforming a plurality of super-pixel blocks in the image according to the label of each pixel, and re-determining the seed pixel coordinate and the pixel value (x) in each super-pixel blockk,yk,lk,ak,bk);
And (3) iteration return step: and returning to the distance calculation step until the set iteration times are reached or the coordinates and pixel values of the seed pixels are not changed any more.
Further, in the super pixel block seed initialization step, a plurality of super pixel blocks are uniformly divided in the image by a step S.
Further, in the distance calculating step, the distance metric factor calculation formula is as follows:
Dist=Dlab+k*Dxy
wherein:
Dlab=abs(li-lk)+abs(ai-ak)+abs(bi-bk)
Dxy=abs(xi-xk)+abs(yi-yk)
(xi,yi,li,ai,bi) Representing the pixel coordinates and the pixel value, D, of the currently processed pixellabIndicating the color distance, DxyRepresents a spatial distance; k is a proportionality coefficient and takes a value in the range of 1/A-20/A, and A is the super-pixel block size of the current processing pixel.
Further, in the distance calculating step, a distance metric factor between each pixel of the image and the seed in the super pixel block where the pixel is located and the seed in each super pixel block adjacent to the super pixel block where the pixel is located is calculated.
Further, the number of the super pixel blocks adjacent to the super pixel block is 4 or 9.
Further, in the seed update step, a pixel at the geometric center coordinate of each super-pixel block is determined as a seed for the super-pixel block.
Further, the number of iterations is not less than 5.
Further, each initial superpixel block size is S × S, and the current pixel neighborhood size is at least 2S × 2S.
Further, in the seed update step, a pixel at the geometric center coordinate of each super-pixel block is determined as a seed for the super-pixel block.
The embodiment of the invention also provides an image super-pixel segmentation device, which comprises:
super pixel block seed initialization module: dividing a plurality of initial superpixel blocks in an image, setting a seed in each superpixel block, and numbering each seed;
a distance calculation module: calculating a distance metric factor value of each pixel of the image with respect to each seed in a neighborhood of the pixel, the neighborhood size of each pixel being larger than the size of the superpixel block in which the pixel is located;
a pixel label setting module: selecting the serial number of the seed with the minimum distance metric factor value as the label of the pixel;
the seed updating module: reforming a plurality of super-pixel blocks in the image according to the label of each pixel, determining the species in each super-pixel blockSub-pixel coordinates and pixel value (x)k,yk,lk,ak,bk);
An iteration return module: the distance calculation means is caused to iterate a plurality of calculations.
Embodiments of the present invention further provide a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the above method.
The embodiment of the present invention further provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the steps of the method are implemented.
The invention has the beneficial effects that: the image super-pixel segmentation method and the device thereof provided by the embodiment of the invention use the mode of searching the neighborhood super-pixel seeds by taking the pixels as the center to construct the super-pixel block, replace the mode of searching the neighborhood pixels by taking the super-pixel block seeds as the center to construct the super-pixel block, only one line of pixels or one pixel of the image needs to be read in each time to realize the segmentation of the super-pixels, and the slice optimization fine granularity is higher, thereby being beneficial to the engineering realization on the premise of ensuring the super-pixel segmentation effect.
Drawings
FIG. 1 is a diagram of prior art image superpixel segmentation;
FIG. 2 is a schematic diagram of image superpixel segmentation according to an embodiment of the present invention;
FIG. 3 is a flow chart of a method for image superpixel segmentation in accordance with an embodiment of the present invention;
FIG. 4 is a flow chart of a method for image superpixel segmentation in accordance with a preferred embodiment of the present invention;
FIG. 5 is a block diagram of an image superpixel splitting apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to specific embodiments and the accompanying drawings. Those skilled in the art will appreciate that the present invention is not limited to the drawings and the following examples.
As shown in fig. 2 and 3, an embodiment of the present invention provides an image superpixel segmentation method, which uses a pixel as a center to search a neighborhood superpixel seed to construct a superpixel block, and replaces the prior art that uses the superpixel block seed as a center to search a neighborhood pixel to construct a superpixel block, including the following steps:
super pixel block seed initialization: dividing a plurality of initial superpixel blocks in an image, setting a seed in each superpixel block, and numbering each seed.
And setting the number of the super pixel blocks according to the size of the image, uniformly distributing seeds in the image, and numbering each seed. By this step, a plurality of initial superpixel blocks are uniformly formed in the image.
For example, the image includes N pixels, which are pre-divided into K initial superpixel blocks of the same size, each pixel block is provided with a seed, and the K seeds are numbered from 1 to K. Each initial super-pixel block has a size of N/K, and the distance (step size S) between adjacent seeds is S ═ sqrt (N/K), that is, each initial super-pixel block has a size of S × S.
Distance calculation step: a distance metric factor value is calculated for each pixel of the image with respect to various seeds within a neighborhood of the pixel, the neighborhood size of each pixel being larger than the size of the superpixel in which the pixel is located.
Specifically, the distance metric factor is a weighted distance proximity and color similarity, and is a five-dimensional vector (x, y, l, a, b), where (x, y) represents pixel coordinates, and (l, a, b) represents three-channel color values in lab color space.
The distance metric factor calculation formula is as follows:
Dist=Dlab+k*Dxy
wherein:
Dlab=abs(li-lk)+abs(ai-ak)+abs(bi-bk)
Dxy=abs(xi-xk)+abs(yi-yk)
(xi,yi,li,ai,bi) Pixel coordinates and pixel value representing the currently processed pixel, (x)k,yk,lk,ak,bk) Representing the seed pixel coordinates as well as the pixel values. DlabIndicating the color distance, DxyRepresenting the space distance, k is a proportionality coefficient and takes a value in a range of 1/A-20/A, and A is the super-pixel block size of the current processing pixel.
Each initial superpixel block size is sxs, then for a neighborhood of a pixel therein set to a size greater than the superpixel block in which the pixel resides, the neighborhood range may be set to at least 2 sx 2S. Thus, a neighborhood of a pixel may include a plurality of seeds, and in this step, for each pixel, a distance metric factor value may be calculated for the pixel with respect to the plurality of seeds in its neighborhood.
However, the neighborhood selection method may cause the shift of the seed point determined again subsequently, and in order to solve this problem, the preferred solution of the embodiment of the present invention is to calculate the distance metric factor between each pixel of the image and the seed of the super-pixel block where the pixel is located and various sub-in the super-pixel blocks adjacent to the super-pixel block where the pixel is located, wherein the number of the super-pixel blocks adjacent to the super-pixel block where the pixel is located may be 4 or 9, and the selection of the adjacent super-pixel blocks is arbitrary and has no mandatory requirement.
A pixel label setting step: and selecting the number of the seed with the minimum distance metric factor value as the label of each pixel in the calculation result of the distance metric factor value of each pixel relative to each seed in the neighborhood of the pixel.
If there are four seeds 1, 2, 3, 5 in the neighborhood of a pixel whose distance metric factor values with respect to the four seeds are Dist1, Dist2, Dist3 and Dist5, and the minimum value is Dist3, the label of the pixel is number 3 of seed 3 corresponding to Dist 3.
And (3) seed updating: reforming a plurality of super-pixel blocks according to the label of each pixel in the image, and determining the seed pixel coordinate and the pixel value (x) in each super-pixel blockk,yk,lk,ak,bk)。
Specifically, the gradient values of all pixel points in each superpixel block are calculated, and the seeds are moved to the pixel with the minimum gradient in the superpixel block. The purpose of this is to avoid the seed points falling on the contour boundary with larger gradient so as not to affect the subsequent clustering effect.
To further prevent seed drift, the present embodiment preferably adopts the pixel at the geometric center coordinate of each superpixel block as the seed of the superpixel block, i.e., calculates the average value of the abscissa of all pixels in the superpixel block and the average value of the ordinate of all pixels as the pixel coordinate of the determined seed. The method is simple and easy to implement, and a good display effect can be obtained by combining the neighborhood selection method and the distance measurement factor value algorithm of the embodiment of the invention.
And (3) iteration return step: returning to the distance calculation step, the iteration number is generally not less than 5.
And returning to the step of calculating the distance and continuously iterating to enable the error to be converged, namely, the seeds are not changed any more, preferably, after 10 iterations, the ideal effect can be obtained for most pictures.
In the above description, the image super-pixel segmentation method according to the embodiment of the present invention is generally described, that is, the super-pixel block is constructed by searching the neighborhood super-pixel seeds with the pixel as the center, instead of the method of constructing the super-pixel block by searching the neighborhood pixels with the super-pixel block seeds as the center in the prior art. However, there are many choices for the specific means used in each step, and different neighborhood selection methods and distance metric factor value algorithms, etc. have different segmentation effects. In the following, referring to fig. 4, the image superpixel segmentation method according to the preferred embodiment of the present invention is described, including the following steps:
super pixel block seed initialization: the method comprises the steps of uniformly dividing a plurality of initial superpixel blocks in an image by step length, setting a seed in each superpixel block, and numbering each seed so as to uniformly form a plurality of latticed initial superpixel blocks in the image.
Specifically, the image comprises N pixel points, the N pixel points are pre-divided into K initial superpixel blocks with the same size, each pixel block is provided with one seed, and the K seeds are numbered from 1 to K. Each initial super-pixel block has a size of N/K, and the distance (step size) between adjacent seeds is S ═ sqrt (N/K), that is, each initial super-pixel block has a size of S × S.
Distance calculation step: calculating distance measurement factors between each pixel of the image and the seed of the super-pixel block where the pixel is and various seeds in a plurality of super-pixel blocks adjacent to the super-pixel block where the pixel is, wherein the number of the plurality of super-pixel blocks adjacent to the super-pixel block where the pixel is can be 4 or 9.
Specifically, the distance metric factor is a weighted distance proximity and color similarity, and is a five-dimensional vector (x, y, l, a, b), where (x, y) represents pixel coordinates, and (l, a, b) represents three-channel color values in lab color space.
The distance metric factor calculation formula is as follows:
Dist=Dlab+k*Dxy
wherein:
Dlab=abs(li-lk)+abs(ai-ak)+abs(bi-bk)
Dxy=abs(xi-xk)+abs(yi-yk)
(xi,yi,li,ai,bi) Pixel coordinates and pixel value representing the currently processed pixel, (x)k,yk,lk,ak,bk) Representing the seed pixel coordinates as well as the pixel values. DlabIndicating the color distance, DxyRepresenting the space distance, k is a proportionality coefficient and takes a value in a range of 1/A-20/A, and A is the super-pixel block size of the current processing pixel.
A pixel label setting step: and selecting the number of the seed with the minimum distance metric factor value as the label of each pixel in the calculation result of the distance metric factor value of each pixel relative to each seed in the neighborhood of the pixel.
If five seeds 1, 2, 3, 5, and 7 exist in the neighborhood of a pixel, where the seed 1 is the seed in the superpixel block where the current pixel is located, the seeds 2, 3, 5, and 7 are the seeds in the superpixel blocks adjacent to the superpixel block where the current pixel is located, and the distance metric factor values of the pixel with respect to the five seeds are Dist1, Dist2, Dist3, Dist5, and Dist7, where the minimum value is Dist3, then the label of the pixel is number 3 of the seed 3 corresponding to Dist 3.
And (3) seed updating: according to the label of each pixel in the image, a plurality of super pixel blocks are formed again, the pixel at the geometric center coordinate of each super pixel block is determined as the seed of the super pixel block, and the seed pixel coordinate and the pixel value (x) are obtainedk,yk,lk,ak,bk)。
And (3) iteration return step: returning to the distance calculation step, and obtaining ideal effect on most pictures after 10 iterations.
The image super-pixel segmentation method in the preferred embodiment of the invention has simple calculation, less image data required by single calculation and less system resource occupation, can realize the segmentation of the super-pixel by only reading in one line of pixels or one pixel of the image each time, has higher slice-type optimized fine granularity, and is beneficial to the engineering realization on the premise of ensuring the super-pixel segmentation effect.
The invention also provides an image superpixel segmentation device, which uses the pixel as the center to search the neighborhood superpixel seeds to construct a superpixel block, replaces the prior art to search the neighborhood pixels by using the superpixel block seeds as the center to construct the superpixel block, and comprises the following steps:
superpixel block seed initialization section: dividing a plurality of initial superpixel blocks in an image, setting a seed in each superpixel block, and numbering each seed.
And setting the number of the super pixel blocks according to the size of the image, uniformly distributing seeds in the image, and numbering each seed. Thereby, a plurality of initial superpixel blocks are uniformly formed in the image.
For example, the image includes N pixels, which are pre-divided into K initial superpixel blocks of the same size, each pixel block is provided with a seed, and the K seeds are numbered from 1 to K. Each initial super-pixel block has a size of N/K, and the distance (step size) between adjacent seeds is S ═ sqrt (N/K), that is, each initial super-pixel block has a size of S × S.
A distance calculation section: a distance metric factor value is calculated for each pixel of the image with respect to various seeds within a neighborhood of the pixel, the neighborhood size of each pixel being larger than the size of the superpixel in which the pixel is located.
Specifically, the distance metric factor is a weighted distance proximity and color similarity, and is a five-dimensional vector (x, y, l, a, b), where (x, y) represents pixel coordinates, and (l, a, b) represents three-channel color values in lab color space.
The distance metric factor calculation formula is as follows:
Dist=Dlab+k*Dxy
wherein:
Dlab=abs(li-lk)+abs(ai-ak)+abs(bi-bk)
Dxy=abs(xi-xk)+abs(yi-yk)
(xi,yi,li,ai,bi) Pixel coordinates and pixel value representing the currently processed pixel, (x)k,yk,lk,ak,bk) Representing the seed pixel coordinates as well as the pixel values. DlabIndicating the color distance, DxyRepresenting the space distance, k is a proportionality coefficient and takes a value in a range of 1/A-20/A, and A is the super-pixel block size of the current processing pixel.
Each initial superpixel block size is sxs, then for a neighborhood of a pixel therein set to a size greater than the superpixel block in which the pixel resides, the neighborhood range may be set to at least 2 sx 2S. Thus, a neighborhood of a pixel may include a plurality of seeds, such that for each pixel, a distance metric factor value may be calculated for the pixel with respect to the plurality of seeds in its neighborhood.
However, the neighborhood selection method may cause the shift of the seed point determined again subsequently, and in order to solve this problem, the preferred solution of the embodiment of the present invention is to calculate the distance metric factor between each pixel of the image and the seed of the super-pixel block where the pixel is located and various sub-in the super-pixel blocks adjacent to the super-pixel block where the pixel is located, wherein the number of the super-pixel blocks adjacent to the super-pixel block where the pixel is located may be 4 or 9, and the selection of the adjacent super-pixel blocks is arbitrary and has no mandatory requirement.
A pixel tag setting section: and selecting the number of the seed with the minimum distance metric factor value as the label of each pixel in the calculation result of the distance metric factor value of each pixel relative to each seed in the neighborhood of the pixel.
If there are four seeds 1, 2, 3, 5 in the neighborhood of a pixel whose distance metric factor values with respect to the four seeds are Dist1, Dist2, Dist3 and Dist5, and the minimum value is Dist3, the label of the pixel is number 3 of seed 3 corresponding to Dist 3.
A seed update section: reforming a plurality of super-pixel blocks according to the label of each pixel in the image, and determining the seed pixel coordinate and the pixel value (x) in each super-pixel blockk,yk,lk,ak,bk)。
Specifically, the gradient values of all pixel points in each superpixel block are calculated, and the seeds are moved to the pixel with the minimum gradient in the superpixel block. The purpose of this is to avoid the seed points falling on the contour boundary with larger gradient so as not to affect the subsequent clustering effect.
To further prevent seed drift, the present embodiment preferably adopts the pixel at the geometric center coordinate of each superpixel block as the seed of the superpixel block, i.e., calculates the average value of the abscissa of all pixels in the superpixel block and the average value of the ordinate of all pixels as the pixel coordinate of the determined seed. The method is simple and easy to implement, and a good display effect can be obtained by combining the neighborhood selection method and the distance measurement factor value algorithm of the embodiment of the invention.
An iteration return component: and enabling the distance calculation part to carry out iterative calculation, wherein the iterative times are generally not less than 5.
The distance calculation component iterates continuously to make the error converge, that is, the seeds do not change any more, preferably, after 10 iterations, a more ideal effect can be obtained for most pictures.
In the above description, the image super-pixel segmentation apparatus according to the embodiment of the present invention is generally described, that is, the super-pixel block is constructed by searching the super-pixel block seeds of the neighborhood with the pixel as the center, instead of searching the super-pixel block seeds of the neighborhood with the super-pixel block seeds as the center in the prior art. However, there are many choices for the specific means used by each component, and different segmentation effects can be achieved by using different neighborhood selection methods and distance metric factor value algorithms. Hereinafter, an image super-pixel segmentation apparatus according to a preferred embodiment of the present invention is described, the apparatus including:
superpixel block seed initialization section: the method comprises the steps of uniformly dividing a plurality of initial superpixel blocks in an image by step length, setting a seed in each superpixel block, and numbering each seed. So that a plurality of initial superpixel blocks in a grid shape are uniformly formed in the image.
Specifically, the image comprises N pixel points, the N pixel points are pre-divided into K initial superpixel blocks with the same size, each pixel block is provided with one seed, and the K seeds are numbered from 1 to K. Each initial super-pixel block has a size of N/K, and the distance (step size) between adjacent seeds is S ═ sqrt (N/K), that is, each initial super-pixel block has a size of S × S.
A distance calculation section: calculating distance measurement factors between each pixel of the image and the seed of the super-pixel block where the pixel is and various seeds in a plurality of super-pixel blocks adjacent to the super-pixel block where the pixel is, wherein the number of the plurality of super-pixel blocks adjacent to the super-pixel block where the pixel is can be 4 or 9.
Specifically, the distance metric factor is a weighted distance proximity and color similarity, and is a five-dimensional vector (x, y, l, a, b), where (x, y) represents pixel coordinates, and (l, a, b) represents three-channel color values in lab color space.
The distance metric factor calculation formula is as follows:
Dist=Dlab+k*Dxy
wherein:
Dlab=abs(li-lk)+abs(ai-ak)+abs(bi-bk)
Dxy=abs(xi-xk)+abs(yi-yk)
(xi,yi,li,ai,bi) Pixel coordinates and pixel value representing the currently processed pixel, (x)k,yk,lk,ak,bk) Representing the seed pixel coordinates as well as the pixel values. DlabIndicating the color distance, DxyRepresenting the space distance, k is a proportionality coefficient and takes a value in a range of 1/A-20/A, and A is the super-pixel block size of the current processing pixel.
A pixel tag setting section: and selecting the number of the seed with the minimum distance metric factor value as the label of each pixel in the calculation result of the distance metric factor value of each pixel relative to each seed in the neighborhood of the pixel.
If five seeds 1, 2, 3, 5, and 7 exist in the neighborhood of a pixel, where the seed 1 is the seed in the superpixel block where the current pixel is located, the seeds 2, 3, 5, and 7 are the seeds in the superpixel blocks adjacent to the superpixel block where the current pixel is located, and the distance metric factor values of the pixel with respect to the five seeds are Dist1, Dist2, Dist3, Dist5, and Dist7, where the minimum value is Dist3, then the label of the pixel is number 3 of the seed 3 corresponding to Dist 3.
A seed update section: according to the label of each pixel in the image, a plurality of super pixel blocks are formed again, the pixel at the geometric center coordinate of each super pixel block is determined as the seed of the super pixel block, and the seed pixel coordinate and the pixel value (x) are obtainedk,yk,lk,ak,bk)。
An iteration return component: the distance calculation part is enabled to carry out iterative calculation, and after 10 iterations, ideal effects can be obtained for most pictures.
The image super-pixel segmentation device in the preferred embodiment of the invention has simple calculation, less image data required by single calculation and less system resource occupation, can realize the segmentation of super-pixels only by reading in pixels of one line or one pixel of an image each time, has higher slice-type optimized fine granularity, and is beneficial to engineering realization on the premise of ensuring the super-pixel segmentation effect.
Embodiments of the present invention further provide a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the above method.
The embodiment of the present invention further provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the steps of the method are implemented.
Those of skill in the art will understand that the logic and/or steps represented in the flowcharts or otherwise described herein, e.g., an ordered listing of executable instructions that can be viewed as implementing logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device.
More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via for instance optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.
It should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
The embodiments of the present invention have been described above. However, the present invention is not limited to the above embodiment. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A super pixel segmentation method for an image is characterized in that the method adopts a mode of searching neighborhood super pixel seeds by taking a pixel as a center to construct a super pixel block, and comprises the following steps:
super pixel block seed initialization: dividing a plurality of super pixel blocks in an image, setting a seed in each super pixel block, and numbering each seed;
distance calculation step: calculating a distance metric factor value of each pixel of the image with respect to each seed in a neighborhood of the pixel, the neighborhood size of each pixel being larger than the size of the superpixel block in which the pixel is located;
a pixel label setting step: for each pixel, selecting the number of the seed with the minimum distance metric factor value as the label of the pixel;
and (3) seed updating: reforming a plurality of super-pixel blocks in the image according to the label of each pixel, and re-determining the seed pixel coordinate and the pixel value (x) in each super-pixel blockk,yk,lk,ak,bk);
And (3) iteration return step: and returning to the distance calculation step until the set iteration times are reached or the coordinates and pixel values of the seed pixels are not changed any more.
2. The image superpixel segmentation method of claim 1, wherein in the superpixel block seed initialization step, a plurality of superpixel blocks are uniformly divided in the image by a step size S.
3. The image superpixel segmentation method according to claim 2, wherein in the distance calculation step, the distance metric factor calculation formula is as follows:
Dist=Dlab+k*Dxy
wherein:
Dlab=abs(li-lk)+abs(ai-ak)+abs(bi-bk)
Dxy=abs(xi-xk)+abs(yi-yk)
(xi,yi,li,ai,bi) Representing the pixel coordinates and the pixel value, D, of the currently processed pixellabIndicating the color distance, DxyRepresents a spatial distance; k is a proportionality coefficient and takes a value in the range of 1/A-20/A, and A is the super-pixel block size of the current processing pixel.
4. The image superpixel segmentation method according to any one of claims 1 to 3, characterized in that in the distance calculation step, a distance metric is calculated between each pixel of the image and the seed in the superpixel block in which it is located and the seeds in the respective superpixel blocks adjacent to the superpixel block in which it is located.
5. The image superpixel segmentation method according to claim 4, characterized in that the number of said superpixel blocks adjacent to said located superpixel block is 4 or 9.
6. The image superpixel segmentation method of claim 5, characterized in that in the seed update step, the pixel at the geometric center coordinate of each superpixel block is determined as the seed of the superpixel block.
7. The method of image superpixel segmentation of claim 6, wherein the number of iterations is not less than 5.
8. The image superpixel segmentation method of claim 2, wherein each initial superpixel block size is sxs and the current pixel neighborhood size is at least 2 sx 2S.
9. The image superpixel segmentation method of claim 8, wherein in the seed update step, the pixel at the geometric center coordinate of each superpixel block is determined as the seed of the superpixel block.
10. An image superpixel segmentation device is characterized in that the device adopts a mode of searching neighborhood superpixel seeds by taking pixels as centers to construct a superpixel block, and comprises the following steps:
super pixel block seed initialization module: dividing a plurality of initial superpixel blocks in an image, setting a seed in each superpixel block, and numbering each seed;
a distance calculation module: calculating a distance metric factor value of each pixel of the image with respect to each seed in a neighborhood of the pixel, the neighborhood size of each pixel being larger than the size of the superpixel block in which the pixel is located;
a pixel label setting module: selecting the serial number of the seed with the minimum distance metric factor value as the label of the pixel;
the seed updating module: reforming a plurality of super-pixel blocks in the image according to the label of each pixel, and determining the seed pixel coordinate and the pixel value (x) in each super-pixel blockk,yk,lk,ak,bk);
An iteration return module: the distance calculation means is caused to iterate a plurality of calculations.
CN201810935803.4A 2018-08-16 2018-08-16 Image super-pixel segmentation method and device Active CN109345536B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810935803.4A CN109345536B (en) 2018-08-16 2018-08-16 Image super-pixel segmentation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810935803.4A CN109345536B (en) 2018-08-16 2018-08-16 Image super-pixel segmentation method and device

Publications (2)

Publication Number Publication Date
CN109345536A CN109345536A (en) 2019-02-15
CN109345536B true CN109345536B (en) 2021-02-09

Family

ID=65296847

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810935803.4A Active CN109345536B (en) 2018-08-16 2018-08-16 Image super-pixel segmentation method and device

Country Status (1)

Country Link
CN (1) CN109345536B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109977767B (en) * 2019-02-18 2021-02-19 浙江大华技术股份有限公司 Target detection method and device based on superpixel segmentation algorithm and storage device
CN110096961B (en) * 2019-04-04 2021-03-02 北京工业大学 Indoor scene semantic annotation method at super-pixel level
CN111291811B (en) * 2020-02-07 2023-12-08 京东科技控股股份有限公司 Region dividing and classifying method, device and computer readable storage medium
CN112164087B (en) * 2020-10-13 2023-12-08 北京无线电测量研究所 Super-pixel segmentation method and device based on edge constraint and segmentation boundary search

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6192271B2 (en) * 2012-08-22 2017-09-06 キヤノン株式会社 Image processing apparatus, image processing method, and program
CN104143186B (en) * 2014-07-04 2017-11-07 华南理工大学 A kind of SLIC super-pixel piecemeal optimization method
CN105138970B (en) * 2015-08-03 2018-11-16 西安电子科技大学 Classification of Polarimetric SAR Image method based on spatial information
CN106778635A (en) * 2016-12-19 2017-05-31 江苏慧眼数据科技股份有限公司 A kind of human region detection method of view-based access control model conspicuousness
CN107016684A (en) * 2017-04-13 2017-08-04 中国人民解放军国防科学技术大学 A kind of super-pixel rapid generation of Polarimetric SAR Image

Also Published As

Publication number Publication date
CN109345536A (en) 2019-02-15

Similar Documents

Publication Publication Date Title
Ibrahim et al. Image segmentation methods based on superpixel techniques: A survey
CN109345536B (en) Image super-pixel segmentation method and device
Levinshtein et al. Turbopixels: Fast superpixels using geometric flows
Shen et al. Real-time superpixel segmentation by DBSCAN clustering algorithm
Zhao et al. FLIC: Fast linear iterative clustering with active search
US8411952B2 (en) Method for segmenting an image using constrained graph partitioning of watershed adjacency graphs
CN106815842B (en) improved super-pixel-based image saliency detection method
CN108629783B (en) Image segmentation method, system and medium based on image feature density peak search
WO2003090173A2 (en) Segmentation of 3d medical structures using robust ray propagation
US20090003698A1 (en) Segmentaton of digital images
CN111275724B (en) Airborne point cloud roof plane segmentation method based on octree and boundary optimization
CN105335965B (en) Multi-scale self-adaptive decision fusion segmentation method for high-resolution remote sensing image
CN108596920A (en) A kind of Target Segmentation method and device based on coloured image
Katkar et al. A novel approach for medical image segmentation using PCA and K-means clustering
CN109741358B (en) Superpixel segmentation method based on adaptive hypergraph learning
Zhou et al. Superpixels by bilateral geodesic distance
Hosseini-Asl et al. Lung segmentation based on nonnegative matrix factorization
Omidalizarandi et al. Segmentation and classification of point clouds from dense aerial image matching
Li et al. Aggregating complementary boundary contrast with smoothing for salient region detection
CN107492101B (en) Multi-modal nasopharyngeal tumor segmentation algorithm based on self-adaptive constructed optimal graph
Chen et al. A modified graph cuts image segmentation algorithm with adaptive shape constraints and its application to computed tomography images
CN112785608B (en) Medical image segmentation method for improving SNIC (single noise integrated circuit) based on adaptive parameters
Lindblad et al. Exact linear time euclidean distance transforms of grid line sampled shapes
Toure et al. Coastline detection using fusion of over segmentation and distance regularization level set evolution
Wang et al. Adaptive hypergraph superpixels

Legal Events

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