CN109166135B - Blue screen keying method based on HSV color space and chroma key - Google Patents

Blue screen keying method based on HSV color space and chroma key Download PDF

Info

Publication number
CN109166135B
CN109166135B CN201811208811.5A CN201811208811A CN109166135B CN 109166135 B CN109166135 B CN 109166135B CN 201811208811 A CN201811208811 A CN 201811208811A CN 109166135 B CN109166135 B CN 109166135B
Authority
CN
China
Prior art keywords
value
color space
mask
background
fusion
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811208811.5A
Other languages
Chinese (zh)
Other versions
CN109166135A (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.)
Northeastern University China
Original Assignee
Northeastern University 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 Northeastern University China filed Critical Northeastern University China
Priority to CN201811208811.5A priority Critical patent/CN109166135B/en
Publication of CN109166135A publication Critical patent/CN109166135A/en
Application granted granted Critical
Publication of CN109166135B publication Critical patent/CN109166135B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/194Segmentation; Edge detection involving foreground-background segmentation
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/222Studio circuitry; Studio devices; Studio equipment
    • H04N5/262Studio circuits, e.g. for mixing, switching-over, change of character of image, other special effects ; Cameras specially adapted for the electronic generation of special effects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10016Video; Image sequence
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10024Color image
    • 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 blue screen keying method based on HSV color space and chroma keys, which can accurately remove overflowing pixel points in a blue background and a semitransparent material, and adopts the technical scheme that: converting the picture from the RGB color space to the HSV color space, removing the blue screen background, generating a mask by the reserved part, performing chroma key keying on the RGB color space on the part of the original picture corresponding to the black of the mask, generating a Distance picture, and synthesizing according to the Distance picture.

Description

Blue screen keying method based on HSV color space and chroma key
Technical Field
The invention belongs to the field of image matting methods, and particularly relates to a blue screen image matting method based on HSV color space and chroma keys.
Background
The blue screen matting method is to remove the blue background in the picture or video shot under the blue screen. The current blue screen image matting methods include lightness key, chroma key, mask image, and linear key. There are problems of color overflow, unclean channel, edge distortion, etc. In addition, semi-transparent (yarn quality) keying is a difficult point of blue screen keying, and overflow pixel points of a semi-transparent part are difficult to completely remove. There is no technology to solve these problems and difficulties. Meanwhile, the current image matting method is difficult to ensure the full automation and the real-time performance of video image matting.
Disclosure of Invention
Aiming at the problems, the invention provides a blue screen keying method based on HSV color space and chroma keys, which can accurately remove overflowing pixel points in a blue background and a semitransparent material; the method comprises the following specific steps:
step 1, acquiring data or using local data through shooting to obtain a data set, namely a blue screen picture or a video to be scratched, converting the picture from an RGB color space to an HSV color space, performing blue screen background scratching, and generating a mask.
And 2, carrying out chroma key matting (semitransparent matting) on the RGB color space at the part of the original image corresponding to the mask pixel value of 0, and generating a Distance image.
The principle formula of the chroma key image matting method is as follows:
Figure BDA0001831909850000011
wherein r is1、g1、b1RGB color values, r, for color keys2、g2、b2The color value of the current pixel of the traversed picture to be scratched is shown.
Step 3, synthesizing the image matting and the picture to be synthesized; the synthesis is divided into three types:
1) the value of the mask pixel point is 0, which explains that the quadratic function is used for synthesis in the keying reserved part, and the quadratic function form is set as:
γ=AX2+ BX + C (formula 2)
Setting the maximum fusion proportion as m, obtaining the image of the function, and determining A as m/255 by a undetermined coefficient method2B ═ 2m × 255, C ═ m. X is the value of the pixel point in the corresponding Distance image, and gamma is the fusion proportion of the background to be synthesized.
The fusion formula is:
w=w1*γ+w2(1-. gamma.) (formula 3)
Due to the division into 3 channels R, G, B, W1Values of R, G, B representing the background, W2Represents the values of the reserved portions R, G, B, and W represents the value of the corresponding channel after synthesis.
2) The value of the mask pixel belongs to [1,254], which indicates that edge fusion is carried out on the edge of the keying reserved part by adopting a linear function:
γ ═ (1/255) × (formula 4)
X is the value of the mask pixel point, and gamma is the fusion proportion of the background to be synthesized. The fusion formula is shown in formula 3.
3) The value of the mask pixel is 255, which indicates that the fusion ratio of the background to be synthesized is 1 outside the keying-out reserved part.
Compared with the prior art, the invention has the beneficial effects that:
under the condition of guaranteeing full automation of image matting and real-time performance of video image matting, the problems of color overflow, unclean channel, edge distortion and difficulty of semitransparent image matting are solved, and pixels overflowing in blue background and semitransparent materials can be accurately removed.
Drawings
FIG. 1 is a mask image generated after blue screen background removal of a picture.
Fig. 2 is a Distance diagram generated by chroma key matting in RGB color space on a mask black corresponding to a portion of an original image.
Fig. 3 is a flow chart of the scheme of the invention.
Fig. 4 is a diagram of HSV color space.
Fig. 5 is a color region distribution diagram of the HSV color space.
Fig. 6 is a functional image of a quadratic function.
FIG. 7 is a diagram of the effect of final matting and compositing.
Detailed Description
The technical scheme adopted by the invention is that a picture is converted from an RGB color space to an HSV color space, a blue screen background is removed, and a mask is generated on the reserved part, as shown in figure 1; performing chroma key keying on the part of the original image corresponding to the black of the mask in the RGB color space, and generating a Distance image as shown in FIG. 2; the synthesis was performed according to the Distance diagram. The protocol flow is shown in figure 3. The technical scheme of the invention is specifically explained as follows:
step 1, obtaining a data set, namely a blue screen picture or a video to be scratched, by shooting obtained data or using local data, converting the picture from an RGB color space to an HSV color space, scratching the blue screen background, and generating a mask.
The HSV color space is shown in fig. 4, and the color gamut distribution is shown in fig. 5. According to the HSV color distribution, when the corresponding colors of H element [100, 124], S element [43,255] and V element [46,255] are blue, the blue color of the background is removed firstly. And a mask is generated from the remaining portion. The mask is a single channel, the pixel value of the mask is between [0, 255], if a certain point is inside the reserved part, the pixel value is 0, if the certain point is the edge of the reserved part, the value of the pixel point is in the range of [1,254], and if the pixel value is 255, the point is the part for removing the background.
Wherein r is1、g1、b1RGB color values, r, for color keys2、g2、b2And generating a Distance image for the color value (semi-transparent keying) of the current pixel of the traversed picture to be keyed.
The principle formula of the chroma key image matting method is as follows:
Figure BDA0001831909850000031
wherein r is1、g1、b1RGB color values, r, for color keys2、g2、b2The color value of the current pixel of the traversed picture to be scratched is shown.
And 3, synthesizing the image matting and the picture to be synthesized. The synthesis is divided into three types:
1) the value of the mask pixel point is 0, which explains that the quadratic function is used for synthesis in the keying reserved part, and the quadratic function form is set as:
γ=AX2+ BX + C (formula 2)
Setting the maximum fusion ratio as m, the image of the function as shown in fig. 6, and determining a as m/255 by using the undetermined coefficient method2B ═ 2m/255, and C ═ m. X is the value of the pixel point in the corresponding Distance image, and gamma is the fusion proportion of the background to be synthesized.
The fusion formula is:
w=w1*γ+w2(1-. gamma.) (formula 3)
Due to the division into 3 channels R, G, B, w1Values for R, G, B representing the background, w2Represents the values of the reserved portions R, G, B, and w represents the value of the corresponding channel after synthesis.
2) The value of the mask pixel belongs to [1,254], which shows that in the edge of the keying reserved part, a linear function is adopted to carry out edge fusion:
γ ═ (1/255) × (formula 4)
X is the value of the mask pixel point, and gamma is the fusion proportion of the background to be synthesized. The fusion formula is shown in formula 3.
3) The value of the mask pixel is 255, which indicates that the fusion ratio of the background to be synthesized is 1 outside the keying-out reserved part.
The final matting and compositing effect is shown in fig. 7.

Claims (3)

1. A blue screen keying method based on HSV color space and chroma keys is characterized by comprising the following steps:
step 1, obtaining a data set, namely a blue screen picture or a video to be scratched, by shooting acquired data or using local data, converting the picture from an RGB color space to an HSV color space, setting the range of H, S, V three channels, scratching the blue screen background and generating a mask;
step 2, chroma key matting is carried out on the RGB color space of the part of the original image corresponding to the mask pixel value of 0, and a Distance image is generated;
step 3, synthesizing the image matting and the picture to be synthesized; the synthesis is divided into three types:
1) the value of the mask pixel point is 0, which explains that the quadratic function is used for synthesis in the keying reserved part, and the quadratic function form is set as:
γ=AK2+BK+C
setting the maximum fusion ratio as m, and when the value of a pixel point in the Distance graph is 0, setting the fusion ratio of the background to be synthesized as m; when the value of a pixel point in the Distance image is 255, the fusion proportion of the background to be synthesized is 0, the symmetric axis-B/2A of the quadratic function is 255, an image of the function is obtained, and the value of the coefficient A, B, C is determined by using a undetermined coefficient method; k is the value of the pixel point in the corresponding Distance image, and gamma is the fusion proportion of the background to be synthesized;
the fusion formula is:
w=w1*γ+w2(1-γ)
divided into 3 channels R, G, B, w1R, G representing backgroundValue of B, w2Representing the values of the reserved portions R, G and B, and w representing the value of the synthesized corresponding channel;
2) the value of the mask pixel belongs to [1,254], which shows that in the edge of the keying reserved part, a linear function is adopted to carry out edge fusion:
γ=(1/255)*X
x is the value of the mask pixel point, and gamma is the fusion proportion of the background to be synthesized; fusing by adopting a fusion formula;
3) the value of the mask pixel is 255, which indicates that the fusion ratio of the background to be synthesized is 1 outside the keying-out reserved part.
2. The blue screen keying method based on HSV color space and chroma keys as claimed in claim 1, wherein the specific method of step 1 is as follows:
according to the HSV color distribution, when the channel H belongs to [100, 124], the channel S belongs to [43,255] and the channel V belongs to [46,255], the corresponding color is blue, the blue of the background is removed, and a mask is generated according to the reserved part; the mask is a single channel, the pixel value is between [0, 255], the pixel value is 0 in the reserved part, the pixel value is in the range of [1,254] at the edge of the reserved part, and the pixel value is 255, the background part is removed.
3. The blue screen keying method based on HSV color space and chroma keys as claimed in claim 1, wherein the specific method of step 2 is as follows:
the principle formula of the chroma key image matting method is as follows:
Figure FDA0003264238010000021
wherein r is1、g1、b1RGB color values, r, for color keys2、g2、b2The color value of the current pixel of the traversed picture to be scratched is shown.
CN201811208811.5A 2018-10-17 2018-10-17 Blue screen keying method based on HSV color space and chroma key Active CN109166135B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811208811.5A CN109166135B (en) 2018-10-17 2018-10-17 Blue screen keying method based on HSV color space and chroma key

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811208811.5A CN109166135B (en) 2018-10-17 2018-10-17 Blue screen keying method based on HSV color space and chroma key

Publications (2)

Publication Number Publication Date
CN109166135A CN109166135A (en) 2019-01-08
CN109166135B true CN109166135B (en) 2021-10-29

Family

ID=64878477

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811208811.5A Active CN109166135B (en) 2018-10-17 2018-10-17 Blue screen keying method based on HSV color space and chroma key

Country Status (1)

Country Link
CN (1) CN109166135B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109919836A (en) * 2019-03-20 2019-06-21 广州华多网络科技有限公司 Video keying processing method, video keying processing client and readable storage medium storing program for executing
CN110276735A (en) * 2019-06-28 2019-09-24 北京金山安全软件有限公司 Method, device and equipment for generating image color retention effect and storage medium
CN112969007B (en) * 2021-02-02 2022-04-12 东北大学 Video post-production method oriented to virtual three-dimensional background

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101989353A (en) * 2010-12-10 2011-03-23 中国科学院深圳先进技术研究院 Image matting method
CN103366364A (en) * 2013-06-07 2013-10-23 太仓中科信息技术研究院 Color difference-based image matting method
CN106952270A (en) * 2017-03-01 2017-07-14 湖南大学 A kind of quickly stingy drawing method of uniform background image

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8477149B2 (en) * 2009-04-01 2013-07-02 University Of Central Florida Research Foundation, Inc. Real-time chromakey matting using image statistics

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101989353A (en) * 2010-12-10 2011-03-23 中国科学院深圳先进技术研究院 Image matting method
CN103366364A (en) * 2013-06-07 2013-10-23 太仓中科信息技术研究院 Color difference-based image matting method
CN106952270A (en) * 2017-03-01 2017-07-14 湖南大学 A kind of quickly stingy drawing method of uniform background image

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
X光图像拼接方法的研究;加冯刚;《中国优秀硕士学位论文全文数据库 信息科技辑》;20180115(第01期);论文第15-17页 *
一种基于采样的蓝屏抠像方法;权巍 等;《长春理工大学学报(自然科学版)》;20150630;第38卷(第3期);全文 *
数字抠像算法的研究;徐骁斐;《中国优秀硕士学位论文全文数据库 信息科技辑》;20111215(第S1期);全文 *

Also Published As

Publication number Publication date
CN109166135A (en) 2019-01-08

Similar Documents

Publication Publication Date Title
US8488868B2 (en) Generation of a depth map from a monoscopic color image for rendering stereoscopic still and video images
CN109166135B (en) Blue screen keying method based on HSV color space and chroma key
KR101343240B1 (en) Automatic removal of purple fringing from images
KR101287481B1 (en) Converting a colorimetric transform from an input color space to an output color space
CN107154059A (en) A kind of high dynamic range video processing method
CN107087123B (en) Real-time high-definition image matting method based on cloud processing
JP2009055465A (en) Image processing device and method
JP2000165692A (en) Color data converting method
WO2019225692A1 (en) Video processing device, video processing method, and video processing program
JPH11331596A (en) Image processing method and its device
WO2012153604A1 (en) Image processing apparatus, program therefor, and image processing method
CN109118437B (en) Method and storage medium capable of processing muddy water image in real time
WO2004075113A1 (en) Image processing device, method, and program
CN111107330B (en) Color cast correction method for Lab space
JP2000224607A (en) Image processor
CN104392425A (en) Face based automatic contrast adjusting image enhancing method
CN104112259A (en) Rain removing method and system for single image
JP4375580B2 (en) Image processing apparatus, image processing method, and image processing program
US8922580B2 (en) Method and system to modify a color lookup table
WO2013037684A1 (en) Method for converting a full colour image to a monochrome image
US20060291015A1 (en) Applying multiple imaging processes to digital images
JP4396107B2 (en) Video display system
KR100477657B1 (en) Method for improvement of digital image quality
JP2000316095A (en) Picture processor and picture processing method
KR101297465B1 (en) Method for converting color image to black-and-white image and recoded media having program performing the same

Legal Events

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