CN107301642A - A kind of full-automatic prospect background segregation method based on binocular vision - Google Patents
A kind of full-automatic prospect background segregation method based on binocular vision Download PDFInfo
- Publication number
- CN107301642A CN107301642A CN201710402285.5A CN201710402285A CN107301642A CN 107301642 A CN107301642 A CN 107301642A CN 201710402285 A CN201710402285 A CN 201710402285A CN 107301642 A CN107301642 A CN 107301642A
- Authority
- CN
- China
- Prior art keywords
- mrow
- msub
- image
- disparity
- disparity map
- 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.)
- Granted
Links
- 238000005204 segregation Methods 0.000 title abstract 2
- 238000000034 method Methods 0.000 claims abstract description 22
- 238000005457 optimization Methods 0.000 claims abstract description 8
- 230000008569 process Effects 0.000 claims abstract description 4
- 238000000926 separation method Methods 0.000 claims description 13
- 239000011159 matrix material Substances 0.000 claims description 9
- 230000002776 aggregation Effects 0.000 claims description 7
- 238000004220 aggregation Methods 0.000 claims description 7
- 208000011231 Crohn disease Diseases 0.000 claims description 3
- 230000007797 corrosion Effects 0.000 claims description 3
- 238000005260 corrosion Methods 0.000 claims description 3
- 238000001914 filtration Methods 0.000 claims description 3
- 238000009499 grossing Methods 0.000 claims description 3
- 230000000877 morphologic effect Effects 0.000 claims description 3
- 238000009792 diffusion process Methods 0.000 abstract description 2
- 238000013507 mapping Methods 0.000 abstract description 2
- 238000012795 verification Methods 0.000 abstract 1
- 230000008901 benefit Effects 0.000 description 3
- 230000000694 effects Effects 0.000 description 3
- 238000010586 diagram Methods 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 238000013459 approach Methods 0.000 description 1
- 230000000295 complement effect Effects 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000001419 dependent effect Effects 0.000 description 1
- 238000003745 diagnosis Methods 0.000 description 1
- 238000002474 experimental method Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000002156 mixing Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000011218 segmentation Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/11—Region-based segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/136—Segmentation; Edge detection involving thresholding
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/187—Segmentation; Edge detection involving region growing; involving region merging; involving connected component labelling
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/194—Segmentation; Edge detection involving foreground-background segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10004—Still image; Photographic image
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10024—Color image
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20021—Dividing image into blocks, subimages or windows
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20112—Image segmentation details
- G06T2207/20152—Watershed segmentation
Landscapes
- Engineering & Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Image Processing (AREA)
Abstract
The present invention proposes a kind of full-automatic prospect background segregation method based on binocular vision, in initial phase, local matching algorithmic preliminaries generate disparity map first, afterwards using initial parallax figure generation trimap, and assume that theoretical method solves initial opacity α based on color linear according to what Levin et al. was proposed.In the iteration optimization stage, the opacity information of left images is incorporated into cost aggregate function first strengthens disparity map, especially borderline region.Recycle enhanced disparity map and provide more reliably trimap to scratch figure, and be inserted into by the use of gradient of disparity as diffusion mapping in stingy figure formula.The whole continuous iteration of optimization process is until obtain satisfied result.There is good robustness by experimental verification this method, hence it is evident that reduce the error at disparity map boundary, improve the accuracy that image scratches figure.
Description
Technical Field
The invention belongs to the technical field of digital image processing, and particularly relates to a full-automatic foreground and background separation method based on binocular vision.
Background
In the field of machine vision, the binocular stereo vision technology has an increasingly important position, and the binocular stereo vision technology has wide application in the fields of medical diagnosis, mobile phone photography, image tracking and the like. The requirements for the quality of the depth image, especially the edge portion of the depth image, are becoming more and more demanding. It is difficult to generate very accurate depth map boundaries in conventional stereo matching algorithms. Therefore, a new method is necessary to compensate for the shortcomings of the stereo matching algorithm in this regard.
One promising approach is to take advantage of the rich border details that image matting implies. However, the existing classical matting algorithms require a user to firstly indicate a determined foreground part and a determined background part, and automatic matting cannot be realized. This greatly limits the scope of applications for matting, such as on cell phones. Worse, this makes the matting quality completely dependent on the representativeness of the foreground and background specified by the user, and if the background is not comprehensive before the certainty specified by the user, the matting effect is greatly reduced.
Disclosure of Invention
Aiming at the defects of the existing method, the invention aims to provide a full-automatic foreground and background separation method based on binocular vision. Image matting is considered to be a rough "depth map". Therefore, the depth map can provide reliable foreground and background segmentation for image matting, can automatically generate trimap, and meanwhile, the depth value can also provide new information for an image matting algorithm, so that the depth map is more accurate when multi-layer matting is realized. The invention combines the binocular stereo matching algorithm and the image matting algorithm, achieves the effect of mutual iterative enhancement, realizes automatic matting, does not need human-computer interaction, can make the technology more convenient, has wider application range, and can be applied to the existing binocular mobile phones.
The technical scheme of the invention is as follows:
a full-automatic foreground and background separation method based on binocular vision comprises the following steps:
s1, obtaining an initial disparity map by using a local matching algorithm on the binocular images subjected to line registration;
s2, automatically generating trimap by using the initial disparity map obtained in the step S1 to obtain an initial cutout;
s3, merging the cutout information in the initialized cutout obtained in the step S2 into the local matching algorithm in the step S1 to obtain an optimized disparity map;
s4 using the optimized disparity map obtained in step S3, optimizing the disparity and color information as a smooth item in step S2 to obtain an initialization cutout;
and S5, repeating the iteration steps S3 and S4 for more than 2 times, and outputting the final disparity map and the cutout.
In the invention:
the implementation method of step S1 is:
step S11: selecting a window with the size of (2n +1) × (2n +1) in the left image and the right image in the binocular image, and determining the candidate parallax value as D { -Dmax,…,-1,0,1,…,dmax}(dmaxRepresenting the maximum disparity range), the color distance cost C is calculatedIGradient distance costAnd the total matching cost function C:
wherein, x and y represent the horizontal and vertical directions of the pixel point p at the center of the windowThe coordinates D ∈ D, I and j are natural numbers Il、IrRespectively representing the pixel values of the corresponding pixel points of the left image and the right image in the binocular image,respectively representing gradient values at corresponding pixel points of left and right images in the binocular image, wherein lambda is the weight of the balance color and gradient information on the influence of the matching cost.
Step S12: selecting the optimal parallax value d of the pixel point p by using winnertaks allp。
Wherein d islpFor an initial disparity value, d, corresponding to a pixel point p on the left imagerpThe initial disparity value corresponding to the pixel point p on the right image.
Step S13: and traversing all windows with the size of (2n +1) × (2n +1) in the left image and the right image in the binocular image, obtaining the optimal parallax value of all pixel points according to the same method, and generating a left initial parallax image and a right initial parallax image.
The implementation method of step S2 is:
step S21: and (4) dividing the initial disparity map obtained in the step (S1) by using a watershed algorithm, and binarizing the divided disparity map into a foreground and a background according to a preset threshold value.
a. Calculating a gradient of the initial disparity map obtained in step S1, and performing a threshold process on the gradient:
g(x,y)=max(grad(d(x,y)),θ) (5)
where d (x, y) represents the disparity value of any point on the initial disparity map obtained in step S1, g (x, y) represents the gradient value of the point, θ is the threshold, and grad () is the gradient function.
b. And c, segmenting the gradient image obtained in the step a into a foreground part and a background part by using a watershed algorithm.
Step S22: and performing morphological corrosion on the foreground and the background obtained in the step S21, performing binarization to obtain the determined foreground and the determined background, and using a corroded part as an uncertainty area to obtain traimap.
Step S23: calculating the opacity alpha of each pixel point in the left image and the right image in the binocular image, and generating the corresponding initialization sectional drawing of the left image and the right image, wherein the energy function formula is as follows:
where L is a Laplace matrix, and the (i, j) th term is:
wherein,ijis the product of Crohn's disease, AiIs the RGB three-dimensional vector, mu, of a pixel pointkIs a binocular image with a window w of arbitrary size 3 × 3 in the left and right imageskInner vector AiIs calculated as the average vector of, | wkI is the number of pixel points in the window k, is a constant for ensuring numerical stability, Σ k is a 3 × 3 covariance matrix, I3Is an identity matrix of 3 × 3.
In step S3, the opacity α of each pixel point of the left and right images calculated in step S2 is integrated into the local matching algorithm in step S1 to obtain an optimized disparity map, and the implementation method thereof is as follows:
step S31: in the initialization cutout corresponding to the left and right images obtained in step S2, i.e., the left initialization cutout and the right initialization cutout, all windows with the size of (2n +1) × (2n +1) are traversed, and when the candidate disparity value is D ═ 1,2, …, DmaxCalculating the matching cost C of the corresponding initialization cutout opacities of the left image and the right imageα:
Wherein x and y represent the horizontal and vertical coordinates of the central pixel point p of the window, D ∈ D, αr、α1Respectively representing the opacity of corresponding points of the left initialization sectional drawing and the right initialization sectional drawing;
step S32: c is to beαAdding the calculated binocular disparity cost aggregation function into the formula (3), and calculating the optimized binocular disparity cost aggregation function:
C'(x,y,d)=C(x,y,d)+ξ·Cα(x,y,d) (9)
and xi is a balance parameter and the value range is [0,1 ].
Step S33: and (4) substituting the optimized binocular disparity cost obtained in the step (S32) into a formula (4) to obtain the optimal disparity values of the pixel points p in the left initialization cutout and the right initialization cutout, obtaining the optimal disparity values of all the pixel points in the left initialization cutout and the right initialization cutout according to the same method, and generating a left optimized disparity map and a right optimized disparity map.
In step S4, using the optimized disparity map obtained in step S3, using the disparity and the color information together as a smoothing term to perform weighted filtering on the opacity α of each pixel of the left and right images obtained in step S2, and obtaining an initialization matte in the optimization step S2;
wherein, WC、WDThe weights respectively representing the color and the parallax distance are calculated by the formula:
WC(I(i),I(j))=exp{-||Ii-Ij||2/wc} (9)
WD(d(i),d(j))=exp{-||di-dj||2/wd}
wherein, wc、wdThe parameters are respectively preset parameters for adjusting the distance weight of the color value I and the parallax value d.
The invention provides a full-automatic foreground and background separation method based on binocular vision. In the iterative optimization stage, opacity information of the left and right images is firstly fused into a cost aggregation function enhanced disparity map, especially a boundary region. And then, the enhanced disparity map is used for providing more reliable trimap for the matting, and the disparity gradient is used as diffusion mapping to be inserted into the matting formula. The whole optimization process is iterated continuously until a satisfactory result is obtained.
The invention combines binocular parallax and image matting algorithm, fully utilizes complementary information provided by the binocular parallax and image matting algorithm, and obtains high-quality parallax images and image matting through iterative optimization. The idea is to realize automatic generation and enhancement of image matting by means of a disparity map; and the effect of the disparity map is improved by utilizing rich boundary detail information contained in the image matting. Compared with a manual matting algorithm, the method and the device have the advantages that automatic matting is realized, the image regions which are difficult to label manually can be processed, and more accurate trimap can be obtained. Experiments prove that the algorithm has good robustness, the error at the boundary of the disparity map is obviously reduced, and the accuracy of image matting is improved.
Drawings
FIG. 1 is a flow chart of a fully automatic foreground and background separation method based on binocular vision according to the present invention;
FIG. 2 is a schematic diagram of obtaining trimap automatically according to the present invention.
FIG. 3 is a schematic diagram of the optimized enhanced depth map and matting of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
Referring to fig. 1, a flowchart of a full-automatic foreground and background separation method based on binocular vision in this embodiment is shown, which includes the following steps:
step S1: using a local matching algorithm to obtain an initial disparity map for the binocular images subjected to line registration;
step S11: selecting a window with the size of (2n +1) × (2n +1) in the left image and the right image in the binocular image, and determining the candidate parallax value as D { -Dmax,…,-1,0,1,…,dmax}(dmaxRepresenting the maximum disparity range), the color distance cost C is calculatedIDistance cost from gradientAnd the total matching cost function C:
wherein x and y represent the horizontal and vertical coordinates of a pixel point p positioned in the center of the window, D ∈ D, I and j are natural numbers, Il、IrRespectively representing the pixel values of the corresponding pixel points of the left image and the right image in the binocular image,respectively representing gradient values at corresponding pixel points of left and right images in the binocular image, wherein lambda is the weight of the balance color and gradient information on the influence of the matching cost.
Step S12: selecting the optimal parallax value d of the pixel point p by using winnertaks allp:
Wherein d islpFor an initial disparity value, d, corresponding to a pixel point p on the left imagerpThe initial disparity value corresponding to the pixel point p on the right image.
Step S13: and traversing all windows with the size of (2n +1) × (2n +1) in the left image and the right image in the binocular image, obtaining the optimal parallax value of all pixel points according to the same method, and generating a left initial parallax image and a right initial parallax image.
Step S2: referring to fig. 2, using the initial disparity map obtained in step S1 to automatically generate a trimap, so as to obtain an initial matte;
step S21: and (4) dividing the disparity map obtained in the step (S1) by using a watershed algorithm, and binarizing the divided disparity map into a foreground and a background according to a preset threshold value.
a, calculating a gradient of the initial disparity map obtained in the step S1, and carrying out threshold processing on the gradient:
g(x,y)=max(grad(d(x,y)),θ) (5)
where d (x, y) represents a disparity value of any point in the initial disparity map obtained in step S1, g (x, y) represents a gradient value of the point, θ is a threshold, and grad () is a gradient function.
b: b, segmenting the gradient image obtained in the step a into a foreground part and a background part by using a watershed algorithm,
step S22: and performing morphological corrosion on the foreground and the background obtained in the step S21, performing binarization to obtain the determined foreground and the determined background, and using a corroded part as an uncertainty area to obtain traimap.
Step S23: according to the theory of linear assumption based on color proposed by Levin et al, A.Levin, D.Lischinski, and Y.Weiss.2008.A closed form solution to natural image matching. IEEETrans.on PAMI,30(2): 228-:
where L is a Laplace matrix, and the (i, j) th term is:
wherein,ijis the product of Crohn's disease, AiIs the RGB three-dimensional vector, mu, of a pixel pointkIs a window w of arbitrary size 3 × 3 for left and right images of a binocular imagekInner vector AiIs calculated as the average vector of, | wkI is the number of pixel points in the window k, is a constant for ensuring numerical stability, Σ k is a 3 × 3 covariance matrix, I3Is an identity matrix of 3 × 3.
Step S3: blending the opacity of each pixel point of the left image and the right image obtained in the step S2 into the local matching algorithm in the step S1 to obtain an optimized disparity map;
step S31: in the initialization cutout corresponding to the left and right images obtained in step S2, i.e., the left initialization cutout and the right initialization cutout, all windows with the size of (2n +1) × (2n +1) are traversed, and when the candidate disparity value is D ═ 1,2, …, Dmax}(dmaxRepresenting the maximum parallax range), calculating the corresponding of the left and right imagesMatching cost C for initializing matting opacityα:
Wherein x and y represent the horizontal and vertical coordinates of the central pixel point p of the window, D ∈ D, αr、αlRepresenting left and right initialization matte corresponding point opacities, respectively.
Step S32: c is to beαAdding the calculated binocular disparity cost aggregation function into the formula (3), and calculating the optimized binocular disparity cost aggregation function:
C'(x,y,d)=C(x,y,d)+ξ·Cα(x,y,d) (9)
and xi is a balance parameter and the value range is [0,1 ].
Step S33: and (4) substituting the optimized binocular disparity cost obtained in the step (S32) into a formula (4) to obtain the optimal disparity values of the pixel points p in the left initialization cutout and the right initialization cutout, obtaining the optimal disparity values of all the pixel points in the left initialization cutout and the right initialization cutout according to the same method, and generating a left optimized disparity map and a right optimized disparity map.
Step S4: using the optimized disparity map obtained in step S3, performing weighted filtering on the opacity α of each pixel point of the left and right images obtained in step 2 by using the disparity and the color information as a smoothing term, and obtaining initialization matting in the optimization step S2:
wherein, WC、WDThe weights respectively representing the color and the parallax distance are calculated by the formula:
WC(I(i),I(j))=exp{-||Ii-Ij||2/wc} (9)
WD(d(i),d(j))=exp{-||di-dj||2/wd}
wherein, wc、wdThe parameters are respectively preset parameters for adjusting the distance weight of the color value I and the parallax value d.
Step five: and repeating the iteration steps S3 and S42-3 times, and outputting the final disparity map and the cutout, which are shown in figure 3.
The foregoing description of the preferred embodiments of the present invention has been included to describe the features of the invention in detail, and is not intended to limit the inventive concepts to the particular forms of the embodiments described, as other modifications and variations within the spirit of the inventive concepts will be protected by this patent. The subject matter of the present disclosure is defined by the claims, not by the detailed description of the embodiments.
Claims (6)
1. A full-automatic foreground and background separation method based on binocular vision is characterized by comprising the following steps:
s1, obtaining an initial disparity map by using a local matching algorithm on the binocular images subjected to line registration;
s2, automatically generating trimap by using the initial disparity map obtained in the step S1 to obtain an initial cutout;
s3, merging the cutout information in the initialized cutout obtained in the step S2 into the local matching algorithm in the step S1 to obtain an optimized disparity map;
s4 using the optimized disparity map obtained in step S3, optimizing the disparity and color information as a smooth item in step S2 to obtain an initialization cutout;
and S5, repeating the iteration steps S3 and S4 for more than 2 times, and outputting the final disparity map and the cutout.
2. The binocular vision based full-automatic foreground and background separation method of claim 1, wherein: the implementation method of step S1 is:
step S11: selecting a window with the size of (2n +1) × (2n +1) in the left image and the right image in the binocular image, and determining the candidate parallax value as D { -Dmax,…,-1,0,1,…,dmaxAt, calculate the color distance cost CIGradient distance costAnd the total matching cost function C:
<mrow> <msub> <mi>C</mi> <mi>I</mi> </msub> <mrow> <mo>(</mo> <mi>x</mi> <mo>,</mo> <mi>y</mi> <mo>,</mo> <mi>d</mi> <mo>)</mo> </mrow> <mo>=</mo> <munderover> <mo>&Sigma;</mo> <mrow> <mi>i</mi> <mo>=</mo> <mo>-</mo> <mi>n</mi> </mrow> <mi>n</mi> </munderover> <munderover> <mo>&Sigma;</mo> <mrow> <mi>j</mi> <mo>=</mo> <mo>-</mo> <mi>n</mi> </mrow> <mi>n</mi> </munderover> <mo>|</mo> <msub> <mi>I</mi> <mi>l</mi> </msub> <mrow> <mo>(</mo> <mi>x</mi> <mo>+</mo> <mi>i</mi> <mo>,</mo> <mi>y</mi> <mo>+</mo> <mi>j</mi> <mo>)</mo> </mrow> <mo>-</mo> <msub> <mi>I</mi> <mi>r</mi> </msub> <mrow> <mo>(</mo> <mi>x</mi> <mo>+</mo> <mi>d</mi> <mo>+</mo> <mi>i</mi> <mo>,</mo> <mi>y</mi> <mo>+</mo> <mi>j</mi> <mo>)</mo> </mrow> <mo>|</mo> <mo>-</mo> <mo>-</mo> <mo>-</mo> <mrow> <mo>(</mo> <mn>1</mn> <mo>)</mo> </mrow> </mrow>
<mrow> <msub> <mi>C</mi> <mo>&dtri;</mo> </msub> <mrow> <mo>(</mo> <mi>x</mi> <mo>,</mo> <mi>y</mi> <mo>,</mo> <mi>d</mi> <mo>)</mo> </mrow> <mo>=</mo> <munderover> <mo>&Sigma;</mo> <mrow> <mi>i</mi> <mo>=</mo> <mo>-</mo> <mi>n</mi> </mrow> <mi>n</mi> </munderover> <munderover> <mo>&Sigma;</mo> <mrow> <mi>j</mi> <mo>=</mo> <mo>-</mo> <mi>n</mi> </mrow> <mi>n</mi> </munderover> <mo>|</mo> <mo>&dtri;</mo> <msub> <mi>I</mi> <mi>l</mi> </msub> <mrow> <mo>(</mo> <mi>x</mi> <mo>+</mo> <mi>i</mi> <mo>,</mo> <mi>y</mi> <mo>+</mo> <mi>j</mi> <mo>)</mo> </mrow> <mo>-</mo> <mo>&dtri;</mo> <msub> <mi>I</mi> <mi>r</mi> </msub> <mrow> <mo>(</mo> <mi>x</mi> <mo>+</mo> <mi>d</mi> <mo>+</mo> <mi>i</mi> <mo>,</mo> <mi>y</mi> <mo>+</mo> <mi>j</mi> <mo>)</mo> </mrow> <mo>|</mo> <mo>-</mo> <mo>-</mo> <mo>-</mo> <mrow> <mo>(</mo> <mn>2</mn> <mo>)</mo> </mrow> </mrow>
<mrow> <mi>C</mi> <mrow> <mo>(</mo> <mi>x</mi> <mo>,</mo> <mi>y</mi> <mo>,</mo> <mi>d</mi> <mo>)</mo> </mrow> <mo>=</mo> <msub> <mi>C</mi> <mi>I</mi> </msub> <mrow> <mo>(</mo> <mi>x</mi> <mo>,</mo> <mi>y</mi> <mo>,</mo> <mi>d</mi> <mo>)</mo> </mrow> <mo>+</mo> <mi>&lambda;</mi> <mo>&CenterDot;</mo> <msub> <mi>C</mi> <mo>&dtri;</mo> </msub> <mrow> <mo>(</mo> <mi>x</mi> <mo>,</mo> <mi>y</mi> <mo>,</mo> <mi>d</mi> <mo>)</mo> </mrow> <mo>-</mo> <mo>-</mo> <mo>-</mo> <mrow> <mo>(</mo> <mn>3</mn> <mo>)</mo> </mrow> </mrow>
wherein x and y represent the horizontal and vertical coordinates of a pixel point p positioned in the center of the window, D ∈ D, I and j are natural numbers, Il、IrRespectively representing the pixel values of the corresponding pixel points of the left image and the right image in the binocular image,respectively representing gradient values at corresponding pixel points of left and right images in the binocular image, wherein lambda is the weight of the influence of balanced color and gradient information on the matching cost;
step S12: selecting the optimal parallax value d of the pixel point p by using winnertaks allp:
<mrow> <msub> <mi>d</mi> <mrow> <mi>l</mi> <mi>p</mi> </mrow> </msub> <mo>=</mo> <mi>arg</mi> <munder> <mrow> <mi>m</mi> <mi>i</mi> <mi>n</mi> </mrow> <mrow> <mi>d</mi> <mo>&Element;</mo> <mi>D</mi> <mo>,</mo> <mi>d</mi> <mo>></mo> <mn>0</mn> </mrow> </munder> <mi>C</mi> <mrow> <mo>(</mo> <mi>x</mi> <mo>,</mo> <mi>y</mi> <mo>,</mo> <mi>d</mi> <mo>)</mo> </mrow> <mo>-</mo> <mo>-</mo> <mo>-</mo> <mrow> <mo>(</mo> <mn>4</mn> <mo>)</mo> </mrow> </mrow>
<mrow> <msub> <mi>d</mi> <mrow> <mi>r</mi> <mi>p</mi> </mrow> </msub> <mo>=</mo> <mi>arg</mi> <munder> <mrow> <mi>m</mi> <mi>i</mi> <mi>n</mi> </mrow> <mrow> <mi>d</mi> <mo>&Element;</mo> <mi>D</mi> <mo>,</mo> <mi>d</mi> <mo><</mo> <mn>0</mn> </mrow> </munder> <mi>C</mi> <mrow> <mo>(</mo> <mi>x</mi> <mo>,</mo> <mi>y</mi> <mo>,</mo> <mi>d</mi> <mo>)</mo> </mrow> </mrow>
Wherein d islpFor an initial disparity value, d, corresponding to a pixel point p on the left imagerpThe initial parallax value corresponding to the pixel point p on the right image;
step S13: and traversing all windows with the size of (2n +1) × (2n +1) in the left image and the right image in the binocular image, obtaining the optimal parallax value of all pixel points according to the same method, and generating a left initial parallax image and a right initial parallax image.
3. The binocular vision based full-automatic foreground and background separation method of claim 2, wherein: the implementation method of S2 is:
step S21: dividing the initial disparity map obtained in the step S1 by using a watershed algorithm, and binarizing the divided disparity map into a foreground and a background according to a preset threshold;
step S22: performing morphological corrosion on the foreground and the background obtained in the step S21, performing binarization to obtain determined foreground and background, and using a corroded part as an uncertainty area to obtain traimap;
step S23: calculating the opacity alpha of each pixel point in the left image and the right image in the binocular image, and generating the corresponding initialization sectional drawing of the left image and the right image, wherein the energy function formula is as follows:
<mrow> <mi>J</mi> <mrow> <mo>(</mo> <mi>&alpha;</mi> <mo>)</mo> </mrow> <mo>=</mo> <munder> <mrow> <mi>m</mi> <mi>i</mi> <mi>n</mi> </mrow> <mrow> <mi>a</mi> <mo>,</mo> <mi>b</mi> </mrow> </munder> <msup> <mi>&alpha;</mi> <mi>T</mi> </msup> <mi>L</mi> <mi>&alpha;</mi> <mo>-</mo> <mo>-</mo> <mo>-</mo> <mrow> <mo>(</mo> <mn>6</mn> <mo>)</mo> </mrow> </mrow>1
where L is a Laplace matrix, and the (i, j) th term is:
<mrow> <mi>L</mi> <mrow> <mo>(</mo> <mi>i</mi> <mo>,</mo> <mi>j</mi> <mo>)</mo> </mrow> <mo>=</mo> <msub> <mi>&Sigma;</mi> <mrow> <mrow> <mo>(</mo> <mrow> <mi>i</mi> <mo>,</mo> <mi>j</mi> </mrow> <mo>)</mo> </mrow> <mo>&Element;</mo> <msub> <mi>w</mi> <mi>k</mi> </msub> </mrow> </msub> <mrow> <mo>(</mo> <msub> <mi>&delta;</mi> <mrow> <mi>i</mi> <mi>j</mi> </mrow> </msub> <mo>-</mo> <mfrac> <mn>1</mn> <mrow> <mo>|</mo> <msub> <mi>w</mi> <mi>k</mi> </msub> <mo>|</mo> </mrow> </mfrac> <mo>(</mo> <mrow> <mn>1</mn> <mo>+</mo> <mrow> <mo>(</mo> <mrow> <msub> <mi>A</mi> <mi>i</mi> </msub> <mo>-</mo> <msub> <mi>&mu;</mi> <mi>k</mi> </msub> </mrow> <mo>)</mo> </mrow> <msup> <mrow> <mo>(</mo> <mrow> <mi>&Sigma;</mi> <mi>k</mi> <mo>+</mo> <mfrac> <mi>&epsiv;</mi> <mrow> <mo>|</mo> <msub> <mi>w</mi> <mi>k</mi> </msub> <mo>|</mo> <msub> <mi>I</mi> <mn>3</mn> </msub> </mrow> </mfrac> </mrow> <mo>)</mo> </mrow> <mrow> <mo>-</mo> <mn>1</mn> </mrow> </msup> <mrow> <mo>(</mo> <mrow> <msub> <mi>A</mi> <mi>j</mi> </msub> <mo>-</mo> <msub> <mi>&mu;</mi> <mi>k</mi> </msub> </mrow> <mo>)</mo> </mrow> </mrow> <mo>)</mo> <mo>)</mo> </mrow> <mo>-</mo> <mo>-</mo> <mo>-</mo> <mrow> <mo>(</mo> <mn>7</mn> <mo>)</mo> </mrow> </mrow>
wherein,ijis the product of Crohn's disease, AiIs the RGB three-dimensional vector, mu, of a pixel pointkIs a binocular image with a window w of arbitrary size 3 × 3 in the left and right imageskInner vector AiIs calculated as the average vector of, | wkI is the number of pixel points in the window k, is a constant for ensuring numerical stability, Σ k is a 3 × 3 covariance matrix, I3Is an identity matrix of 3 × 3.
4. The binocular vision based full-automatic foreground and background separation method of claim 3, wherein: the implementation method of S21 is as follows:
a. calculating a gradient of the initial disparity map obtained in step S1, and performing a threshold process on the gradient:
g(x,y)=max(grad(d(x,y)),θ) (5)
wherein d (x, y) represents the disparity value of any point on the initial disparity map obtained in step S1, g (x, y) represents the gradient value of the point, θ is the threshold, and grad () is the gradient function;
b. and c, segmenting the gradient image obtained in the step a into a foreground part and a background part by using a watershed algorithm.
5. The binocular vision based full-automatic foreground-background separation method of claim 3 or 4, wherein: in step S3, the opacity α of each pixel point of the left and right images calculated in step S2 is integrated into the local matching algorithm in step S1 to obtain an optimized disparity map, and the implementation method thereof is as follows:
step S31: in the initialization cutout corresponding to the left and right images obtained in step S2, i.e., the left initialization cutout and the right initialization cutout, all windows with the size of (2n +1) × (2n +1) are traversed, and when the candidate disparity value is D ═ 1,2, …, DmaxCalculating the matching cost C of the corresponding initialization cutout opacities of the left image and the right imageα:
<mrow> <msub> <mi>C</mi> <mi>&alpha;</mi> </msub> <mrow> <mo>(</mo> <mi>x</mi> <mo>,</mo> <mi>y</mi> <mo>,</mo> <mi>d</mi> <mo>)</mo> </mrow> <mo>=</mo> <munderover> <mo>&Sigma;</mo> <mrow> <mi>i</mi> <mo>=</mo> <mo>-</mo> <mi>n</mi> </mrow> <mi>n</mi> </munderover> <munderover> <mo>&Sigma;</mo> <mrow> <mi>j</mi> <mo>=</mo> <mo>-</mo> <mi>n</mi> </mrow> <mi>n</mi> </munderover> <mo>|</mo> <msub> <mi>&alpha;</mi> <mi>l</mi> </msub> <mrow> <mo>(</mo> <mi>x</mi> <mo>+</mo> <mi>i</mi> <mo>,</mo> <mi>y</mi> <mo>+</mo> <mi>j</mi> <mo>)</mo> </mrow> <mo>-</mo> <msub> <mi>&alpha;</mi> <mi>r</mi> </msub> <mrow> <mo>(</mo> <mi>x</mi> <mo>+</mo> <mi>d</mi> <mo>+</mo> <mi>i</mi> <mo>,</mo> <mi>y</mi> <mo>+</mo> <mi>j</mi> <mo>)</mo> </mrow> <mo>|</mo> <mo>-</mo> <mo>-</mo> <mo>-</mo> <mrow> <mo>(</mo> <mn>8</mn> <mo>)</mo> </mrow> </mrow>
Wherein x and y represent the horizontal and vertical coordinates of the central pixel point p of the window, D ∈ D, αr、αlRespectively representing the opacity of corresponding points of the left initialization sectional drawing and the right initialization sectional drawing;
step S32: c is to beαAdding the calculated binocular disparity cost aggregation function into the formula (3), and calculating the optimized binocular disparity cost aggregation function:
C'(x,y,d)=C(x,y,d)+ξ·Cα(x,y,d) (9)
xi is a balance parameter, and the value range is [0,1 ];
step S33: and (4) substituting the optimized binocular disparity cost obtained in the step (S32) into a formula (4) to obtain the optimal disparity values of the pixel points p in the left initialization cutout and the right initialization cutout, obtaining the optimal disparity values of all the pixel points in the left initialization cutout and the right initialization cutout according to the same method, and generating a left optimized disparity map and a right optimized disparity map.
6. The binocular vision based full-automatic foreground and background separation method of claim 5, wherein: in step S4, using the optimized disparity map obtained in step S3, using the disparity and the color information together as a smoothing term to perform weighted filtering on the opacity α of each pixel of the left and right images obtained in step S2, and obtaining an initialization matte in the optimization step S2;
<mrow> <msup> <mi>&alpha;</mi> <mo>&prime;</mo> </msup> <mrow> <mo>(</mo> <mi>i</mi> <mo>)</mo> </mrow> <mo>=</mo> <mfrac> <mrow> <munder> <mi>&Sigma;</mi> <mrow> <mi>j</mi> <mo>&Element;</mo> <mi>W</mi> <mrow> <mo>(</mo> <mi>i</mi> <mo>)</mo> </mrow> </mrow> </munder> <msub> <mi>W</mi> <mi>C</mi> </msub> <mrow> <mo>(</mo> <mrow> <mi>I</mi> <mrow> <mo>(</mo> <mi>i</mi> <mo>)</mo> </mrow> <mo>,</mo> <mi>I</mi> <mrow> <mo>(</mo> <mi>j</mi> <mo>)</mo> </mrow> </mrow> <mo>)</mo> </mrow> <mo>&CenterDot;</mo> <msub> <mi>W</mi> <mi>D</mi> </msub> <mrow> <mo>(</mo> <mrow> <mi>d</mi> <mrow> <mo>(</mo> <mi>i</mi> <mo>)</mo> </mrow> <mo>,</mo> <mi>d</mi> <mrow> <mo>(</mo> <mi>j</mi> <mo>)</mo> </mrow> </mrow> <mo>)</mo> </mrow> <mo>&CenterDot;</mo> <mi>&alpha;</mi> <mrow> <mo>(</mo> <mi>i</mi> <mo>)</mo> </mrow> </mrow> <mrow> <munder> <mi>&Sigma;</mi> <mrow> <mi>j</mi> <mo>&Element;</mo> <mi>W</mi> <mrow> <mo>(</mo> <mi>i</mi> <mo>)</mo> </mrow> </mrow> </munder> <msub> <mi>W</mi> <mi>C</mi> </msub> <mrow> <mo>(</mo> <mrow> <mi>I</mi> <mrow> <mo>(</mo> <mi>i</mi> <mo>)</mo> </mrow> <mo>,</mo> <mi>I</mi> <mrow> <mo>(</mo> <mi>j</mi> <mo>)</mo> </mrow> </mrow> <mo>)</mo> </mrow> <mo>&CenterDot;</mo> <msub> <mi>W</mi> <mi>D</mi> </msub> <mrow> <mo>(</mo> <mrow> <mi>d</mi> <mrow> <mo>(</mo> <mi>i</mi> <mo>)</mo> </mrow> <mo>,</mo> <mi>d</mi> <mrow> <mo>(</mo> <mi>j</mi> <mo>)</mo> </mrow> </mrow> <mo>)</mo> </mrow> </mrow> </mfrac> <mo>-</mo> <mo>-</mo> <mo>-</mo> <mrow> <mo>(</mo> <mn>8</mn> <mo>)</mo> </mrow> </mrow>
wherein, WC、WDThe weights respectively representing the color and the parallax distance are calculated by the formula:
WC(I(i),I(j))=exp{-||Ii-Ij||2/wc} (9)
WD(d(i),d(j))=exp{-||di-dj||2/wd}
wherein, wc、wdThe parameters are respectively preset parameters for adjusting the distance weight of the color value I and the parallax value d.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710402285.5A CN107301642B (en) | 2017-06-01 | 2017-06-01 | A kind of full-automatic prospect background segregation method based on binocular vision |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710402285.5A CN107301642B (en) | 2017-06-01 | 2017-06-01 | A kind of full-automatic prospect background segregation method based on binocular vision |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107301642A true CN107301642A (en) | 2017-10-27 |
CN107301642B CN107301642B (en) | 2018-05-15 |
Family
ID=60137891
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710402285.5A Active CN107301642B (en) | 2017-06-01 | 2017-06-01 | A kind of full-automatic prospect background segregation method based on binocular vision |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107301642B (en) |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108682026A (en) * | 2018-03-22 | 2018-10-19 | 辽宁工业大学 | A kind of binocular vision solid matching method based on the fusion of more Matching units |
CN109493363A (en) * | 2018-09-11 | 2019-03-19 | 北京达佳互联信息技术有限公司 | A kind of FIG pull handle method, apparatus and image processing equipment based on geodesic distance |
CN109544622A (en) * | 2018-11-06 | 2019-03-29 | 深圳市爱培科技术股份有限公司 | A kind of binocular vision solid matching method and system based on MSER |
CN109544619A (en) * | 2018-11-06 | 2019-03-29 | 深圳市爱培科技术股份有限公司 | A kind of binocular vision solid matching method cut based on figure and system |
CN109741389A (en) * | 2018-11-27 | 2019-05-10 | 华南农业大学 | One kind being based on the matched sectional perspective matching process of region base |
CN110751668A (en) * | 2019-09-30 | 2020-02-04 | 北京迈格威科技有限公司 | Image processing method, device, terminal, electronic equipment and readable storage medium |
CN110889866A (en) * | 2019-12-04 | 2020-03-17 | 南京美基森信息技术有限公司 | Background updating method for depth map |
CN116703813A (en) * | 2022-12-27 | 2023-09-05 | 荣耀终端有限公司 | Image processing method and apparatus |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090060366A1 (en) * | 2007-08-27 | 2009-03-05 | Riverain Medical Group, Llc | Object segmentation in images |
CN103955918A (en) * | 2014-04-03 | 2014-07-30 | 吉林大学 | Full-automatic fine image matting device and method |
-
2017
- 2017-06-01 CN CN201710402285.5A patent/CN107301642B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090060366A1 (en) * | 2007-08-27 | 2009-03-05 | Riverain Medical Group, Llc | Object segmentation in images |
CN103955918A (en) * | 2014-04-03 | 2014-07-30 | 吉林大学 | Full-automatic fine image matting device and method |
Cited By (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108682026A (en) * | 2018-03-22 | 2018-10-19 | 辽宁工业大学 | A kind of binocular vision solid matching method based on the fusion of more Matching units |
CN108682026B (en) * | 2018-03-22 | 2021-08-06 | 江大白 | Binocular vision stereo matching method based on multi-matching element fusion |
CN109493363A (en) * | 2018-09-11 | 2019-03-19 | 北京达佳互联信息技术有限公司 | A kind of FIG pull handle method, apparatus and image processing equipment based on geodesic distance |
CN109493363B (en) * | 2018-09-11 | 2019-09-27 | 北京达佳互联信息技术有限公司 | A kind of FIG pull handle method, apparatus and image processing equipment based on geodesic distance |
CN109544622A (en) * | 2018-11-06 | 2019-03-29 | 深圳市爱培科技术股份有限公司 | A kind of binocular vision solid matching method and system based on MSER |
CN109544619A (en) * | 2018-11-06 | 2019-03-29 | 深圳市爱培科技术股份有限公司 | A kind of binocular vision solid matching method cut based on figure and system |
CN109741389A (en) * | 2018-11-27 | 2019-05-10 | 华南农业大学 | One kind being based on the matched sectional perspective matching process of region base |
CN110751668A (en) * | 2019-09-30 | 2020-02-04 | 北京迈格威科技有限公司 | Image processing method, device, terminal, electronic equipment and readable storage medium |
CN110751668B (en) * | 2019-09-30 | 2022-12-27 | 北京迈格威科技有限公司 | Image processing method, device, terminal, electronic equipment and readable storage medium |
CN110889866A (en) * | 2019-12-04 | 2020-03-17 | 南京美基森信息技术有限公司 | Background updating method for depth map |
CN116703813A (en) * | 2022-12-27 | 2023-09-05 | 荣耀终端有限公司 | Image processing method and apparatus |
CN116703813B (en) * | 2022-12-27 | 2024-04-26 | 荣耀终端有限公司 | Image processing method and apparatus |
Also Published As
Publication number | Publication date |
---|---|
CN107301642B (en) | 2018-05-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107301642A (en) | A kind of full-automatic prospect background segregation method based on binocular vision | |
Tong et al. | Saliency detection with multi-scale superpixels | |
CN107274419B (en) | Deep learning significance detection method based on global prior and local context | |
CN102799669B (en) | Automatic grading method for commodity image vision quality | |
Seo et al. | Mixnerf: Modeling a ray with mixture density for novel view synthesis from sparse inputs | |
CN104504745B (en) | A kind of certificate photo generation method split based on image and scratch figure | |
CN102651135B (en) | Optimized direction sampling-based natural image matting method | |
CN103080979B (en) | From the system and method for photo synthesis portrait sketch | |
CN108320294B (en) | Intelligent full-automatic portrait background replacement method for second-generation identity card photos | |
Ju et al. | BDPK: Bayesian dehazing using prior knowledge | |
CN104966286A (en) | 3D video saliency detection method | |
CN112288758B (en) | Infrared and visible light image registration method for power equipment | |
Hua et al. | Extended guided filtering for depth map upsampling | |
CN107886471B (en) | Method for removing redundant objects of photo based on super-pixel voting model | |
CN104835146A (en) | Salient object segmenting method in stereo image based on depth information and image cutting | |
Du et al. | Improving RGBD saliency detection using progressive region classification and saliency fusion | |
CN107085848A (en) | Method for detecting significance of RGB-D (Red, Green and blue-D) image | |
CN108305260A (en) | Detection method, device and the equipment of angle point in a kind of image | |
CN106952292B (en) | 3D moving object detection method based on 6-degree-of-freedom scene stream clustering | |
CN107016698A (en) | Based on tapered plane smooth binocular solid matching process and device | |
CN104537381B (en) | A kind of fuzzy image recognition method based on fuzzy invariant features | |
CN116580028A (en) | Object surface defect detection method, device, equipment and storage medium | |
CN107452003A (en) | A kind of method and device of the image segmentation containing depth information | |
Wang | Image matting with transductive inference | |
CN107122782A (en) | A kind of half intensive solid matching method in a balanced way |
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 |