CN104200470B - Blue screen image-matting method - Google Patents

Blue screen image-matting method Download PDF

Info

Publication number
CN104200470B
CN104200470B CN201410436813.5A CN201410436813A CN104200470B CN 104200470 B CN104200470 B CN 104200470B CN 201410436813 A CN201410436813 A CN 201410436813A CN 104200470 B CN104200470 B CN 104200470B
Authority
CN
China
Prior art keywords
image
pixel
blue screen
opacity
video
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.)
Expired - Fee Related
Application number
CN201410436813.5A
Other languages
Chinese (zh)
Other versions
CN104200470A (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.)
University of Electronic Science and Technology of China
Original Assignee
University of Electronic Science and Technology of China
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 University of Electronic Science and Technology of China filed Critical University of Electronic Science and Technology of China
Priority to CN201410436813.5A priority Critical patent/CN104200470B/en
Publication of CN104200470A publication Critical patent/CN104200470A/en
Application granted granted Critical
Publication of CN104200470B publication Critical patent/CN104200470B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses a blue screen image-matting method. The blue screen image-matting method comprises the following steps of: transferring a video into a GPU, and carrying out blue screen image-matting processing on a video frame in the GPU, thus increasing the image-matting speed. Specifically, the blue screen image-matting method comprises the following steps of: extracting a background colour from the video frame, carrying out non-transparency processing on a blue screen image by virtue of a chromatic aberration image-matting technology, then obtaining an initial non-transparency image through binarization processing, then optimizing the initial non-transparency by virtue of the gradient information of a colour image and an improved combined bilateral filter to obtain a final non-transparency image, and finally carrying out background colour overflow removal on the final non-transparency image and then returning the final non-transparency image to a CPU client, and displaying through a display device. In this way, human interaction and parameter adjustment are greatly reduced during the whole processing process.

Description

A kind of blue screen matting method
Technical field
The invention belongs to visual effect field, more specifically, it is related to a kind of blue screen matting method.
Background technology
Stingy figure refers to accurately extract a kind of technology of foreground object from image or video sequence.Stingy diagram technology conduct A kind of key technology in visual effect field, is widely used in the fields such as picture editting and film making.But due to scratching figure The underconstrained of problem, needs when solving this problem to increase extra constraints, therefore in production of film and TV, generally using blue Screen or green screen as shooting background, to reduce the solution difficulty of this problem with this, this using blue screen or green screen as background Stingy diagram technology be generally termed blue screen matting technology.
Blue screen matting develops into and has created many different technology today.Common blue screen matting technology mainly has: Figure (Luma Keying), difference sectional drawing (Difference Keying), the stingy figure (Chroma Keying) of colourity, color are scratched in brightness Difference scratches figure (Color Difference Keying), 3D scratches figure (3D Keying).
Brightness is scratched diagram technology and is solved opacity using the monochrome information of image.For given RGB Three Channel Color Image, first converts it to HLS color space, then takes luminance channel L to carry out binarization operation, the result obtaining is prospect Opacity.Simple hard -threshold operation would generally cause the serious loss of edge and translucency information, therefore, answers actual With in be usually taken soft-threshold operation, that is, define a gradual change scope so that opacity is from 0 to 1 smooth variation.Due to this Technology only considered the monochrome information of image during stingy figure, without considering the colouring information of image, therefore, for most Number image, the method effect is not ideal enough.
Difference sectional drawing technology Utilization prospects image solves opacity with the difference of background image.Difference sectional drawing technology is to the back of the body Scape does not have strict restriction, is applicable not only to color background, for equally applicable during background color complexity.However, due to Difference sectional drawing technology needs background image it is known that therefore its range receives certain restriction.
Colourity is scratched diagram technology and utilizes the colouring information of image to solve opacity.For given RGB Three Channel Color figure Picture, converts it to HLS space first, then enters row threshold division to H passage and asks for opacity.In actual applications, it is subject to The impact of the environmental factorss such as illumination, background color occurs certain fluctuation it is therefore desirable to arrange a soft-threshold.However, H leads to Although colouring information can be preferably distinguished in road, for the frame of video of compression, usually blocky effect in H passage (blocky).In order to improve stingy figure precision, generally colourity (H), brightness (L), three passages of saturation (S) are combined.With The stingy diagram technology of single channel is compared, and the joint three-channel stingy diagram technology of H, L, S is more accurate, and weak point is to need to adjust Parameter is more, and man-machine interactively is than larger.
Aberration is scratched diagram technology and is solved opacity using the three-channel color distortion of R, G, B., right taking blue screen video as a example In input video frame I, its opacity is expressed as α=IB-MAX(IR,IG).Aberration scratch diagram technology fairly simple, speed and Do not need to carry out threshold decision, however, effect is not ideal enough.
3D scratches diagram technology and refers at three-dimensional color space (RGB, HLS etc.), and the space length according to pixel solves opaque Degree.Because the color variation range of background is less, a 3D shape therefore can be defined in three dimensions by foreground and background Make a distinction.This 3D shape can be spheroid, cube, spheroid etc.., in order to obtain gradual change not taking simple spheroid as a example Transparency, needs to define small one and large one two spheroids, and the pixel inside spherula is background, and the pixel beyond big spheroid is front Scape, marginal pixel belongs to transitional region, and opacity changes between 0 to 1.Although 3D scratches diagram technology and can obtain Preferably effect, but speed and man-machine interactively still need to be improved further.
As seen from the above analysis, existing blue screen matting technology is in stingy figure speed, on stingy plot quality and man-machine interactively Preferable effect can not be obtained, therefore, it is necessary that blue screen matting technology is carried out furtheing investigate simultaneously.
Content of the invention
It is an object of the invention to overcoming the deficiencies in the prior art, provide a kind of blue screen matting method, by right in GPU Frame of video carries out blue screen matting process, has that stingy figure speed is fast, and stingy figure effect is good, and does not need to adjust too many parameter and artificial The advantages of interaction.
For achieving the above object, a kind of present invention blue screen matting method is it is characterised in that comprise the following steps:
(1), transmission video is to GPU
GPU is initialized;Pass through video input, output interface at CPU end to GPU end application texture memory, constant Internal memory and global memory;
After the application internal memory success of CPU end, again by video input, output interface, frame of video is delivered to texture memory, The parameter vector of video is delivered to constant internal memory, the width background composograph chosen is delivered to global memory simultaneously;
(2), the parallel computing threads block of GPU is processed to video
Read frame of video from texture memory, read the parallel computation of the parameter vector of video to GPU from constant internal memory All frame of video are processed in the parallel computing threads block of GPU by thread block respectively;
(2.1), extract background colour
Using the first two field picture of video as blue screen image, then the parameter vector reading video obtains the structure of blue screen image Information;
First two field picture of video is transformed into HLS color space from RGB color, to HLS color space The color of image of middle H passage carries out statistical color histogram, using the maximum color of the color histogram in figure frequency of occurrences as background Color;
(2.2), obtain the initial opacity of blue screen image
The background colour obtaining with reference to step (2.1), scratches diagram technology using aberration and each pixel of blue screen image is carried out Opacity is processed, that is, pass through formula α 'i=Iikey-MAX(Ii,I'i), obtain α 'i, wherein, i=1,2 ..., n, n represent blue screen The number of pixel, I in imageikeyRepresent pixel in BRG space with background colour identical passage color value, Ii, I'iPoint Biao Shi not pixel two other passage color value, all of α ' in BRG spaceiForm a width Trimap figure, more right Each pixel of Trimap in figure carries out binary conversion treatment, obtains initial opacity α of each pointi, all of αiComposition one Width initial opacity image;
(2.3), using the gradient information of blue screen image, edge supplement is carried out to initial opacity image
In the gradient information of the blue screen image of rgb space it is:
F θ ( x , y ) = { 1 2 [ ( g xx + g yy ) + ( g xx - g yy ) cos 2 θ + 2 g xy sin 2 θ ] } 1 / 2 - - - ( a )
θ xy = 1 2 arctan [ 2 g xy ( g xx - g yy ) ] - - - ( b )
Wherein, Fθ(x, y) represents the opacity of blue screen image, θxyRepresent blue screen image in the maximum change in coordinate (x, y) place The direction of rate, gxx、gyyAnd gxyComputing formula as follows:
g xx = | ∂ R ∂ x | 2 + | ∂ G ∂ x | 2 + | ∂ B ∂ x | 2
g yy = | ∂ R ∂ y | 2 + | ∂ G ∂ y | 2 + | ∂ B ∂ y | 2 - - - ( c )
g xy = ∂ R ∂ x ∂ R ∂ y + ∂ G ∂ x ∂ G ∂ y + ∂ B ∂ x ∂ B ∂ y
F is obtained according to formula (b)θ(x, y) two angle values being separated by 90 °, that is, formula (b) and two orthogonal directions is every Individual pixel is related, then for each pixel, take FθThe angle value of (x, y) two orthogonal directions, by two angle values Big value is designated as Fi
Compare the F of each pixeliValue and αiValue, take maximum between the two as each pixel edge supplement after Opacity, i.e. αinew=MAX (αi,Fi), all of αinewForm the opacity image after a width edge supplement;
(2.4), the opacity image after edge supplement is filtered optimize using improved joint two-sided filter
Using the opacity image after edge supplement as noise image, then the structural information of blue screen image is delivered to makes an uproar In acoustic image, it is filtered processing by improved joint two-sided filter;
α jb ( p ) = Σ q ∈ Ω ( p ) f ( p - q ) · g ( I ( p ) - I ( q ) ) · α ( q ) Σ q ∈ Ω ( p ) f ( p - q ) · g ( I ( p ) - I ( q ) ) - - - ( d )
Wherein, functionX=p-q represents the coordinate difference of two pixels, in indexRepresent model Number, can carry out Multi-dimension calculation, σsRepresent Gaussian kernel width parameter;P represents a pixel, and Ω (p) represents centered on p Neighborhood window, q represents the pixel in Ω (p), functionT represents colour-difference, and t=I (p)-I (q) represents Two pixels R, G, channel B colour-difference, I (p) represents the color value of pixel p in the RGB blue screen image of input, α (q) Represent the opacity after the edge supplement of q pixel, αjbP () represents opacity after being filtered for the p pixel, lead to Cross and each pixel is filtered optimize, obtain final opacity image;
(2.5), remove background colour to overflow and image synthesis
Final opacity image and blue screen image are carried out and operation, obtains foreground image F, then complete from GPU Intra-office deposits middle reading background composograph, then passes through to synthesize equation C=α F+ (1- α) B synthesis with foreground image, is initially closed Image C, wherein F is become to represent foreground image, B represents background composograph, and α represents final opacity image;
Each pixel in initial composograph C is compared with the color value of background colour in the color value of H passage, If their difference value is less than 1, that is, needs to suppress background colour to overflow, then pass through formula (e) to reduce the saturation of pixel,
f(hpixel)=A × sin (2 π × (hkey+(0.25-hpixel)))-(A-1.5) (e)
Wherein, f (hpixel) for saturation reduction degree, hkeyRepresent the color value of background colour in image, hpixelRepresent The color value of pixel, A is constant;
If the difference of the color value of the color value of pixel H passage and background colour is more than or equal to 1, pixel full Keep constant with degree;
By processing to each of initial composograph C pixel, obtain final composograph, then will finally close Image is become to pass back to caching in CPU;
After the completion of the first two field picture is processed, process according to step (2.1)~(2.5) and continue with the second two field picture, directly After the completion of processing to all of video frame images, by video input, output interface, the imagery exploitation display device of synthesis is shown Show;
(3), internal memory release
The memory headroom of distribution on CPU and GPU is discharged after image shows and terminates.
The goal of the invention of the present invention is realized in:
A kind of present invention blue screen matting method, first by delivery of video in GPU, by carrying out indigo plant to frame of video in GPU Screen FIG pull handle, which enhances the speed of stingy figure.Concretely, first to video frame extraction background colour, according to background colour, utilize Aberration is scratched diagram technology and is carried out opacity process to blue screen image, then obtains initial opacity figure after binary conversion treatment Picture, is then optimized to initial opacity and is obtained using the gradient information and improved joint two-sided filter of coloured image Final opacity image, finally final opacity image is carried out background colour overflow remove after pass back to CPU client, lead to Cross display device to show.In whole processing procedure, so greatly reduce the adjustment of man-machine interactively and parameter.
Meanwhile, blue screen matting method of the present invention also has the advantages that:
(1), in the present invention, all of blue screen matting processes and all places process in GPU, so makes whole blue screen matting flow process Speed accelerate;
(2), all parameters in the present invention are essentially fixed value it is not necessary to artificial adjusted, and which reduce man-machine interactively, It is a kind of full automatic blue screen video matting method;
(3) present invention utilizes the gradient information of coloured image and improved joint two-sided filter are to initially opaque Degree is optimized, and so makes to scratch figure effect more preferably, applies also for translucent object or tiny hair equalization requires higher occasion;
(4), traditional joint two-sided filter is to be accurately transfer to the structural information of muting flash image It is achieved that the efficient denoising of no-flash image in no-flash image with noise;Being inspired the present invention by this is to there will be saw The blue screen image structural information inputting, as noise image, is transmitted by the opacity image of tooth effect by joint bilateral filtering To opacity image, this overcome the office that traditional joint two-sided filter only processes two three-channel coloured images Limit, becomes one three-channel coloured image of process and a width gray level image, thus reaching the purpose optimizing opacity image.
Brief description
Fig. 1 is the flow chart of blue screen matting method of the present invention;
Fig. 2 is the color histogram in H passage for the frame of video;
Fig. 3 is the initial opacity obtaining blue screen image;
Fig. 4 is that initial opacity image carries out the forward and backward comparison diagram of edge supplement;
Opacity image after Fig. 5 is edge supplement is filtered optimizing forward and backward comparison diagram;
Fig. 6 is to remove the composite diagram after background colour overflows.
Specific embodiment
Below in conjunction with the accompanying drawings the specific embodiment of the present invention is described, so that those skilled in the art is preferably Understand the present invention.Requiring particular attention is that, in the following description, when known function and design detailed description perhaps Can desalinate the present invention main contents when, these descriptions will be ignored here.
Embodiment
Fig. 1 is the flow chart of blue screen matting method of the present invention.
In the present embodiment, using OpenCV as the input of video, output interface, as shown in figure 1, a kind of blue screen of the present invention Stingy drawing method, comprises the following steps:
S1, transmission video to GPU
GPU is initialized;CPU end is passed through OpenCV and is applied in texture memory, constant internal memory and the overall situation to GPU end Deposit;
After the application internal memory success of CPU end, again by OpenCV, frame of video is delivered to texture memory, by the parameter of video Vector is delivered to constant internal memory, the width background composograph chosen is delivered to global memory simultaneously, wherein, parameter vector bag Include the resolution including video, frame number, frame per second etc.;
The parallel computing threads block of S2, GPU is processed to video
Read frame of video from texture memory, read the parallel computation of the parameter vector of video to GPU from constant internal memory All frame of video are processed in the parallel computing threads block of GPU by thread block respectively;
S2.1, extraction background colour
Using the first two field picture of video as blue screen image, then the parameter vector reading video obtains the structure of blue screen image Information, its structural information includes the number of blue screen image length, width and pixel;By the first two field picture of video from RGB Color space conversion, to being transformed into HLS color space, carries out color histogram to the color of image of H passage in HLS color space Statistics, using the maximum color of the color histogram in figure frequency of occurrences as background colour;In the present embodiment, the selection of background colour is generally Blue, red, green three kinds of colors, as shown in Fig. 2 the maximum color of the color histogram in figure frequency of occurrences is blueness, will blue conduct Background colour;
S2.2, the initial opacity of acquisition blue screen image
In the present embodiment, as shown in figure 3, the background colour blueness obtaining with reference to step S2.1, scratch diagram technology pair using aberration Each pixel of Fig. 3 (a) blue screen image carries out opacity process, is represented by α ' by formulai=IiB-MAX(IiR, IiG), obtain α 'i, wherein, i=1,2 ..., n, n represent the number of pixel in blue screen image, IiB、IiR、IiGRepresent picture respectively Vegetarian refreshments is in the corresponding color value of B, R, G passage, all of α 'iForm a width Trimap figure, such as shown in Fig. 3 (b), then to Trimap Each pixel of in figure carries out binary conversion treatment, obtains initial opacity α of each pixeli, all of αiForm a width Initial opacity image, such as shown in Fig. 3 (c);
In the present embodiment, when carrying out binary conversion treatment, threshold value M is set to 0.5, when the opacity of pixel is more than Or when being equal to threshold values 0.5, opacity value is set to 0, and as background, when the opacity of pixel is less than 0.5, will be opaque Angle value is set to 1, i.e. prospect;
S2.3, using the gradient information of blue screen image, edge supplement is carried out to initial opacity image
In the present embodiment, such as shown in Fig. 3 (c), the binary conversion treatment of blue screen image result in the serious loss of edge details, In order to recover the marginal information of blue screen image, need to carry out edge reparation to initial opacity, therefore, introduce blue screen image Gradient information edge supplement is carried out to initial opacity image;
If the gradient information of the blue screen image of any rgb space is:
F θ ( x , y ) = { 1 2 [ ( g xx + g yy ) + ( g xx - g yy ) cos 2 θ + 2 g xy sin 2 θ ] } 1 / 2 - - - ( a )
θ xy = 1 2 arctan [ 2 g xy ( g xx - g yy ) ] - - - ( b )
Wherein, Fθ(x, y) represents the opacity of blue screen image, θxyRepresent blue screen image in the maximum change in coordinate (x, y) place The direction of rate, gxx、gyyAnd gxyComputing formula as follows:
g xx = | ∂ R ∂ x | 2 + | ∂ G ∂ x | 2 + | ∂ B ∂ x | 2
g yy = | ∂ R ∂ y | 2 + | ∂ G ∂ y | 2 + | ∂ B ∂ y | 2 - - - ( c )
g xy = ∂ R ∂ x ∂ R ∂ y + ∂ G ∂ x ∂ G ∂ y + ∂ B ∂ x ∂ B ∂ y
Understood according to formula (a):Fθ(x, y)=Fθ+π(x, y), thus F only need to half open interval [0, π) upper calculate θ's Value, further, since tan (α)=tan (α ± π), if so θ0It is a solution of formula (b), then θ0± pi/2 also can be this One solution of equation.F is obtained according to formula (b)θ(x, y) two angle values being separated by 90 °, i.e. formula (b) side orthogonal with two To each pixel related, it means that in this two orthogonal directions, the F value maximum in one of them direction, and another The F value in individual direction is minimum, then for each pixel, take FθThe angle value of (x, y) two orthogonal directions, by two angle values Maximum is designated as Fi
Compare the F of each pixeliValue and αiValue, take maximum between the two as each pixel edge supplement after Opacity, i.e. αinew=MAX (αi,Fi), all of αinewForm the opacity image after a width edge supplement;
In the present embodiment, Fig. 4 (a) is the blue screen image of input, and Fig. 4 (b) is that blue screen image scratches figure and two-value through aberration Initial opacity image after change process, Fig. 4 (c) is the opacity image after edge supplement, can from figure Go out, after edge supplement, the edge of opacity is more smooth, and detailed information is more rich;
S2.4, using improved joint two-sided filter the opacity image after edge supplement is filtered optimize
In the present embodiment, such as shown in Fig. 4 (c), edge supplement makes the marginal information of initial opacity image obtain Recover, but because the crenellated phenomena that binary conversion treatment causes is not eliminated, therefore we again to after edge supplement not Transparency image is filtered optimizing;
Using the opacity image after Fig. 5 (b) edge supplement as noise image, then the structure by Fig. 5 (a) blue screen image Information transmission, in noise image, is filtered processing by improved joint two-sided filter;
α jb ( p ) = Σ q ∈ Ω ( p ) f ( p - q ) · g ( I ( p ) - I ( q ) ) · α ( q ) Σ q ∈ Ω ( p ) f ( p - q ) · g ( I ( p ) - I ( q ) ) - - - ( d )
Wherein, functionX=p-q represents the coordinate difference of two pixels, in indexRepresent model Number, can carry out Multi-dimension calculation, σsRepresent Gaussian kernel width parameter;P represents a pixel, and Ω (p) represents centered on p Neighborhood window, q represents the pixel in Ω (p), functionT represents colour-difference, and t=I (p)-I (q) represents Two pixels R, G, channel B colour-difference, α (q) represents the opacity after the edge supplement of q pixel, αjbP () represents Opacity after being filtered for the p pixel, by being filtered to each pixel optimizing, obtains final opaque Degree image, such as shown in Fig. 5 (c), it can be seen that after improved joint two-sided filter filtering, not only by indigo plant The structural information of screen image has been delivered in noise image, and has carried out guarantor side and smoothed, and is formed during making binary conversion treatment Edge sawtooth eliminate;
S2.5, removal background colour overflow and image synthesis
Final opacity image and blue screen image are carried out and operation, obtains foreground image F, then complete from GPU Intra-office deposits middle reading background composograph, then passes through to synthesize equation C=α F+ (1- α) B synthesis with foreground image, is initially closed Image C, wherein F is become to represent foreground image, B represents background composograph, and α represents final opacity image;The present embodiment In, initial composograph is as shown in Figure 6;
Each pixel in initial composograph is compared with the color value of background colour in the color value of H passage, If their difference value is less than 1, that is, need the spilling of suppression background colour, then pass through formula (e) to reduce the full of pixel And degree,
f(hpixel)=A × sin (2 π × (hkey+(0.25-hpixel)))-(A-1.5) (e)
Wherein, f (hpixel) for saturation reduction degree, hkeyRepresent the color value of background colour, hpixelRepresent pixel Color value, A be constant;In the present embodiment, the value of A is 3, as f (hpixel) < 0 when, take f (hpixel)=0, works as f (hpixel) > 1 when, take f (hpixel)=1;
If the difference of the color value of the color value of pixel H passage and background colour is more than or equal to 1, pixel full Keep constant with degree;
By processing to each of initial composograph C pixel, obtain final composograph, as shown in fig. 6, Again final composograph is passed back to caching in CPU;
After the completion of the first two field picture is processed, continue with the second two field picture according to step S2.1~S2.5 process, until After the completion of all of video frame images are processed, by video input, output interface, the imagery exploitation display device synthesizing is shown;
S3, internal memory release
The memory headroom of distribution on CPU and GPU is discharged after video shows and terminates.
Although to the present invention, illustrative specific embodiment is described above, in order to the technology of the art Personnel understand the present invention, the common skill it should be apparent that the invention is not restricted to the scope of specific embodiment, to the art For art personnel, as long as various change is in the spirit and scope of the present invention of appended claim restriction and determination, these Change is it will be apparent that all utilize the innovation and creation of present inventive concept all in the row of protection.

Claims (3)

1. a kind of blue screen matting method is it is characterised in that comprise the following steps:
(1), transmission video is to GPU
GPU is initialized;Pass through video input, output interface at CPU end to GPU end application texture memory, constant internal memory And global memory;
After the application internal memory success of CPU end, again by video input, output interface, frame of video is delivered to texture memory, will regard The parameter vector of frequency is delivered to constant internal memory, the width background composograph chosen is delivered to global memory simultaneously;
(2), the parallel computing threads block of GPU is processed to video
Read frame of video from texture memory, read the parallel computing threads of the parameter vector of video to GPU from constant internal memory All frame of video are processed in the parallel computing threads block of GPU by block respectively;
(2.1), extract background colour
Using the first two field picture of video as blue screen image, then the parameter vector reading video obtains the structure letter of blue screen image Breath;
First two field picture of video is transformed into HLS color space from RGB color, H in HLS color space is led to The color of image in road carries out statistical color histogram, using the maximum color of the color histogram in figure frequency of occurrences as background colour;
(2.2), obtain the initial opacity of blue screen image
The background colour obtaining with reference to step (2.1), is carried out impermeable using the stingy diagram technology of aberration to each pixel of blue screen image Lightness is processed, that is, pass through formula α 'i=Iikey-MAX(Ii,I'i), obtain αi', wherein, i=1,2 ..., n, n represent blue screen image The number of middle pixel, IikeyRepresent pixel in BRG space with background colour identical passage color value, Ii, I'iTable respectively Show pixel two other passage color value, all of α ' in BRG spaceiForm a width Trimap figure, then Trimap is schemed In each pixel carry out binary conversion treatment, obtain each point initial opacity αi, all of αiForm a width initial not Transparency image;
(2.3), using the gradient information of blue screen image, edge supplement is carried out to initial opacity image
In the gradient information of the blue screen image of rgb space it is:
F θ ( x , y ) = { 1 2 [ ( g x x + g y y ) + ( g x x - g y y ) c o s 2 θ x y + 2 g x y s i n 2 θ x y ] } 1 / 2 - - - ( a )
θ x y = 1 2 a r c t a n [ 2 g x y ( g x x - g y y ) ] - - - ( b )
Wherein, Fθ(x, y) represents the opacity of blue screen image, θxyRepresent blue screen image in coordinate (x, y) place maximum rate of change Direction, gxx、gyyAnd gxyComputing formula as follows:
g x x = | ∂ R ∂ x | 2 + | ∂ G ∂ x | 2 + | ∂ B ∂ x | 2 g y y = | ∂ R ∂ y | 2 + | ∂ G ∂ y | 2 + | ∂ B ∂ y | 2 g x y = ∂ R ∂ x ∂ R ∂ y + ∂ G ∂ x ∂ G ∂ y + ∂ B ∂ x ∂ B ∂ y - - - ( c )
F is obtained according to formula (b)θ(x, y) two angle values being separated by 90 °, i.e. each picture of formula (b) and two orthogonal directions Vegetarian refreshments is related, then for each pixel, take FθThe angle value of (x, y) two orthogonal directions, by the maximum of two angle values It is designated as Fi
Compare the F of each pixeliValue and αiValue, take maximum between the two as after each pixel edge supplement not Transparency, i.e. αinew=MAX (αi,Fi), all of αinewForm the opacity image after a width edge supplement;
(2.4), the opacity image after edge supplement is filtered optimize using improved joint two-sided filter
Using the opacity image after edge supplement as noise image, then the structural information of blue screen image is delivered to noise pattern In picture, it is filtered processing by improved joint two-sided filter;
α j b ( p ) = Σ q ∈ Ω ( p ) f ( p - q ) · g ( I ( p ) - I ( q ) ) · α ( q ) Σ q ∈ Ω ( p ) f ( p - q ) · g ( I ( p ) - I ( q ) ) - - - ( d )
Wherein, functionX=p-q represents the coordinate difference of two pixels, in indexRepresent norm, σS Represent Gaussian kernel width parameter;P represents a pixel, and Ω (p) represents the neighborhood window centered on p, and q represents in Ω (p) Pixel, functionT represents colour-difference, and t=I (p)-I (q) represents two pixels in R, G, channel B Colour-difference, I (p) represent input RGB blue screen image in pixel p color value, α (q) represent q pixel edge supplement Opacity afterwards, αjbP () represents opacity after being filtered for the p pixel, by filtering to each pixel Ripple optimizes, and obtains final opacity image;
(2.5), remove background colour to overflow and image synthesis
Final opacity image and blue screen image are carried out and operation, obtains foreground image F, then in the overall situation of GPU Deposit middle reading background composograph, then pass through to synthesize equation with foreground image
C=α F+ (1- α) B synthesizes, and obtains initial composograph C, wherein F represents foreground image, and B represents background composograph, α Represent final opacity image;
Each pixel in initial composograph C is compared with the color value of background colour in the color value of H passage, if Their difference value is less than 1, that is, need to suppress background colour to overflow, then pass through formula (e) to reduce the saturation of pixel,
f(hpixel)=A × sin (2 π × (hkey+(0.25-hpixel)))-(A-1.5) (e)
Wherein, f (hpixel) for saturation reduction degree, hkeyRepresent the color value of background colour in image, hpixelRepresent pixel Color value, A be constant;
If the color value of pixel H passage is more than or equal to 1 with the difference of the color value of background colour, the saturation of pixel Keep constant;
By processing to each of initial composograph C pixel, obtain final composograph, then by final composite diagram As passing back to caching in CPU;
After the completion of the first two field picture is processed, process according to step (2.1)~(2.5) and continue with the second two field picture, Zhi Daosuo After the completion of some video frame images are processed, by video input, output interface, the imagery exploitation display device synthesizing is shown;
(3), internal memory release
The memory headroom of distribution on CPU and GPU is discharged after image shows and terminates.
2. blue screen matting method according to claim 1 is it is characterised in that described blue screen image structural information includes: The number of image length, width and pixel.
3. blue screen matting method according to claim 1 is it is characterised in that described binary conversion treatment is:If threshold value M, When the opacity of pixel is more than or equal to threshold value M, opacity value is set to 0, as background, impermeable when pixel When lightness is less than threshold value M, opacity value is set to 1, i.e. prospect.
CN201410436813.5A 2014-08-29 2014-08-29 Blue screen image-matting method Expired - Fee Related CN104200470B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410436813.5A CN104200470B (en) 2014-08-29 2014-08-29 Blue screen image-matting method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410436813.5A CN104200470B (en) 2014-08-29 2014-08-29 Blue screen image-matting method

Publications (2)

Publication Number Publication Date
CN104200470A CN104200470A (en) 2014-12-10
CN104200470B true CN104200470B (en) 2017-02-08

Family

ID=52085756

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410436813.5A Expired - Fee Related CN104200470B (en) 2014-08-29 2014-08-29 Blue screen image-matting method

Country Status (1)

Country Link
CN (1) CN104200470B (en)

Families Citing this family (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105100646B (en) * 2015-08-31 2018-09-11 北京奇艺世纪科技有限公司 Method for processing video frequency and device
CN105678724A (en) * 2015-12-29 2016-06-15 北京奇艺世纪科技有限公司 Background replacing method and apparatus for images
CN106251286B (en) * 2015-12-30 2019-11-22 深圳超多维科技有限公司 Image processing method, device and equipment
CN106303162A (en) * 2016-08-16 2017-01-04 江苏火米互动科技有限公司 A kind of GPU scratches image space method
CN107087123B (en) * 2017-04-26 2020-04-21 杭州奥点科技股份有限公司 Real-time high-definition image matting method based on cloud processing
CN108961299B (en) * 2017-05-18 2021-03-02 北京金山云网络技术有限公司 Foreground image obtaining method and device
CN108965647B (en) * 2017-05-18 2020-12-15 北京金山云网络技术有限公司 Foreground image obtaining method and device
CN108961258B (en) * 2017-05-18 2021-02-23 北京金山云网络技术有限公司 Foreground image obtaining method and device
CN108965746A (en) * 2018-07-26 2018-12-07 北京竞业达数码科技股份有限公司 Image synthesizing method and system
CN109819182B (en) * 2018-12-18 2024-04-16 深圳市潮流网络技术有限公司 Video background replacement method
CN109922281B (en) * 2019-01-22 2021-11-09 宋睿 Real-time video keying system
CN109919836A (en) * 2019-03-20 2019-06-21 广州华多网络科技有限公司 Video keying processing method, video keying processing client and readable storage medium storing program for executing
CN110070507B (en) * 2019-04-17 2021-03-02 安徽科朗电子科技有限公司 Matting method and device for video image, storage medium and matting equipment
CN110083292B (en) * 2019-04-25 2020-03-27 安徽文香信息技术有限公司 Interface window display control method and device, storage medium and electronic blackboard
CN110298894A (en) * 2019-06-28 2019-10-01 京东数字科技控股有限公司 Image processing method, device, system and medium
CN111223108A (en) * 2019-12-31 2020-06-02 上海影卓信息科技有限公司 Method and system based on backdrop matting and fusion
CN113923430A (en) * 2020-04-15 2022-01-11 深圳市瑞立视多媒体科技有限公司 Real-time image matting method, device, equipment and storage medium based on high-definition video
CN111951244B (en) * 2020-08-11 2024-03-01 北京百度网讯科技有限公司 Method and device for detecting single-color screen in video file
CN112330692B (en) * 2020-11-11 2022-06-28 安徽文香科技有限公司 Matting method, matting device, matting equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5313304A (en) * 1993-06-21 1994-05-17 The Grass Valley, Group, Inc. Chroma keyer with fringe control offset
CN101098475A (en) * 2007-07-10 2008-01-02 浙江大学 Interactive time-space accordant video matting method in digital video processing
CN101588459A (en) * 2009-06-26 2009-11-25 北京交通大学 A kind of video keying processing method
CN102968782A (en) * 2012-09-12 2013-03-13 苏州大学 Automatic digging method for remarkable objects of color images
CN103581571A (en) * 2013-11-22 2014-02-12 北京中科大洋科技发展股份有限公司 Video image matting method based on three elements of color

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7408591B2 (en) * 2005-07-29 2008-08-05 Mitsubishi Electric Research Laboratories, Inc. System and method for defocus difference matting
US7420590B2 (en) * 2005-09-29 2008-09-02 Mitsubishi Electric Research Laboratories, Inc. Video matting using camera arrays
US8625896B2 (en) * 2009-04-03 2014-01-07 Hewlett-Packard Development Comapany, L.P. Image matting

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5313304A (en) * 1993-06-21 1994-05-17 The Grass Valley, Group, Inc. Chroma keyer with fringe control offset
CN101098475A (en) * 2007-07-10 2008-01-02 浙江大学 Interactive time-space accordant video matting method in digital video processing
CN101588459A (en) * 2009-06-26 2009-11-25 北京交通大学 A kind of video keying processing method
CN102968782A (en) * 2012-09-12 2013-03-13 苏州大学 Automatic digging method for remarkable objects of color images
CN103581571A (en) * 2013-11-22 2014-02-12 北京中科大洋科技发展股份有限公司 Video image matting method based on three elements of color

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
Digital Keying Methods;Schultz C;《University of Bremen Center for Computing Technologies, Tzi》;20061231;第4卷(第2期);1-34 *
基于改进滤波和标记提取的分水岭算法;余旺盛 等;《电子学报》;20110415;第39卷(第4期);1-7 *
数字抠像的最新研究进展;张展鹏 等;《自动化学报》;20121015;第38卷(第10期);1571-1584 *

Also Published As

Publication number Publication date
CN104200470A (en) 2014-12-10

Similar Documents

Publication Publication Date Title
CN104200470B (en) Blue screen image-matting method
CN105608722B (en) It is a kind of that pouch method and system are gone based on face key point automatically
CN103475826A (en) Video matting and synthesis method
CN106780311B (en) Rapid face image beautifying method combining skin roughness
CN102063706B (en) Rapid defogging method
CN106897981A (en) A kind of enhancement method of low-illumination image based on guiding filtering
CN104537634B (en) The method and system of raindrop influence is removed in dynamic image
CN105976337B (en) A kind of image defogging method based on intermediate value guiding filtering
CN103327220B (en) With green channel for the denoising method guided on low-light (level) Bayer image
CN103164845B (en) A kind of real-time image mist elimination device and method
CN104680518B (en) A kind of blue screen image cutting method based on colourity Overflow handling
CN107507145A (en) A kind of underwater picture Enhancement Method based on the stretching of different colours spatially adaptive histogram
CN104809700B (en) A kind of low-light (level) video real time enhancing method based on bright passage
CN107545550B (en) Cell image color cast correction method
CN107580186A (en) A kind of twin camera panoramic video joining method based on suture space and time optimization
CN106530309A (en) Video matting method and system based on mobile platform
CN102063704A (en) Airborne vision enhancement method and device
CN103854261A (en) Method for correcting color cast images
CN102446345A (en) Method, device and system for carrying out color enhancement on whiteboard colored image
CN108711160A (en) A kind of Target Segmentation method based on HSI enhancement models
CN102223545B (en) Rapid multi-view video color correction method
CN104143203B (en) Image editing and communication method
CN103035000A (en) Color image edge extraction method based on cable news network (CNN)
CN103455974B (en) Image sketching style processing method
CN106447606A (en) Rapid real-time video beautifying method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20170208

Termination date: 20190829