CN105678724A - Background replacing method and apparatus for images - Google Patents

Background replacing method and apparatus for images Download PDF

Info

Publication number
CN105678724A
CN105678724A CN201511017806.2A CN201511017806A CN105678724A CN 105678724 A CN105678724 A CN 105678724A CN 201511017806 A CN201511017806 A CN 201511017806A CN 105678724 A CN105678724 A CN 105678724A
Authority
CN
China
Prior art keywords
image
alpha channel
channel image
environment light
initial
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.)
Pending
Application number
CN201511017806.2A
Other languages
Chinese (zh)
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.)
Beijing QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN201511017806.2A priority Critical patent/CN105678724A/en
Publication of CN105678724A publication Critical patent/CN105678724A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/50Image enhancement or restoration by the use of more than one image, e.g. averaging, subtraction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20212Image combination
    • G06T2207/20221Image fusion; Image merging

Abstract

The invention provides a background replacing method and apparatus for images. The background replacing method for images includes the steps: based on the RGB component of the current frame of an image, calculating a green difference value, and based on the green difference value, obtaining an initial alpha channel image which includes an initial background image and an initial foreground image; utilizing the green difference value to softening the initial alpha channel image to obtain a first alpha channel image; based on an ambient light factor, performing ambient light removing processing on the first alpha channel image to obtain a final alpha channel image which includes a background image to be synthesized and a processed foreground image; and synthesizing the final alpha channel image, the background image to be synthesized and the processed foreground image. The background replacing method and apparatus for images can modify an existing scheme based on green screen sectional drawing and increases softening and ambient light removing processing so that images can become more softened and natural.

Description

The background replacement method of image and device
Technical field
The present invention relates to technical field of image processing, particularly relate to background replacement method and the device of a kind of image.
Background technology
What the background replacement technology of image was studied is the foreground information in video or picture and background information are separated, and the prospect of separation is synthesized to the problem in an other width background. Such problem is Digital Image Processing and the class classical problem in digital video editing field, and is widely used in video editing and Video segmentation field. Background is replaced to the separation of foreground information, be adopt video matting technology under green curtain background (also referred to as: figure scratched by green curtain or picture buckled by green curtain), draw the green component color in picture as transparent color, other color components are scratched from picture and goes, so that background appears, form the superposition synthesis of two layers of picture. So it is superimposed with various scenery after scratching picture the personage of indoor shot, forms magical artistic effect.
But, indoor light, owing to being subject to the interference of environment light, can bring at least following two problem:
(1) figure border is scratched smooth not
Produce the reason of this problem, be that light is uneven. In stingy figure process, if environment light ratio is milder, then when edge transition, can be very smooth, sudden change will not be produced. But, the indoor light in reality, due to the problem of light angle, cause in foreground edge part smooth not, sudden change also becomes scrambling, so when image synthesizes, image can be made to seem that comparison is false, not naturally.
(2) environment light produces color problem of overflowing
When carrying out foreground information separation by green curtain, prospect meeting entirety is partially green, is referred to as the excessive color of image.
Summary of the invention
The present invention provides background replacement method and the device of a kind of image, scratches, for solving prior art, the problem that figure border is unsmooth, image overflows color.
A kind of background replacement method of image, including:
Based on the RGB component of image present frame, calculating green difference, and obtain initial alpha channel image based on described green difference, described initial alpha channel image includes initial background image and initial foreground image;
Utilize described green difference that described initial alpha channel image is carried out softening process, obtain the first alpha channel image;
Based on environment light factor, described first alpha channel image being carried out environment light removal to process, obtain final alpha channel image, described final alpha channel image includes background image to be synthesized and treated foreground image;
Described final alpha channel image, background image to be synthesized and treated foreground image are synthesized.
Preferably, described utilize described green difference that described initial alpha channel image is carried out softening process, obtain the first alpha channel image, including:
Based on described initial alpha channel image, analyze the foreground image in described initial alpha channel image;
According to image softening algorithm, based on described green difference, the edge of the foreground image of described initial alpha channel image is carried out softening process, obtain described first alpha channel image.
Preferably, described based on environment light factor, described first alpha channel image is carried out environment light removal process, obtain final alpha channel image, including:
Determine environment light factor;
The relation of derivation environment light factor and true alpha channel image;
Calculate the final alpha channel image after the light of decyclization border.
Preferably, described determine that environment light factor includes:
Determine there is the relation of environment light factor and composograph under ambient light conditions: without the former composite diagram of environment light, by environment light factor of influence, obtain composograph with environment light through linear superposition.
Preferably, said method also includes: generate the green background image of a pure color, concrete, utilize image repair technology, the lack part in the green background region of the first alpha channel image is filled with, thus generating the green background image of pure color, as the reference of described background image to be synthesized.
Preferably, described obtain initial alpha channel image based on described green difference, including:
Based on maximum variance between clusters, obtain segmentation threshold;
Based on described segmentation threshold, described green difference is analyzed, generates initial alpha channel image.
A kind of background alternative of image, including:
Initial pictures acquiring unit, for the RGB component based on image present frame, calculates green difference, and obtains initial alpha channel image based on described green difference, and described initial alpha channel image includes initial background image and initial foreground image;
Softening processing unit, is used for utilizing described green difference that described initial alpha channel image is carried out softening process, obtains the first alpha channel image;
Environment light removal unit, process for described first alpha channel image being carried out environment light removal based on environment light factor, obtaining final alpha channel image, described final alpha channel image includes background image to be synthesized and treated foreground image;
Image composing unit, for synthesizing described final alpha channel image, background image to be synthesized and treated foreground image.
Preferably, described softening processing unit specifically for, based on described initial alpha channel image, analyze the foreground image in described initial alpha channel image; According to image softening algorithm, based on described green difference, the edge of the foreground image of described initial alpha channel image is carried out softening process, obtain described first alpha channel image.
Preferably, described environment light removal unit is specifically for, it is determined that environment light factor; The relation of derivation environment light factor and true alpha channel image; Calculate the final alpha channel image after the light of decyclization border.
Preferably, described environment light removal unit specifically for, it is determined that there is the relation of environment light factor and composograph under ambient light conditions: without the former composite diagram of environment light, by environment light factor of influence, obtain composograph with environment light through linear superposition.
Preferably, described environment light removal unit is additionally operable to, generate the green background image of a pure color, concrete, utilize image repair technology, the lack part in the green background region of the first alpha channel image is filled with, thus generating the green background image of pure color, as the reference of described background image to be synthesized.
Preferably, described initial pictures acquiring unit specifically for, based on maximum variance between clusters, obtain segmentation threshold; Based on described segmentation threshold, described green difference is analyzed, generates initial alpha channel image.
Compared with prior art, the embodiment of the present invention includes advantages below:
The unsmooth problem in border that the embodiment of the present invention exists for prior art, from reason (the light uneven) causing this problem, for this unsmooth phenomenon, carry out softening process, namely carry out seamlessly transitting process, the effect making synthesis has the sensation of a kind of softening, emergence in marginal portion so that it is seem more natural; Meanwhile, scratch figure ambient light for green curtain and disturb the problem causing excessive color, it is proposed that based on the removing method of the environment light of environment light factor of influence. Visible, the existing scheme based on the stingy figure of green curtain is improved by the present invention, adds softening and the optical processing of decyclization border, so that image softening more, nature.
Accompanying drawing explanation
Fig. 1 is the flow chart of steps of the background replacement method embodiment of a kind of image of the present invention;
Fig. 2 is the structured flowchart of the background alternative embodiment of a kind of image of the present invention.
Detailed description of the invention
Understandable for enabling the above-mentioned purpose of the present invention, feature and advantage to become apparent from, below in conjunction with the drawings and specific embodiments, the present invention is further detailed explanation.
Referring to Fig. 1, for the background replacement method flow chart of a kind of image that the embodiment of the present invention provides. The method comprises the following steps:
S101: based on the RGB component of image present frame, calculates green difference, and obtains initial alpha channel image based on green difference, and initial alpha channel image includes initial background image and initial foreground image.
Concrete, calculate the G component of current frame image and the difference of R component, B component, i.e. obtain green difference. Further, based on maximum variance between clusters, segmentation threshold can be obtained; Based on segmentation threshold, green difference is analyzed, generates initial alpha channel image. Wherein, big Ostu method is also referred to as Da-Jin algorithm (Otsu), and its principle is, utilizes threshold value that original image is divided into prospect, two images of background; Prospect is used for representing the counting of prospect under present threshold value, moment of mass, average gray; Background is used for representing the counting of background under present threshold value, moment of mass, average gray; When taking optimal threshold, background should be maximum with prospect difference, challenge is how the standard selecting to weigh difference, and this standard weighing difference is exactly maximum between-cluster variance in otsu algorithm.
Alpha (Alpha) passage is the gray channel of 8, and this passage records the transparence information in image by 256 grades of gray scales, defines transparent, opaque and translucent area, and wherein black expression is transparent, and white expression is opaque, and ash represents translucent.
S102: utilize green difference that initial alpha channel image is carried out softening process, obtain the first alpha channel image.
Concrete, based on initial alpha channel image, the foreground image in initial alpha channel image can be analyzed; According to image softening algorithm, based on green difference, the edge of the foreground image of initial alpha channel image is carried out softening process, obtain the first alpha channel image. Wherein, it is the color value of each pixel of original image replaced by the meansigma methods of n*n the pixel being adjacent that softening (smooths) process, and available arithmetic mean of instantaneous value or weighted mean calculate. Contrary with sharpening, softening is to make picture seem more soft and smooth. One simplest algorithm that realizes of softening is exactly take the every bit (image edge point is ignored) on picture, calculates around it the meansigma methods of eight points as new pixel value.
S103: based on environment light factor, the first alpha channel image being carried out environment light removal and process, obtain final alpha channel image, final alpha channel image includes background image to be synthesized and treated foreground image.
Concrete, firstly generate the green background image of a pure color; Following manner can be taked to generate the green background image of this pure color: utilize image repair technology, the lack part in the green background region of the first alpha channel image is filled with, thus generating the green background image of pure color, as the reference of background image to be synthesized; Then, it is determined that environment light factor; Following manner can be taked to determine environment light factor: determine there is the relation of environment light factor and composograph under ambient light conditions: without the former composite diagram of environment light, by environment light factor of influence, obtain composograph with environment light through linear superposition; Then, the relation of derivation environment light factor and true alpha channel image; Finally, the final alpha channel image after the light of decyclization border is calculated.
S104: final alpha channel image, background image to be synthesized and treated foreground image are synthesized.
Visible, the unsmooth problem in border that the embodiment of the present invention exists for prior art, from reason (the light uneven) causing this problem, for this unsmooth phenomenon, carry out softening process, namely carry out seamlessly transitting process so that the effect of synthesis has the sensation of a kind of softening, emergence in marginal portion so that it is seem more natural; Meanwhile, scratch figure ambient light for green curtain and disturb the problem causing excessive color, it is proposed that based on the removing method of the environment light of environment light factor of influence. Visible, the existing scheme based on the stingy figure of green curtain is improved by the present invention, adds softening and the optical processing of decyclization border, so that image softening more, nature.
Below in conjunction with specific algorithm, the embodiment of the present invention is described in detail.
As it was previously stated, the existing green curtain based on video scratch figure often do not reach in real time, self adaptation and be subject to the impact that environment light brings, therefore for meeting the demand of site environment, algorithm performance is had corresponding requirement. The algorithm that the embodiment of the present invention is relied on, is based on vs2010 and opencv2.4.10 and develops jointly, and thinking is summarised as 1 according to sequencing, sets green curtain region;2, calculate background green difference f (x, y); 3, utilize Threshold segmentation to generate alpha0 (initial alpha channel image), and make the alpha1 (the first alpha channel image) that softening process generation is new; 4, do environment light in the prospect that alpha1 is corresponding to remove, and generate alpha (final alpha channel image); 5, utilize alpha channel image and scene to be superimposed to do and merge (blending).
Below each step is explained in detail.
1, green curtain region is set
In order to meet the needs that realistic background is replaced, need to build one piece of green curtain in camera collection region, owing to the size of green curtain is indefinite, so early stage needs manually to calibrate the regional extent of green curtain.
2, calculate background green difference f (x, y)
Assuming that image is I, then calculate green component Ig (x,y)2 times with two other component Ir (x,y)And Ib (x,y)The difference of sum
F (x, y)=2Ig (x,y)-(Ir (x,y)+Ib (x,y)), (2-1)
Wherein, (x, y) for the green difference of pixel corresponding to coordinate points in each image, (x y) represents the coordinate of image, wherein I to fg (x,y)、Ir (x,y)、Ib (x,y)Respectively corresponding (x, y) g, r, b component of coordinate points.
3, the softening of alpha passage processes
According to above formula (2-1), by the method that adaptive threshold value is determined, namely OTSU algorithm (Da-Jin algorithm), processes.
The first step, what obtain for formula (2-1) is gray level image, can in the hope of the segmentation threshold of prospect Yu the inter-class variance of background image according to Da-Jin algorithmth, utilize threshold value come to f (x, y) carries out binary segmentation, generates initial alpha0 image, divides the image into background and target two parts, and background represents with 0, and prospect represents with 255, and formula is as follows:
a l p h a 0 ( x , y ) = 255 , f ( x , y ) &GreaterEqual; t h 0 , f ( x , y ) < t h (3-1)
Second step, utilizes alpha0 image generated above as reference picture, analyzes the relation of 0 and 255 in alpha0, principle is that (x, y) centered by the pixel on image, calculates pixel and value (x that radius is N with each f, y), concrete formula is as follows:
v a l u e ( x , y ) = &Sigma; ( x - N , y - N ) ( x + N , y + N ) f ( x , y ) ; (3-2)
3rd step, convert alpha0 image be newAlpha image, reference formula (3-3), and calculate in newAlpha with (x, centered by y), radius be N blobSize (x, y), reference formula (3-4).
n e w A l p h a ( x , y ) = 1 , a l p h a 0 ( x , y ) = 255 0 , a l p h a 0 ( x , y ) = 0 (3-3)
b l o b S i z e ( x , y ) = &Sigma; ( x - N , y - N ) ( x + N , y + N ) n e w A l p h a ( x , y ) ; (3-4)
4th step, utilizes value and blobSize image to calculate the image of the alpha1 after softening, and formula is with reference to (3-5).
Alpha1 (x, y)=min (value (x, y)/(blobSize (x, y)/2), 255); (3-5)
4, environment light is removed
Principle analysis: environment light can act on image, causes that target entirety is partially green, it is therefore desirable to removing the impact of environment light, obtain real alpha, concrete step is as follows:
The first step, generates the green background image of a pure color.
For removing environment light, it is necessary to obtain the background area of a known green, in order to obtain this region, utilize the alpha1 image that previous step generates as reference, using the green background that respective value is 0 as region Ω interestedB, due to ΩBThe image generated has disappearance, hence with image repair technology (such as Inpaiting technology), being partially filled with of disappearance, thus can generate one and next as the Background of reference, will be denoted as Bg
Second step, it is determined that environment light factor.
Known ready-made image composite formula is:
αcF+(1-αc) B=I (4-1)
Wherein, αcFor calculated alpha1 channel image, F is the foreground image after processing, and B is background image but deposits composite diagram I under ambient light and can be considered, without the former composite diagram of environment light, affects factor-beta by environment light, with environment light BLObtain through linear superposition, and former composite diagram be to be synthetically derived by image:
βBL+ (1-β) (α F+ (1-α) B)=I (4-2)
The relation of the 3rd step, derivation environment light factor and true alpha.
First, it is assumed that the ambient light color being reflected on foreground object is identical with current background color, i.e. BL=B, for
(1-β) α F+ (1-(1-β) α) B=I (4-3)
According to formula (4-1), it is possible to infer, then make not by the true α value of ambient light interference, then have:
(1-β)αec(4-4)
Therefore, α is obtainede, it is possible to obtain the real alpha channel image of image.
4th step, calculates the α after the light of decyclization bordere
1) when image synthesizes, only consider that alpha1 intermediate value is not the region of 0, is referred to as analyzed area ΩUF;
2) assume, for the green curtain image under ambient light interference, to scratch, by green curtain, the general solution α that nomography obtainsc, for ΩUFInterior each point, owing to, in stingy figure process, being reflected in the environment light B on foreground objectLActually it is taken as background to use, therefore can obtain its corresponding foreground color F:
F=(I-(1-αc)BL)/αc(4-5)
3) it is assumed above that environment light BLIdentical with background, but under normal conditions, owing to there is foreground object and blocking, background and prospect distance (degree of depth) position, foreground object surface the relation such as strong reflection, reflex to the ambient light B of prospectLGenerally brighter than background B, therefore, make BLBlue channel take maximum, and other two passages retain original brightness, BL g=1, BL r=Br, BL b=Bb,
&alpha; ( x , y ) e = min c &Element; r , g , b ( V t h - B c ( x , y ) ) / ( F c ( x , y ) - B c ( x , y ) ) , &Exists; c , F c ( x , y ) > 1 1 , &ForAll; c , F c ( x , y ) &Element; &lsqb; 0 , 1 &rsqb; (4-6)
Wherein, VthIt is that an outside arranges the parameter value that can regulate, Fc (x,y)For according to (4-5) calculated new prospect value, i.e. F abovec, Bc (x,y)For at image repair BgOn result after the process that carries out.
5, alpha channel image is utilized to be blending
Utilize α generated abovee, it being the foreground image F' after final alpha image, separating treatment and background image B' to be synthesized, formula is as follows:
I'=αeF'+(1-αe)B'(5-1)
I' is then the composite diagram ultimately generated, this composite diagram is also a kind of simple and easy to do approach changing picture visual effect, dynamic picture needs " deficiency and excess combination ", accordingly even when be plane synthesis, also can give people's spatial impression and contrast, people more can be allowed to produce association, and the quality obscuring improving picture can be used, even being likely to very coarse picture, after treatment also can be pleasing.
Visible, employing softening processing scheme can be invented, solve to cause owing to light is uneven scratching the problem that figure border is unsmooth, stiff; Due to the impact of environment light, when the green curtain separation prospect of background, foreground information can entirety deflection green, herein by environment light removing method, solve ambient light interference and bring image to overflow the problem of color, make fusion picture seem more natural, more comfortable. Adopt the present invention program, it is possible in real time green curtain video is processed, without manual intervention in synthetic video process, for the first time after parameter setting, can self-adaptive processing; Non-green region in green curtain video, is superimposed with various scenery after separating including personage, equipment, forms magical artistic effect, for instance while can increasing the live picture effect of main broadcaster, also allow spectators see more rich direct-seeding.
It should be noted that, for embodiment of the method, in order to be briefly described, therefore it is all expressed as a series of combination of actions, but those skilled in the art should know, the embodiment of the present invention is not by the restriction of described sequence of movement, because according to the embodiment of the present invention, some step can adopt other orders or carry out simultaneously. Secondly, those skilled in the art also should know, embodiment described in this description belongs to preferred embodiment, necessary to the involved action not necessarily embodiment of the present invention.
With reference to Fig. 2, it is shown that the structured flowchart of the background alternative embodiment of a kind of image of the present invention, following ingredient specifically can be included:
Initial pictures acquiring unit 201, for the RGB component based on image present frame, calculates green difference, and obtains initial alpha channel image based on green difference, and described initial alpha channel image includes initial background image and initial foreground image;
Softening processing unit 202, is used for utilizing green difference that initial alpha channel image is carried out softening process, obtains the first alpha channel image;
Environment light removal unit 203, processes for the first alpha channel image being carried out environment light removal based on environment light factor, obtains final alpha channel image, and final alpha channel image includes background image to be synthesized and treated foreground image;
Image composing unit 204, for synthesizing final alpha channel image, background image to be synthesized and treated foreground image.
Preferably, initial pictures acquiring unit 201 specifically for, based on maximum variance between clusters, obtain segmentation threshold; Based on segmentation threshold, green difference is analyzed, generates initial alpha channel image.
Preferably, softening processing unit 202 specifically for, based on initial alpha channel image, analyze the foreground image in initial alpha channel image; According to image softening algorithm, based on green difference, the edge of the foreground image of initial alpha channel image is carried out softening process, obtain the first alpha channel image.
Preferably, environment light removal unit concrete 203 is used for, it is determined that environment light factor; The relation of derivation environment light factor and true alpha channel image; Calculate the final alpha channel image after the light of decyclization border.
Preferably, environment light removal unit 203 specifically for, it is determined that there is the relation of environment light factor and composograph under ambient light conditions: without the former composite diagram of environment light, by environment light factor of influence, obtain composograph with environment light through linear superposition.
Preferably, environment light removal unit 203 is additionally operable to, generate the green background image of a pure color, concrete, utilize image repair technology, the lack part in the green background region of the first alpha channel image is filled with, thus generating the green background image of pure color, as the reference of background image to be synthesized.
For device embodiment, due to itself and embodiment of the method basic simlarity, so what describe is fairly simple, relevant part illustrates referring to the part of embodiment of the method.
Each embodiment in this specification all adopts the mode gone forward one by one to describe, and what each embodiment stressed is the difference with other embodiments, between each embodiment identical similar part mutually referring to.
Those skilled in the art are it should be appreciated that the embodiment of the embodiment of the present invention can be provided as method, device or computer program. Therefore, the embodiment of the present invention can adopt the form of complete hardware embodiment, complete software implementation or the embodiment in conjunction with software and hardware aspect. And, the embodiment of the present invention can adopt the form at one or more upper computer programs implemented of computer-usable storage medium (including but not limited to disk memory, CD-ROM, optical memory etc.) wherein including computer usable program code.
The embodiment of the present invention is that flow chart and/or block diagram with reference to method according to embodiments of the present invention, terminal unit (system) and computer program describe.It should be understood that can by the combination of the flow process in each flow process in computer program instructions flowchart and/or block diagram and/or square frame and flow chart and/or block diagram and/or square frame. These computer program instructions can be provided to produce a machine to the processor of general purpose computer, special-purpose computer, Embedded Processor or other programmable data processing terminal equipment so that the instruction performed by the processor of computer or other programmable data processing terminal equipment is produced for realizing the device of function specified in one flow process of flow chart or multiple flow process and/or one square frame of block diagram or multiple square frame.
These computer program instructions may be alternatively stored in and can guide in the computer-readable memory that computer or other programmable data processing terminal equipment work in a specific way, the instruction making to be stored in this computer-readable memory produces to include the manufacture of command device, and this command device realizes the function specified in one flow process of flow chart or multiple flow process and/or one square frame of block diagram or multiple square frame.
These computer program instructions also can be loaded on computer or other programmable data processing terminal equipment, make on computer or other programmable terminal equipment, to perform sequence of operations step to produce computer implemented process, thus the instruction performed on computer or other programmable terminal equipment provides for realizing the step of function specified in one flow process of flow chart or multiple flow process and/or one square frame of block diagram or multiple square frame.
Although having been described for the preferred embodiment of the embodiment of the present invention, but those skilled in the art are once know basic creative concept, then these embodiments can be made other change and amendment. So, claims are intended to be construed to include preferred embodiment and fall into all changes and the amendment of range of embodiment of the invention.
Finally, it can further be stated that, in this article, the relational terms of such as first and second or the like is used merely to separate an entity or operation with another entity or operating space, and not necessarily requires or imply the relation that there is any this reality between these entities or operation or sequentially. And, term " includes ", " comprising " or its any other variant are intended to comprising of nonexcludability, so that include the process of a series of key element, method, article or terminal unit not only include those key elements, but also include other key elements being not expressly set out, or also include the key element intrinsic for this process, method, article or terminal unit. When there is no more restriction, statement " including ... " key element limited, it is not excluded that there is also other identical element in including the process of described key element, method, article or terminal unit.
Above to the background replacement method of a kind of image provided by the present invention and device, it is described in detail, principles of the invention and embodiment are set forth by specific case used herein, and the explanation of above example is only intended to help to understand method and the core concept thereof of the present invention; Simultaneously for one of ordinary skill in the art, according to the thought of the present invention, all will change in specific embodiments and applications, in sum, this specification content should not be construed as limitation of the present invention.

Claims (12)

1. the background replacement method of an image, it is characterised in that including:
Based on the RGB component of image present frame, calculating green difference, and obtain initial alpha channel image based on described green difference, described initial alpha channel image includes initial background image and initial foreground image;
Utilize described green difference that described initial alpha channel image is carried out softening process, obtain the first alpha channel image;
Based on environment light factor, described first alpha channel image being carried out environment light removal to process, obtain final alpha channel image, described final alpha channel image includes background image to be synthesized and treated foreground image;
Described final alpha channel image, background image to be synthesized and treated foreground image are synthesized.
2. method according to claim 1, it is characterised in that described utilize described green difference that described initial alpha channel image is carried out softening process, obtains the first alpha channel image, including:
Based on described initial alpha channel image, analyze the foreground image in described initial alpha channel image;
According to image softening algorithm, based on described green difference, the edge of the foreground image of described initial alpha channel image is carried out softening process, obtain described first alpha channel image.
3. method according to claim 1, it is characterised in that described based on environment light factor, described first alpha channel image is carried out environment light removal process, obtain final alpha channel image, including:
Determine environment light factor;
The relation of derivation environment light factor and true alpha channel image;
Calculate the final alpha channel image after the light of decyclization border.
4. method according to claim 3, it is characterised in that described determine that environment light factor includes:
Determine there is the relation of environment light factor and composograph under ambient light conditions: without the former composite diagram of environment light, by environment light factor of influence, obtain composograph with environment light through linear superposition.
5. method according to claim 3, it is characterized in that, also include: generate the green background image of a pure color, concrete, utilize image repair technology, the lack part in the green background region of the first alpha channel image is filled with, thus generating the green background image of pure color, as the reference of described background image to be synthesized.
6. method according to claim 1, it is characterised in that described obtain initial alpha channel image based on described green difference, including:
Based on maximum variance between clusters, obtain segmentation threshold;
Based on described segmentation threshold, described green difference is analyzed, generates initial alpha channel image.
7. the background alternative of an image, it is characterised in that including:
Initial pictures acquiring unit, for the RGB component based on image present frame, calculates green difference, and obtains initial alpha channel image based on described green difference, and described initial alpha channel image includes initial background image and initial foreground image;
Softening processing unit, is used for utilizing described green difference that described initial alpha channel image is carried out softening process, obtains the first alpha channel image;
Environment light removal unit, process for described first alpha channel image being carried out environment light removal based on environment light factor, obtaining final alpha channel image, described final alpha channel image includes background image to be synthesized and treated foreground image;
Image composing unit, for synthesizing described final alpha channel image, background image to be synthesized and treated foreground image.
8. device according to claim 7, it is characterised in that described softening processing unit specifically for, based on described initial alpha channel image, analyze the foreground image in described initial alpha channel image;According to image softening algorithm, based on described green difference, the edge of the foreground image of described initial alpha channel image is carried out softening process, obtain described first alpha channel image.
9. device according to claim 7, it is characterised in that described environment light removal unit is specifically for, it is determined that environment light factor; The relation of derivation environment light factor and true alpha channel image; Calculate the final alpha channel image after the light of decyclization border.
10. device according to claim 9, it is characterized in that, described environment light removal unit specifically for, determine there is the relation of environment light factor and composograph under ambient light conditions: without the former composite diagram of environment light, by environment light factor of influence, obtain composograph with environment light through linear superposition.
11. device according to claim 9, it is characterized in that, described environment light removal unit is additionally operable to, generate the green background image of a pure color, concrete, utilize image repair technology, the lack part in the green background region of the first alpha channel image is filled with, thus generating the green background image of pure color, as the reference of described background image to be synthesized.
12. device according to claim 7, it is characterised in that described initial pictures acquiring unit specifically for, based on maximum variance between clusters, obtain segmentation threshold; Based on described segmentation threshold, described green difference is analyzed, generates initial alpha channel image.
CN201511017806.2A 2015-12-29 2015-12-29 Background replacing method and apparatus for images Pending CN105678724A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201511017806.2A CN105678724A (en) 2015-12-29 2015-12-29 Background replacing method and apparatus for images

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201511017806.2A CN105678724A (en) 2015-12-29 2015-12-29 Background replacing method and apparatus for images

Publications (1)

Publication Number Publication Date
CN105678724A true CN105678724A (en) 2016-06-15

Family

ID=56297894

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201511017806.2A Pending CN105678724A (en) 2015-12-29 2015-12-29 Background replacing method and apparatus for images

Country Status (1)

Country Link
CN (1) CN105678724A (en)

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106340027A (en) * 2016-08-26 2017-01-18 西北大学 Calligraphy background reconstruction method based on image super resolution
CN106485723A (en) * 2016-10-21 2017-03-08 重庆虚拟实境科技有限公司 Game engine real-time image scratching method
CN107230182A (en) * 2017-08-03 2017-10-03 腾讯科技(深圳)有限公司 A kind of processing method of image, device and storage medium
CN107403452A (en) * 2017-07-27 2017-11-28 深圳章鱼信息科技有限公司 Object identification method and its device based on FIG pull handle
CN107622504A (en) * 2017-09-30 2018-01-23 北京百度网讯科技有限公司 Method and apparatus for handling picture
CN107770618A (en) * 2017-11-02 2018-03-06 腾讯科技(深圳)有限公司 A kind of image processing method, device and storage medium
CN108198128A (en) * 2017-12-12 2018-06-22 北京美摄网络科技有限公司 A kind of method and device of alpha channel boundary corrosions
CN110930321A (en) * 2019-11-06 2020-03-27 杭州恩玖软件有限公司 Blue/green screen digital image matting method capable of automatically selecting target area
CN110969595A (en) * 2019-12-02 2020-04-07 成都索贝数码科技股份有限公司 Pure-color background matting and synthesizing method based on real-time background color overflow inhibition
CN111274602A (en) * 2020-01-15 2020-06-12 腾讯科技(深圳)有限公司 Image characteristic information replacement method, device, equipment and medium
CN111524076A (en) * 2020-04-07 2020-08-11 咪咕文化科技有限公司 Image processing method, electronic device, and computer-readable storage medium
CN112381222A (en) * 2020-11-12 2021-02-19 北京乐学帮网络技术有限公司 Sample generation method and device, computer equipment and storage medium
CN112700526A (en) * 2020-12-30 2021-04-23 稿定(厦门)科技有限公司 Concave-convex material image rendering method and device
CN114461093A (en) * 2021-08-19 2022-05-10 荣耀终端有限公司 Detection method of ambient light, electronic equipment, chip system and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101764914A (en) * 2008-12-10 2010-06-30 新奥特(北京)视频技术有限公司 Method of alpha channel boundary corrosion
CN103475826A (en) * 2013-09-27 2013-12-25 深圳市中视典数字科技有限公司 Video matting and synthesis method
US20140010448A1 (en) * 2012-07-06 2014-01-09 Yissum Research Development Company Of The Hebrew University Of Jerusalem Ltd. Method and apparatus for enhancing a digital photographic image
CN104200470A (en) * 2014-08-29 2014-12-10 电子科技大学 Blue screen image-matting method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101764914A (en) * 2008-12-10 2010-06-30 新奥特(北京)视频技术有限公司 Method of alpha channel boundary corrosion
US20140010448A1 (en) * 2012-07-06 2014-01-09 Yissum Research Development Company Of The Hebrew University Of Jerusalem Ltd. Method and apparatus for enhancing a digital photographic image
CN103475826A (en) * 2013-09-27 2013-12-25 深圳市中视典数字科技有限公司 Video matting and synthesis method
CN104200470A (en) * 2014-08-29 2014-12-10 电子科技大学 Blue screen image-matting method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
姚桂林: "数字图像抠图关键技术研究", 《中国博士学位论文全文数据库》 *

Cited By (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106340027B (en) * 2016-08-26 2019-02-01 西北大学 A kind of calligraphy Background Rebuilding Method based on image super-resolution
CN106340027A (en) * 2016-08-26 2017-01-18 西北大学 Calligraphy background reconstruction method based on image super resolution
CN106485723A (en) * 2016-10-21 2017-03-08 重庆虚拟实境科技有限公司 Game engine real-time image scratching method
CN106485723B (en) * 2016-10-21 2019-02-19 重庆虚拟实境科技有限公司 Game engine real-time image scratching method
CN107403452A (en) * 2017-07-27 2017-11-28 深圳章鱼信息科技有限公司 Object identification method and its device based on FIG pull handle
CN107230182A (en) * 2017-08-03 2017-10-03 腾讯科技(深圳)有限公司 A kind of processing method of image, device and storage medium
CN107230182B (en) * 2017-08-03 2021-11-09 腾讯科技(深圳)有限公司 Image processing method and device and storage medium
CN107622504A (en) * 2017-09-30 2018-01-23 北京百度网讯科技有限公司 Method and apparatus for handling picture
CN107770618B (en) * 2017-11-02 2021-03-02 腾讯科技(深圳)有限公司 Image processing method, device and storage medium
CN107770618A (en) * 2017-11-02 2018-03-06 腾讯科技(深圳)有限公司 A kind of image processing method, device and storage medium
CN108198128A (en) * 2017-12-12 2018-06-22 北京美摄网络科技有限公司 A kind of method and device of alpha channel boundary corrosions
CN110930321A (en) * 2019-11-06 2020-03-27 杭州恩玖软件有限公司 Blue/green screen digital image matting method capable of automatically selecting target area
CN110969595A (en) * 2019-12-02 2020-04-07 成都索贝数码科技股份有限公司 Pure-color background matting and synthesizing method based on real-time background color overflow inhibition
CN110969595B (en) * 2019-12-02 2023-08-01 成都索贝数码科技股份有限公司 Pure-color background matting synthesis method based on real-time background color overflow inhibition
CN111274602A (en) * 2020-01-15 2020-06-12 腾讯科技(深圳)有限公司 Image characteristic information replacement method, device, equipment and medium
CN111524076A (en) * 2020-04-07 2020-08-11 咪咕文化科技有限公司 Image processing method, electronic device, and computer-readable storage medium
CN111524076B (en) * 2020-04-07 2023-07-21 咪咕文化科技有限公司 Image processing method, electronic device, and computer-readable storage medium
CN112381222A (en) * 2020-11-12 2021-02-19 北京乐学帮网络技术有限公司 Sample generation method and device, computer equipment and storage medium
CN112700526A (en) * 2020-12-30 2021-04-23 稿定(厦门)科技有限公司 Concave-convex material image rendering method and device
CN112700526B (en) * 2020-12-30 2022-07-19 稿定(厦门)科技有限公司 Concave-convex material image rendering method and device
CN114461093A (en) * 2021-08-19 2022-05-10 荣耀终端有限公司 Detection method of ambient light, electronic equipment, chip system and storage medium
CN114461093B (en) * 2021-08-19 2023-01-20 荣耀终端有限公司 Detection method of ambient light, electronic equipment, chip system and storage medium

Similar Documents

Publication Publication Date Title
CN105678724A (en) Background replacing method and apparatus for images
US20190045172A1 (en) Varying display content based on viewpoint
US8947422B2 (en) Gradient modeling toolkit for sculpting stereoscopic depth models for converting 2-D images into stereoscopic 3-D images
JP5962393B2 (en) Image processing apparatus, image processing method, and image processing program
CN102202224B (en) Caption flutter-free method and apparatus used for plane video stereo transition
US8884948B2 (en) Method and system for creating depth and volume in a 2-D planar image
US8711204B2 (en) Stereoscopic editing for video production, post-production and display adaptation
US8351689B2 (en) Apparatus and method for removing ink lines and segmentation of color regions of a 2-D image for converting 2-D images into stereoscopic 3-D images
CN101287143B (en) Method for converting flat video to tridimensional video based on real-time dialog between human and machine
RU2481640C1 (en) Method and system of generation of animated art effects on static images
WO2004019621A1 (en) Method and device for creating 3-dimensional view image
JP2015022458A (en) Image processing device, image processing method, and image processing program
CN101287142A (en) Method for converting flat video to tridimensional video based on bidirectional tracing and characteristic points correction
CN103916669A (en) High dynamic range image compression method and device
CN102379127A (en) Video processing device, video processing method, and computer program
US20130127989A1 (en) Conversion of 2-Dimensional Image Data into 3-Dimensional Image Data
US20130257851A1 (en) Pipeline web-based process for 3d animation
CN111292389B (en) Image processing method and device
AU2019309552A1 (en) Method and data-processing system for synthesizing images
CN105578172B (en) Bore hole 3D image display methods based on Unity3D engines
CN104063888A (en) Pop art style drawing method based on non-photorealistic
CN111402385B (en) Model processing method and device, electronic equipment and storage medium
CN116310005A (en) Holographic cabinet, dynamic virtual image video processing method and image processing method
CN112700485B (en) Image depth information extraction method
CN104050700A (en) Image synthetic method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20160615