CN104200470A - Blue screen image-matting method - Google Patents

Blue screen image-matting method Download PDF

Info

Publication number
CN104200470A
CN104200470A CN201410436813.5A CN201410436813A CN104200470A CN 104200470 A CN104200470 A CN 104200470A CN 201410436813 A CN201410436813 A CN 201410436813A CN 104200470 A CN104200470 A CN 104200470A
Authority
CN
China
Prior art keywords
image
pixel
partiald
opacity
blue screen
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
Application number
CN201410436813.5A
Other languages
Chinese (zh)
Other versions
CN104200470B (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 is scratched drawing method
Technical field
The invention belongs to visual effect field, more specifically say, relate to a kind of blue screen and scratch drawing method.
Background technology
Stingy figure refers to a kind of technology that accurately extracts foreground object from image or video sequence.Scratch diagram technology as a kind of gordian technique in visual effect field, be widely used in the fields such as picture editting and film making.But owing to scratching the underconstrained of figure problem, while solving this problem, need to increase extra constraint condition, therefore in production of film and TV, conventionally adopt blue screen or green screen as shooting background, with this, reduce the difficulty that solves of this problem, thisly blue screen or green screen stingy diagram technology are as a setting called to blue screen conventionally scratch diagram technology.
The stingy figure of blue screen develops into and has produced many different technology today.Common blue screen is scratched diagram technology and is mainly contained: brightness scratches that figure (Luma Keying), difference sectional drawing (Difference Keying), colourity are scratched figure (Chroma Keying), aberration is scratched figure (Color Difference Keying), 3D and scratched figure (3D Keying).
Brightness is scratched diagram technology and is utilized the monochrome information of image to solve opacity.RGB triple channel coloured image for given, is first transformed into HLS color space, then gets luminance channel L and carries out binaryzation operation, and the result obtaining is the opacity of prospect.Simple hard-threshold operation can cause the serious loss of edge and translucency information conventionally, therefore, conventionally takes in actual applications soft-threshold operation, defines the scope of a gradual change, makes opacity from 0 to 1 smooth variation.Because this technology has only been considered the monochrome information of image in scratching figure process, and do not consider the colouring information of image, therefore, for most of images, the method effect is not ideal enough.
Difference sectional drawing technology utilizes the difference of foreground image and background image to solve opacity.Difference sectional drawing technology does not have strict restriction to background, is not only applicable to color background, applicable equally for background color complicated situation.Yet because difference sectional drawing Technology Need background image is known, so its usable range has been subject to certain restriction.
Colourity is scratched diagram technology and is utilized the colouring information of image to solve opacity.RGB triple channel coloured image for given, is first transformed into HLS space, then H passage is carried out to Threshold segmentation and asks for opacity.In actual applications, be subject to the impact of the environmental factors such as illumination, background color there will be certain fluctuation, therefore a soft-threshold need to be set.Yet although H passage can be distinguished colouring information preferably, for the frame of video of compression, usually there is blocky effect (blocky) in H passage.In order improving, to scratch figure precision, conventionally colourity (H), brightness (L), three passages of saturation degree (S) to be combined.Compare with the stingy diagram technology of single channel, associating H, L, the three-channel stingy diagram technology of S is more accurate, and weak point is to need the parameter that regulates more, and man-machine interactively is larger.
Aberration is scratched diagram technology and is utilized R, G, the three-channel color distortion of B to solve opacity.Take blue screen video as example, and for input video frame I, its opacity is expressed as α=I b-MAX (I r, I g).It is fairly simple that aberration is scratched diagram technology, 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.), according to the space length of pixel, solves opacity.Because the change color scope of background is less, therefore can in three dimensions, define a 3D shape prospect and background area are separated.This 3D shape can be spheroid, cube, spheroid etc.Take simple spheroid as example, in order to obtain the opacity of gradual change, need to define small one and large one two spheroids, the pixel of spherula the inside is background, pixel beyond large spheroid is prospect, and marginal pixel belongs to transitional region, and opacity changes between 0 to 1.Although 3D scratches diagram technology, can obtain good effect, speed and man-machine interactively still need further to be improved.
As seen from the above analysis, existing blue screen is scratched diagram technology in stingy figure speed, scratches on plot quality and man-machine interactively and can not obtain desirable effect simultaneously, and therefore, it is necessary that the stingy diagram technology of blue screen is furtherd investigate.
Summary of the invention
The object of the invention is to overcome the deficiencies in the prior art, provide a kind of blue screen to scratch drawing method, by frame of video being carried out to blue screen in GPU, scratch figure processing, there is stingy figure speed fast, scratch figure effective, and do not need to adjust the advantages such as too many parameter and man-machine interactively.
For achieving the above object, a kind of blue screen of the present invention is scratched drawing method, it is characterized in that, comprises the following steps:
(1), transmit video to GPU
GPU is carried out to initialization; At CPU end, by video input, output interface, to GPU end, apply for texture memory, constant internal memory and global memory;
After the success of CPU end application internal memory, 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, a width background composograph of choosing is delivered to global memory simultaneously;
(2), the parallel computation thread block of GPU is processed video
From texture memory, read frame of video, from constant internal memory, read the parameter vector of video to the parallel computation thread block of GPU, in the parallel computation thread block of GPU, respectively all frame of video are processed;
(2.1), extract background colour
Using the first two field picture of video as blue screen image, then the parameter vector that reads video obtains the structural information of blue screen image;
The first two field picture of video, from RGB color space conversion to being transformed into HLS color space, is carried out to statistical color histogram to the color of image of H passage in HLS color space, by the color of frequency of occurrences maximum in color histogram look as a setting;
(2.2), obtain the initial opacity of blue screen image
The background colour obtaining with reference to step (2.1), utilizes aberration to scratch diagram technology each pixel of blue screen image is carried out to opacity processing, by formula α ' i=I ikey-MAX (I i, I' i), obtain α ' i, wherein, i=1,2 ..., n, n represents the number of pixel in blue screen image, I ikeyrepresent pixel passage color value identical with background colour in BRG space, I i, I' irepresent respectively pixel two other passage color value in BRG space, all α ' iform a width Trimap figure, then each pixel in Trimap figure is carried out to binary conversion treatment, obtain the initial opacity α of each point i, all α iform the initial opacity image of a width;
(2.3), utilize the gradient information of blue screen image to carry out edge supplement to initial opacity image
Gradient information in the blue screen image of 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, θ xyexpression blue screen image is located the direction of maximum rate of change, g at coordinate (x, y) xx, g yyand g xycomputing 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
According to formula (b), obtain F θthe be separated by angle value of 90 ° of (x, y) two, formula (b) is relevant to each pixel of two orthogonal directionss,, for each pixel, gets F θthe angle value of (x, y) two orthogonal directionss, is designated as F by the maximal value of two angle values i;
The F that compares each pixel ivalue and α ivalue, gets the maximal value between the two opacity after as each pixel edge supplement, i.e. α inew=MAX (α i, F i), all α inewform the opacity image after a width edge supplement;
(2.4), utilize the opacity image after improved associating two-sided filter edge supplements to carry out filtering optimization
Using the opacity image after edge supplement as noise image, then the structural information of blue screen image is delivered in noise image, by improved associating two-sided filter, carries out filtering processing;
α 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, function x=p-q represents the coordinate difference of two pixels, in index represent norm, can carry out Multi-dimension calculation, σ srepresent gaussian kernel width parameter; P represents a pixel, and Ω (p) represents the neighborhood window centered by p, and q represents the pixel in Ω (p), function t represents colour-difference, t=I (p)-I (q) represents that two pixels are in the colour-difference of R, G, B passage, the color value of pixel p in the RGB blue screen image that I (p) represents to input, the opacity after the edge supplement of α (q) expression q pixel, α jb(p) represent the opacity of p pixel after carrying out filtering, by each pixel is carried out to filtering optimization, obtain final opacity image;
(2.5), remove that background colour overflows and image is synthetic
Final opacity image and blue screen image are carried out and operation, obtain foreground image F, then from the global memory of GPU, read background composograph, synthetic by synthetic equation C=α F+ (1-α) B with foreground image again, obtain initial composograph C, wherein F represents foreground image, and B represents background composograph, and α represents final opacity image;
Each pixel in initial composograph C is compared at the color value of H passage and the color value of background colour, if their difference value is less than 1, need Background suppression look to overflow, through type (e) reduces the saturation degree of pixel,
f(h pixel)=A×sin(2π×(h key+(0.25-h pixel)))-(A-1.5) (e)
Wherein, f (h pixel) be the reduction degree of saturation degree, h keythe color value of background colour in presentation video, h pixelthe color value that represents pixel, A is constant;
If the difference of the color value of pixel H passage and the color value of background colour is more than or equal to 1, the saturation degree of pixel remains unchanged;
By each pixel in initial composograph C is processed, obtain final composograph, more final composograph is passed back to buffer memory in CPU;
After the first two field picture is finished dealing with, according to step (2.1)~(2.5), process to continue process the second two field picture, until after all video frame images finish dealing with, synthetic imagery exploitation display device is shown by video input, output interface;
(3), internal memory discharges
After finishing, image demonstration discharges the upper memory headroom distributing of CPU and GPU.
Goal of the invention of the present invention is achieved in that
A kind of blue screen of the present invention is scratched drawing method, first by delivery of video in GPU, by frame of video being carried out to blue screen in GPU, scratch figure and process, improved so the speed of stingy figure.Concretely, first frame of video is extracted to background colour, according to background colour, utilize aberration to scratch diagram technology blue screen image is carried out to opacity processing, after binary conversion treatment, obtain again initial opacity image, then utilize gradient information and the improved associating two-sided filter of coloured image to be optimized and to obtain final opacity image initial opacity, finally final opacity image is carried out to background colour and overflow after removing and pass back to CPU client, by display device, show.In whole processing procedure, greatly reduced like this adjustment of man-machine interactively and parameter.
Meanwhile, the stingy drawing method of blue screen of the present invention also has following beneficial effect:
(1), all blue screens are scratched figure and processed and all place in GPU and process in the present invention, the speed that makes so whole blue screen scratch workflow graph is accelerated;
(2) all parameters, in the present invention are fixed value substantially, do not need artificial adjusting, have reduced like this man-machine interactively, are a kind of full automatic blue screen video matting methods;
(3), the present invention utilized the gradient information of coloured image and improved associating two-sided filter to be optimized initial opacity, makes like this to scratch figure better effects if, is also applicable to the occasion that translucent object or tiny hair equalization are had relatively high expectations;
(4), traditional associating two-sided filter is that the structural information of muting flash image is delivered in the no-flash image with noise exactly, realized the efficient denoising of no-flash image; Be subject to this to inspire the present invention to exist the opacity image of sawtooth effect as noise image, by associating bilateral filtering, the blue screen image structural information of input is passed to opacity image, overcome so traditional associating two-sided filter and only processed the limitation of two three-channel coloured images, become and process a three-channel coloured image and a width gray level image, thereby reach the object of optimizing opacity image.
Accompanying drawing explanation
Fig. 1 is the process flow diagram that blue screen of the present invention is scratched drawing method;
Fig. 2 is that frame of video is at the color histogram of H passage;
Fig. 3 is the initial opacity of obtaining blue screen image;
Fig. 4 is that initial opacity image carries out the forward and backward comparison diagram of edge supplement;
Fig. 5 is that the opacity image after edge supplement carries out the forward and backward comparison diagram of filtering optimization;
Fig. 6 is the composite diagram of removing after background colour overflows.
Embodiment
Below in conjunction with accompanying drawing, the specific embodiment of the present invention is described, so that those skilled in the art understands the present invention better.Requiring particular attention is that, in the following description, when perhaps the detailed description of known function and design can desalinate main contents of the present invention, these are described in here and will be left in the basket.
Embodiment
Fig. 1 is the process flow diagram that blue screen of the present invention is scratched drawing method.
In the present embodiment, using OpenCV as input, the output interface of video, as shown in Figure 1, a kind of blue screen of the present invention is scratched drawing method, comprises the following steps:
S1, transmission video are to GPU
GPU is carried out to initialization; CPU end is applied for texture memory, constant internal memory and global memory by OpenCV to GPU end;
After the success of CPU end application internal memory, again by OpenCV, frame of video is delivered to texture memory, the parameter vector of video is delivered to constant internal memory, a width background composograph of choosing is delivered to global memory, wherein, parameter vector comprises the resolution of video simultaneously, frame number, frame per second etc.;
The parallel computation thread block of S2, GPU is processed video
From texture memory, read frame of video, from constant internal memory, read the parameter vector of video to the parallel computation thread block of GPU, in the parallel computation thread block of GPU, respectively all frame of video are processed;
S2.1, extraction background colour
Using the first two field picture of video as blue screen image, then the parameter vector that reads video obtains the structural information of blue screen image, and its structural information comprises the number of blue screen image length, width and pixel; The first two field picture of video, from RGB color space conversion to being transformed into HLS color space, is carried out to statistical color histogram to the color of image of H passage in HLS color space, by the color of frequency of occurrences maximum in color histogram look as a setting; In the present embodiment, choosing of background colour is generally indigo plant, red, green three kinds of colors, and as shown in Figure 2, in color histogram, the color of frequency of occurrences maximum is blue, is about to blueness look as a setting;
S2.2, obtain the initial opacity of blue screen image
In the present embodiment, as shown in Figure 3, the background colour obtaining with reference to step S2.1 is blue, utilizes aberration to scratch diagram technology each pixel of Fig. 3 (a) blue screen image is carried out to opacity processing, by formula, can be expressed as α ' i=I iB-MAX (I iR, I iG), obtain α ' i, wherein, i=1,2 ..., n, n represents the number of pixel in blue screen image, I iB, I iR, I iGrepresent that respectively pixel is at B, R, color value that G passage is corresponding, all α ' iform a width Trimap figure, as shown in Fig. 3 (b), then each pixel in Trimap figure is carried out to binary conversion treatment, obtain the initial opacity α of each pixel i, all α iform the initial opacity image of a width, 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 equal to threshold values 0.5, opacity value is made as to 0, be background, when the opacity of pixel is less than 0.5, opacity value is made as to 1, i.e. prospect;
S2.3, utilize the gradient information of blue screen image to carry out edge supplement to initial opacity image
In the present embodiment, as shown in Fig. 3 (c), the binary conversion treatment of blue screen image has caused 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 the gradient information of, having introduced blue screen image carries out edge supplement to initial opacity image;
If the gradient information of the blue screen image of rgb space is arbitrarily:
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, θ xyexpression blue screen image is located the direction of maximum rate of change, g at coordinate (x, y) xx, g yyand g xycomputing 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
Known according to formula (a): F θ(x, y)=F θ+π(x, y), so F only need be in half-open interval [0, π) the upper value of calculating θ, in addition, due to tan (α)=tan (α ± π), so if θ 0solution, so a θ of formula (b) 0± pi/2 can be also a solution of this equation.According to formula (b), obtain F θthe be separated by angle value of 90 ° of (x, y) two, formula (b) is relevant to each pixel of two orthogonal directionss, this just means, in these two orthogonal directionss, the F value of one of them direction is maximum, and the F value of another direction is minimum,, for each pixel, get F θthe angle value of (x, y) two orthogonal directionss, is designated as F by the maximal value of two angle values i;
The F that compares each pixel ivalue and α ivalue, gets the maximal value between the two opacity after as each pixel edge supplement, i.e. α inew=MAX (α i, F i), all α inewform the opacity image after a width edge supplement;
In the present embodiment, Fig. 4 (a) is the blue screen image of input, Fig. 4 (b) is the initial opacity image of blue screen image after aberration is scratched figure and binary conversion treatment, Fig. 4 (c) is the opacity image after edge supplement, as can be seen from the figure, after edge supplement, the edge of opacity is more level and smooth, and detailed information is abundanter;
S2.4, the opacity image after utilizing improved associating two-sided filter edge to supplement carry out filtering optimization
In the present embodiment, as shown in Fig. 4 (c), edge supplement makes the marginal information of initial opacity image obtain recovery, but the crenellated phenomena causing due to binary conversion treatment is not eliminated, thus we again the opacity image of edge after supplementing carry out filtering optimization;
Using the opacity image after Fig. 5 (b) edge supplement as noise image, then the structural information of Fig. 5 (a) blue screen image is delivered in noise image, by improved associating two-sided filter, carries out filtering processing;
α 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, function x=p-q represents the coordinate difference of two pixels, in index represent norm, can carry out Multi-dimension calculation, σ srepresent gaussian kernel width parameter; P represents a pixel, and Ω (p) represents the neighborhood window centered by p, and q represents the pixel in Ω (p), function t represents colour-difference, and t=I (p)-I (q) represents that two pixels are in the colour-difference of R, G, B passage, the opacity after the edge supplement of α (q) expression q pixel, α jb(p) represent the opacity of p pixel after carrying out filtering, by each pixel is carried out to filtering optimization, obtain final opacity image, as shown in Fig. 5 (c), as can be seen from the figure,, after the filtering of improved associating two-sided filter, not only the structural information of blue screen image has been delivered in noise image, and it is level and smooth to have carried out guarantor limit, and the edge sawtooth forming in binary conversion treatment process has been eliminated;
S2.5, removal background colour overflow and image synthesizes
Final opacity image and blue screen image are carried out and operation, obtain foreground image F, then from the global memory of GPU, read background composograph, synthetic by synthetic equation C=α F+ (1-α) B with foreground image again, obtain initial composograph C, wherein F represents foreground image, and B represents background composograph, and α represents final opacity image; In the present embodiment, initial composograph is as shown in Fig. 6 (a);
Each pixel in initial composograph is compared at the color value of H passage and the color value of background colour, if their difference value is less than 1, need to suppress overflowing of Background suppression look, through type (e) reduces the saturation degree of pixel,
f(h pixel)=A×sin(2π×(h key+(0.25-h pixel)))-(A-1.5) (e)
Wherein, f (h pixel) be the reduction degree of saturation degree, h keythe color value that represents background colour, h pixelthe color value that represents pixel, A is constant; In the present embodiment, the value of A is 3, as f (h pixel) during < 0, get f (h pixel)=0, as f (h pixel) during > 1, get f (h pixel)=1;
If the difference of the color value of pixel H passage and the color value of background colour is more than or equal to 1, the saturation degree of pixel remains unchanged;
By each pixel in initial composograph C is processed, obtain final composograph, as shown in Figure 6, more final composograph is passed back to buffer memory in CPU;
After the first two field picture is finished dealing with, according to step S2.1~S2.5, process and continue to process the second two field picture, until after all video frame images finish dealing with, synthetic imagery exploitation display device is shown by video input, output interface;
S3, internal memory discharge
After finishing, video demonstration discharges the upper memory headroom distributing of CPU and GPU.
Although above the illustrative embodiment of the present invention is described; so that those skilled in the art understand the present invention; but should be clear; the invention is not restricted to the scope of embodiment; to those skilled in the art; as long as various variations appended claim limit and definite the spirit and scope of the present invention in, these variations are apparent, all utilize innovation and creation that the present invention conceives all at the row of protection.

Claims (3)

1. blue screen is scratched a drawing method, it is characterized in that, comprises the following steps:
(1), transmit video to GPU
GPU is carried out to initialization; At CPU end, by video input, output interface, to GPU end, apply for texture memory, constant internal memory and global memory;
After the success of CPU end application internal memory, 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, a width background composograph of choosing is delivered to global memory simultaneously;
(2), the parallel computation thread block of GPU is processed video
From texture memory, read frame of video, from constant internal memory, read the parameter vector of video to the parallel computation thread block of GPU, in the parallel computation thread block of GPU, respectively all frame of video are processed;
(2.1), extract background colour
Using the first two field picture of video as blue screen image, then the parameter vector that reads video obtains the structural information of blue screen image;
The two field picture of video, from RGB color space conversion to being transformed into HLS color space, is carried out to statistical color histogram to the color of image of H passage in HLS color space, by the color of frequency of occurrences maximum in color histogram look as a setting;
(2.2), obtain the initial opacity of blue screen image
The background colour obtaining with reference to step (2.1), utilizes aberration to scratch diagram technology each pixel of blue screen image is carried out to opacity processing, by formula α ' i=I ikey-MAX (I i, I' i), obtain α ' i, wherein, i=1,2 ..., n, n represents the number of pixel in blue screen image, I ikeyrepresent pixel passage color value identical with background colour in BRG space, I i, I' irepresent respectively pixel two other passage color value in BRG space, all α ' iform a width Trimap figure, then each pixel in Trimap figure is carried out to binary conversion treatment, obtain the initial opacity α of each point i, all α iform the initial opacity image of a width;
(2.3), utilize the gradient information of coloured image to carry out edge supplement to initial opacity image
Gradient information in the blue screen image of rgb space is:
F &theta; ( x , y ) = { 1 2 [ ( g xx + g yy ) + ( g xx - g yy ) cos 2 &theta; + 2 g xy sin 2 &theta; ] } 1 / 2 - - - ( a )
&theta; xy = 1 2 arctan [ 2 g xy ( g xx - g yy ) ] - - - ( b )
Wherein, F θ(x, y) represents the opacity of blue screen image, θ xyexpression blue screen image is located the direction of maximum rate of change, g at coordinate (x, y) xx, g yyand g xycomputing formula as follows:
g xx = | &PartialD; R &PartialD; x | 2 + | &PartialD; G &PartialD; x | 2 + | &PartialD; B &PartialD; x | 2
g yy = | &PartialD; R &PartialD; y | 2 + | &PartialD; G &PartialD; y | 2 + | &PartialD; B &PartialD; y | 2 - - - ( c )
g xy = &PartialD; R &PartialD; x &PartialD; R &PartialD; y + &PartialD; G &PartialD; x &PartialD; G &PartialD; y + &PartialD; B &PartialD; x &PartialD; B &PartialD; y
According to formula (b), obtain F θthe be separated by angle value of 90 ° of (x, y) two, formula (b) is relevant to each pixel of two orthogonal directionss,, for each pixel, gets F θ(x, y) angle value of two orthogonal directionss, the maximal value of two angle values is designated as to F i;
The F that compares each pixel ivalue and α ivalue, gets the maximal value between the two opacity after as each pixel edge supplement, i.e. α inew=MAX (α i, F i), all α inewform the opacity image after a width edge supplement;
(2.4), utilize the opacity image after improved associating two-sided filter edge supplements to carry out filtering optimization
Using the opacity image after edge supplement as noise image, then the structural information of blue screen image is delivered in noise image, by improved associating two-sided filter, carries out filtering processing;
&alpha; jb ( p ) = &Sigma; q &Element; &Omega; ( p ) f ( p - q ) &CenterDot; g ( I ( p ) - I ( q ) ) &CenterDot; &alpha; ( q ) &Sigma; q &Element; &Omega; ( p ) f ( p - q ) &CenterDot; g ( I ( p ) - I ( q ) ) - - - ( d )
Wherein, function in index represent norm, σ srepresent gaussian kernel width parameter; P represents a pixel, and Ω (p) represents the neighborhood window centered by p, and q represents the pixel in Ω (p), function t represents colour-difference, t=I (p)-I (q) represents that two pixels are in the colour-difference of R, G, B passage, the color value of pixel p in the RGB blue screen image that I (p) represents to input, the opacity after the edge supplement of α (q) expression q pixel, α jb(p) represent the opacity of p pixel after carrying out filtering, by each pixel is carried out to filtering optimization, obtain final opacity image;
(2.5), remove that background colour overflows and image is synthetic
Final opacity image and blue screen image are carried out and operation, obtain foreground image F, then from the global memory of GPU, read background composograph, synthetic by synthetic equation C=α F+ (1-α) B with foreground image again, obtain initial composograph C, wherein F represents foreground image, and B represents background composograph, and α represents final opacity image;
Each pixel in initial composograph C is compared at the color value of H passage and the color value of background colour, if their difference value is less than 1, need Background suppression look to overflow, through type (e) reduces the saturation degree of pixel,
f(h pixel)=A×sin(2π×(h key+(0.25-h pixel)))-(A-1.5) (e)
Wherein, f (h pixel) be the reduction degree of saturation degree, h keythe color value of background colour in presentation video, h pixelthe color value that represents pixel, A is constant;
If the difference of the color value of pixel H passage and the color value of background colour is more than or equal to 1, the saturation degree of pixel remains unchanged;
By each pixel in initial composograph C is processed, obtain final composograph, more final composograph is passed back to buffer memory in CPU;
After the first two field picture is finished dealing with, according to step (2.1)~(2.5), process to continue process the second two field picture, until after all video frame images finish dealing with, synthetic imagery exploitation display device is shown by video input, output interface;
(3), internal memory discharges
After finishing, image demonstration discharges the upper memory headroom distributing of CPU and GPU.
2. blue screen according to claim 1 is scratched drawing method, it is characterized in that, described blue screen image structural information comprises: the number of image length, width and pixel.
3. blue screen according to claim 1 is scratched drawing method, it is characterized in that, described binary conversion treatment is: establish threshold values M, when the opacity of pixel is more than or equal to threshold values M, opacity value is made as to 0, is background, when the opacity of pixel is less than threshold value M, opacity value is made as 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 true CN104200470A (en) 2014-12-10
CN104200470B 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)

Cited By (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105100646A (en) * 2015-08-31 2015-11-25 北京奇艺世纪科技有限公司 Video processing method and device
CN105678724A (en) * 2015-12-29 2016-06-15 北京奇艺世纪科技有限公司 Background replacing method and apparatus for images
CN106251286A (en) * 2015-12-30 2016-12-21 深圳超多维科技有限公司 Image processing method, device and equipment
CN106303162A (en) * 2016-08-16 2017-01-04 江苏火米互动科技有限公司 A kind of GPU scratches image space method
CN107087123A (en) * 2017-04-26 2017-08-22 杭州奥点科技股份有限公司 It is a kind of that image space method is scratched based on the real-time high-definition that high in the clouds is handled
CN108961258A (en) * 2017-05-18 2018-12-07 北京金山云网络技术有限公司 A kind of foreground image preparation method and device
CN108961299A (en) * 2017-05-18 2018-12-07 北京金山云网络技术有限公司 A kind of foreground image preparation method and device
CN108965746A (en) * 2018-07-26 2018-12-07 北京竞业达数码科技股份有限公司 Image synthesizing method and system
CN108965647A (en) * 2017-05-18 2018-12-07 北京金山云网络技术有限公司 A kind of foreground image preparation method and device
CN109819182A (en) * 2018-12-18 2019-05-28 深圳市潮流网络技术有限公司 A kind of video background replacement method
CN109922281A (en) * 2019-01-22 2019-06-21 宋睿 A kind of real-time video is stingy as 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
CN110070507A (en) * 2019-04-17 2019-07-30 北京文香信息技术有限公司 A kind of stingy drawing method of video image, device, storage medium and stingy figure equipment
CN110083292A (en) * 2019-04-25 2019-08-02 北京文香信息技术有限公司 Control method, device, storage medium and the electronic blackboard that interfaces windows are shown
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
CN111951244A (en) * 2020-08-11 2020-11-17 北京百度网讯科技有限公司 Single-color screen detection method and device in video file
CN112330692A (en) * 2020-11-11 2021-02-05 北京文香信息技术有限公司 Matting method, device, equipment and storage medium
CN113923431A (en) * 2020-04-15 2022-01-11 深圳市瑞立视多媒体科技有限公司 Real-time image matting method, device, equipment and storage medium based on high-definition video

Citations (8)

* 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
US20070024756A1 (en) * 2005-07-29 2007-02-01 Wojciech Matusik System and method for defocus difference matting
US20070070200A1 (en) * 2005-09-29 2007-03-29 Wojciech Matusik Video matting using camera arrays
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
US20100254598A1 (en) * 2009-04-03 2010-10-07 Qingxiong Yang Image matting
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

Patent Citations (8)

* 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
US20070024756A1 (en) * 2005-07-29 2007-02-01 Wojciech Matusik System and method for defocus difference matting
US20070070200A1 (en) * 2005-09-29 2007-03-29 Wojciech Matusik Video matting using camera arrays
CN101098475A (en) * 2007-07-10 2008-01-02 浙江大学 Interactive time-space accordant video matting method in digital video processing
US20100254598A1 (en) * 2009-04-03 2010-10-07 Qingxiong Yang Image matting
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
SCHULTZ C: "Digital Keying Methods", 《UNIVERSITY OF BREMEN CENTER FOR COMPUTING TECHNOLOGIES, TZI》 *
余旺盛 等: "基于改进滤波和标记提取的分水岭算法", 《电子学报》 *
张展鹏 等: "数字抠像的最新研究进展", 《自动化学报》 *

Cited By (28)

* 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
CN105100646A (en) * 2015-08-31 2015-11-25 北京奇艺世纪科技有限公司 Video processing method and device
CN105678724A (en) * 2015-12-29 2016-06-15 北京奇艺世纪科技有限公司 Background replacing method and apparatus for images
CN106251286A (en) * 2015-12-30 2016-12-21 深圳超多维科技有限公司 Image processing method, device and equipment
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
CN107087123A (en) * 2017-04-26 2017-08-22 杭州奥点科技股份有限公司 It is a kind of that image space method is scratched based on the real-time high-definition that high in the clouds is handled
CN108961258A (en) * 2017-05-18 2018-12-07 北京金山云网络技术有限公司 A kind of foreground image preparation method and device
CN108965647A (en) * 2017-05-18 2018-12-07 北京金山云网络技术有限公司 A kind of foreground image preparation method and device
CN108961258B (en) * 2017-05-18 2021-02-23 北京金山云网络技术有限公司 Foreground image obtaining method and device
CN108965647B (en) * 2017-05-18 2020-12-15 北京金山云网络技术有限公司 Foreground image obtaining method and device
CN108961299B (en) * 2017-05-18 2021-03-02 北京金山云网络技术有限公司 Foreground image obtaining method and device
CN108961299A (en) * 2017-05-18 2018-12-07 北京金山云网络技术有限公司 A kind of foreground image preparation method and device
CN108965746A (en) * 2018-07-26 2018-12-07 北京竞业达数码科技股份有限公司 Image synthesizing method and system
CN109819182A (en) * 2018-12-18 2019-05-28 深圳市潮流网络技术有限公司 A kind of video background replacement method
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
CN109922281A (en) * 2019-01-22 2019-06-21 宋睿 A kind of real-time video is stingy as 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
CN110070507A (en) * 2019-04-17 2019-07-30 北京文香信息技术有限公司 A kind of stingy drawing method of video image, device, storage medium and stingy figure equipment
CN110083292A (en) * 2019-04-25 2019-08-02 北京文香信息技术有限公司 Control method, device, storage medium and the electronic blackboard that interfaces windows are shown
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
CN113923431A (en) * 2020-04-15 2022-01-11 深圳市瑞立视多媒体科技有限公司 Real-time image matting method, device, equipment and storage medium based on high-definition video
CN111951244A (en) * 2020-08-11 2020-11-17 北京百度网讯科技有限公司 Single-color screen detection method and device in video file
CN111951244B (en) * 2020-08-11 2024-03-01 北京百度网讯科技有限公司 Method and device for detecting single-color screen in video file
CN112330692A (en) * 2020-11-11 2021-02-05 北京文香信息技术有限公司 Matting method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN104200470B (en) 2017-02-08

Similar Documents

Publication Publication Date Title
CN104200470A (en) Blue screen image-matting method
CN104537634B (en) The method and system of raindrop influence is removed in dynamic image
CN109191390A (en) A kind of algorithm for image enhancement based on the more algorithm fusions in different colours space
CN105046653B (en) A kind of video raindrop minimizing technology and system
CN106846263A (en) The image defogging method being immunized based on fusion passage and to sky
CN102779351A (en) Interactive grayscale image colorizing method based on local linear model optimization
CN103440630A (en) Large-dynamic-range infrared image display and detail enhancement method based on guiding filter
CN103475826A (en) Video matting and synthesis method
CN103327220B (en) With green channel for the denoising method guided on low-light (level) Bayer image
CN103440674B (en) A kind of rapid generation of digital picture wax crayon specially good effect
CN104809709A (en) Single-image self-adaptation defogging method based on domain transformation and weighted quadtree decomposition
CN103593830A (en) Low-light video image reinforcing method
CN105959510B (en) A kind of video rapid defogging method
CN104318535B (en) The method, device and mobile terminal of image defogging
CN104021527B (en) Rain and snow removal method in image
Fang et al. Single image dehazing and denoising with variational method
CN103093471A (en) Foreground extraction method under complicated background
CN102063704A (en) Airborne vision enhancement method and device
CN107895357A (en) A kind of real-time water surface thick fog scene image Enhancement Method based on FPGA
CN107527325A (en) A kind of monocular underweater vision Enhancement Method preferential based on dark
CN105574826B (en) The thin cloud minimizing technology of remote sensing image
CN102446345A (en) Method, device and system for carrying out color enhancement on whiteboard colored image
CN110136079A (en) Image defogging method based on scene depth segmentation
CN112053298A (en) Image defogging method
CN108711160A (en) A kind of Target Segmentation method based on HSI enhancement models

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

Granted publication date: 20170208

Termination date: 20190829

CF01 Termination of patent right due to non-payment of annual fee