CN101764911B - Method for restraining overflow of foreground color and controlling mixed brightness - Google Patents

Method for restraining overflow of foreground color and controlling mixed brightness Download PDF

Info

Publication number
CN101764911B
CN101764911B CN 200810238991 CN200810238991A CN101764911B CN 101764911 B CN101764911 B CN 101764911B CN 200810238991 CN200810238991 CN 200810238991 CN 200810238991 A CN200810238991 A CN 200810238991A CN 101764911 B CN101764911 B CN 101764911B
Authority
CN
China
Prior art keywords
angle
color
value
space
frange
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN 200810238991
Other languages
Chinese (zh)
Other versions
CN101764911A (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.)
Beijing culture science and technology finance leasing Limited by Share Ltd
Original Assignee
China Digital Video Beijing 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 China Digital Video Beijing Ltd filed Critical China Digital Video Beijing Ltd
Priority to CN 200810238991 priority Critical patent/CN101764911B/en
Publication of CN101764911A publication Critical patent/CN101764911A/en
Application granted granted Critical
Publication of CN101764911B publication Critical patent/CN101764911B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention discloses a method for restraining the overflow of a foreground color and controlling mixed brightness, which belongs to the technical field of video and image special effect processing and synthesis. The method comprises the steps of firstly compressing a V value to make a UV space become a square space and adjusting the V value in the compressed UV space of each pixel in an overflow color and an input image to obtain an overflow color angle; rotating all the pixel colors and balance colors of the input image by a certain angle in the UV space and adjusting the U and V values of all the pixels and balance colors of the input image; determining critical points and regulation factors of the overflow area of the input image according to the overflow scope and a mixed edge and adjusting the pixels larger than the critical point; finally rotating colors of all the pixels in the input image by a certain angle in the UV space and adjusting the U and V values of the rotated pixels; and decompressing UV space to the original space and adjusting the V values of all the pixels of the input image.

Description

A kind ofly suppress the method that foreground color overflows and control mixed brightness
Technical field
The invention belongs to special effect processing and the synthesis technical field of video and image, be specifically related to a kind of method that foreground color overflows and control mixed brightness that suppresses.The present invention be particularly useful for high-quality, high efficiency video or image special effect processing and synthetic in.
Background technology
In image or Video processing software, a certain class color in image or the video scratched can run into a problem: some background colors can overflow to the edge of key, such as typical shooting environmental in a blue background, because the factors such as light, blueness can splash edge such as the clothes of reference object (host), cheek etc.Existing method scratch picture and with can't eliminate these bluenesss after background is mixed and overflow, just caused false effect.
If it is dark that the brightness ratio background at key edge is also wanted, to mix like this back edge and obvious feeling of unreality can occur, this problem is in the fine solution of also having no idea of traditional chroma key device.
Summary of the invention
For the defective that exists in the prior art, the purpose of this invention is to provide a kind of inhibition foreground color effective, simple, easy optimization and overflow and control the method for mixed brightness.
To achieve these goals, the technical solution used in the present invention is: a kind ofly suppress the method that foreground color overflows and control mixed brightness, may further comprise the steps:
(1) for the yuv space at input picture place, compression V value makes the UV space become a square space, adjusts and overflows the V value in the UV space of each pixel after compression in color, balance color and the input picture, and obtain to overflow the angle angle of color; The described color of overflowing refers to that the main color that will suppress in the image, described balance color refer to the balance look that will mix;
The described preparation method that overflows the angle angle of color is: supposes that the yuv space component value that overflows color is respectively ky, ku, kv, point (ku, kv) is designated as m to the distance of initial point,
Figure GSB00000796514500011
The angle of point (ku, kv) is designated as angle, namely overflows the angle of color, angle=atan2 (kv, ku);
(2) with all pixel color of input picture and balance color in UV Space Rotating-angle angle, adjust U, the V value of all pixels of input picture and balance color;
(3) determine that according to overflowing scope and mixed edge input picture overflows the critical point in zone and adjusts coefficient, adjusts the pixel greater than critical point; The described scope of overflowing refers to the scope that the operating key edge will suppress color, and described mixed edge refers to the scope on operating key border;
The formula that described definite input picture overflows the critical point fRange in zone is fRange=umax * spill range/10+umax * blend edge/100, wherein umax represents the maximum of U in the yuv space, spill range represents the scope of overflowing, and blend edge represents mixed edge;
The formula that described definite input picture overflows the adjustment coefficient frange in zone is frange=umax * spill range;
To the method for adjusting greater than the pixel of critical point be:
When pu '>(fRange) time, pu "=(pu '-m) * (1-m Range/10);
When pu '>(fRange) and (pu '+frange)/umax * hue * 2>1 the time, pv "=0;
When pu '>(fRange) and (pu '+frange)/umax * hue * 2<=1 the time, pv "=pv ' * (1-(pu '+frange)/umax * hue * 2).
Uout=pu″+bu′×(pu′+frange)/umax;
Vout=pv″+bv′×(pv′+frange)/umax;
When pu '>(fRange) and blend luma>0 the time, Yout=py+ (1-py) * blend luma * (pu '+frange)/2/umax+ (1-py) * blend edge * 0.005;
When pu '>(fRange) and blend luma<=0 the time, Yout=py+py * blend luma * (pu '+frange)/2/umax+py * blend edge * 0.005;
Wherein, U, the V value of pixel after pu " and pv " expression is adjusted, Uout, Vout, Yout represent to add the YUV value after the balance color, range represents the scope of overflowing, hue represents to overflow tone, blend luma represents mixed brightness, describedly overflows the skew that tone refers to control main color, and mixed brightness refers to the brightness on operating key border;
(4) with the color of all pixels in the input picture in UV Space Rotating angle angle, adjust U, the V value of all pixels after the rotation;
(5) the V value of all pixels of input picture is adjusted in UV space back-pressure is retracted former space.
Aforesaid a kind of method that foreground color overflows and control mixed brightness that suppresses, compression V value makes the UV space become a square space in the step (1), it is V=V * M/N that the formula that the V value in the UV space of each pixel after compression adopts in color and the input picture is overflowed in adjustment, V value before wherein the V on equal sign the right represents to compress, V value after the V on equal sign the right represents to compress, M is the maximum of U, and N is the maximum of V, and N is greater than M.
The formula that the U of adjustment all pixels of input picture and balance color, V value adopt in the aforesaid a kind of method that foreground color overflows and control mixed brightness that suppresses, step (2) is:
pu′=pu×cos(-angle)-pv×sin(-angle),
pv′=pu×sin(-angle)+pv×cos(-angle);
bu′=bu×cos(-angle)-bv×sin(-angle),
bv′=bu×sin(-angle)+bv×cos(-angle);
Wherein, pu, pv are U, the V value of pixel in the input picture before adjusting, and pu ', pv ' are U, the V value of pixel in the input picture after adjusting; Bu, bv are for adjusting U, the V value of forward horizontal stand color, and bu ', bv ' are for adjusting U, the V value of back balance color.
Aforesaid a kind of method that foreground color overflows and control mixed brightness that suppresses, in the step (4), first with Uout, Vout rotation angle angle, then according to formula pu " '=Uout * cos (angle)-Vout * sin (angle); pv " '=Uout * sin (angle)+Vout * cos (angle), adjust U, the V value of all pixels, wherein pu " ', pv " ' is U, the V value of pixel after adjusting.
Aforesaid a kind of method that foreground color overflows and control mixed brightness that suppresses, the former space of in the step (5) UV space back-pressure being retracted, the formula of V value employing of adjusting all pixels of input picture is V=V * N/M.
The method of the invention, by first the UV space is compressed and pixel color is rotated after again pixel is adjusted, and then return to the mode in former angle and former space, not only better to overflowing the effect that color suppresses and edge brightness is processed, and the method is simple, is very easy to optimize.
Description of drawings
Fig. 1 is method flow diagram described in the embodiment;
Fig. 2 is the geometric meaning schematic diagram of method described in the embodiment.
Embodiment
Describe the present invention below in conjunction with embodiment and accompanying drawing.
Fig. 1 has shown the method flow that present embodiment described inhibition foreground color overflows and control mixed brightness, mainly may further comprise the steps:
(1) at first color is then overflowed in choosing, then set overflow scope, overflow tone, balance color, mixed brightness, mixed edge.
Overflow color (spill color) and refer to the main color that will suppress in the image, overflow scope (spill range) and refer to the scope that the operating key edge will suppress color, overflow tone (spill hue) and refer to control the skew of main color, balance color (balance color) refers to the balance look that will mix, mixed brightness (blend luminance) refers to the brightness on operating key border, and mixed edge (blend edge) refers to the scope on operating key border.
(2) with the pixel value in the input picture by the BGR spatial alternation to yuv space, compression V value makes the UV space become a square space.In the UV space after compression, adjust the V value of overflowing each pixel in color, balance color and the input picture, then obtain to overflow the angle angle of color.
Compression V value can adopt formula V=V * M/N.Wherein, the V value after the V in equal sign left side represents to compress, the V value before the V on equal sign right side represents to compress; M is the maximum of U, M=0.436; N is the maximum of the front V of compression, V=0.615.Adopt the V value of overflowing each pixel in color and the input picture in the UV space after above-mentioned formula calculates compression.
With reference to Fig. 2.Suppose that the yuv space component value that overflows color is respectively ky, ku, kv, point (ku, kv) be designated as m to the distance of initial point, The angle of point (ku, kv) is designated as angle, namely overflows the angle of color, angle=atan2 (kv, ku).
(3) with all pixel color of input picture and balance color in UV Space Rotating-angle angle, adjust U, the V value of all pixels of input picture and balance color.
With reference to Fig. 2.Suppose that each pixel P is respectively py, pu, pv (pv is the value after compressing) at the component value of yuv space in the input picture.The balance color is respectively by, bu, bv (bv is the value after compressing) at the component value of yuv space.For the ease of calculating, need to each pixel color and balance color rotation-angle angle, the definite straight line of initial point and point (ku, kv) be overlapped with the U axle.
Rotation-angle angle refers to rotate in the counterclockwise direction the angle angle take initial point as fixed point.
U, the V value of each pixel P and balance color can adopt following formula to calculate in the rear input picture of rotation:
pu′=pu×cos(-angle)-pv×sin(-angle);
pv′=pu×sin(-angle)+pv×cos(-angle)。
bu′=bu×cos(-angle)-bv×sin(-angle);
bv′=bu×sin(-angle)+bv×cos(-angle)。
Obtain the pixel (pu ', pv ') after the input picture rotation after the calculating, and postrotational balance color (bu ', bv ').
(4) determine that according to overflowing scope and mixed edge input picture overflows the critical point fRange in zone and adjusts coefficient frange, adjusts the pixel greater than critical point.
The geometric meaning of this step can be with reference to Fig. 2, at initial point and point (ku, kv) on the straight line of determining, the vertical line of this straight line is made in the position of determining according to the scope of overflowing and mixed edge, and the intersection point of straight line and vertical line is boundary Control point (being critical point fRange).It is not need the zone adjusted that boundary Control is put the determined vertical line left side, and (being the zone between two parallel vertical lines among Fig. 2) is the zone that needs adjustment to zone, the right to zone that Umax determines.
Determine to overflow regional critical point and can adopt following formula with the adjustment coefficient:
fRange=umax×spill?range/10+umax×blend?edge/100;
frange=umax×spill?range。
Wherein, umax represents that the U maximum is 0.436 in the yuv space component.
After having determined to overflow regional critical point and having adjusted coefficient, the pixel greater than critical point in the input picture is recomputated U, V, Y value according to following formula, and U, V result are added the balance color.Be not more than the pixel of critical point, i.e. pu '<=(fRange), maintenance initial value.
When pu '>(fRange) time, pu "=(pu '-m) * (1-m Range/10);
When pu '>(fRange) and (pu '+frange)/umax * hue * 2>1 the time, pv "=0;
When pu '>(fRange) and (pu '+frange)/umax * hue * 2<=1 the time, pv "=pv ' * (1-(pu '+frange)/umax * hue * 2).
Uout=pu″+bu′×(pu′+frange)/umax;
Vout=pv″+bv′×(pv′+frange)/umax;
When pu '>(fRange) and blend luma>0 the time, Yout=py+ (1-py) * blend luma * (pu '+frange)/2/umax+ (1-py) * blend edge * 0.005;
When pu '>(fRange) and blend luma<=0 the time, Yout=py+py * blend luma * (pu '+frange)/2/umax+py * blend edge * 0.005.
In the above-mentioned formula, U, the V value of each pixel after recomputating in pu " and pv " the expression input picture, Uout, Vout, Yout represent to add the YUV value after the balance color, range represents the scope of overflowing, hue represents to overflow tone, and blend luma represents mixed brightness.
(5) color that will adjust rear pixel is namely rotated the angle angle to counter clockwise direction in UV Space Rotating angle angle, adjusts U, the V value of pixel; And make the UV space revert to original rectangular space the V value back-pressure contracting, adjust the V value of pixel.
First Uout, Vout rotation angle angle is got back under the former coordinate system, adjust U, the V value of pixel according to following formula, pu " '=Uout * cos (angle)-Vout * sin (angle), pv " '=Uout * sin (angle)+Vout * cos (angle).Then with the contracting of V value back-pressure, even V=V * N/M.Pv before the V on equal sign the right represents to compress herein " ', the pv after the V on the equal sign left side represents to compress herein " '.
(6) at last with Yout, pu " ', pv " ' change back to the BGR space, obtain final image.
In order to improve the implementation efficiency of said method, preferably adopt the SIMD of intel to strengthen instruction set SSE2.Because can carrying out the vector of integer or floating-point, calculates SSE2, so can calculate simultaneously the value of a plurality of pixels.In addition because the SSE2 instruction is easy to realize mask calculates so that when the calculating pixel value without any conditional branch statements, thereby also improved speed.
Result of the test shows: be on the processor of 2.5GHz a dominant frequency, the pixel value that calculates a width of cloth 720x576 sized images (BGRA space) only needs 4.5ms.If recycling multinuclear or Hyper-Threading will calculate mean allocation above each is examined or on the hardware thread, then the CPU of one four nuclear processes above-mentioned image only needs about 1.5ms.
The present invention is not limited to above-mentioned embodiment, and other execution modes that those skilled in the art's technical scheme according to the present invention draws belong to technological innovation scope of the present invention equally.

Claims (4)

1. one kind is suppressed the method that foreground color overflows and control mixed brightness, may further comprise the steps:
(1) for the yuv space at input picture place, compression V value makes the UV space become a square space, adjusts and overflows the V value in the UV space of each pixel after compression in color, balance color and the input picture, and obtain to overflow the angle angle of color; The described color of overflowing refers to that the main color that will suppress in the image, described balance color refer to the balance look that will mix;
The described preparation method that overflows the angle angle of color is: supposes that the yuv space component value that overflows color is respectively ky, ku, kv, point (ku, kv) is designated as m to the distance of initial point,
Figure FDA00002667842600011
The angle of point (ku, kv) is designated as angle, namely overflows the angle of color, angle=atan2 (kv, ku);
(2) with all pixel color of input picture and balance color in UV Space Rotating-angle angle, adjust U, the V value of all pixels of input picture and balance color, the formula of employing is:
pu′=pu×cos(-angle)-pv×sin(-angle),
pv′=pu×sin(-angle)+pv×cos(-angle);
bu′=bu×cos(-angle)–bv×sin(-angle),
bv′=bu×sin(-angle)+bv×cos(-angle);
Wherein, pu, pv are U, the V value of pixel in the input picture before adjusting, and pu ', pv ' are U, the V value of pixel in the input picture after adjusting; Bu, bv are for adjusting U, the V value of forward horizontal stand color, and bu ', bv ' are for adjusting U, the V value of back balance color;
(3) determine that according to overflowing scope and mixed edge input picture overflows the critical point in zone and adjusts coefficient, adjusts the pixel greater than critical point; The described scope of overflowing refers to the scope that the operating key edge will suppress color, and described mixed edge refers to the scope on operating key border;
The formula that described definite input picture overflows the critical point fRange in zone is fRange=umax * spill range/10+umax * blend edge/100, wherein umax represents the maximum of U in the yuv space, spill range represents the scope of overflowing, and blend edge represents mixed edge;
The formula that described definite input picture overflows the adjustment coefficient frange in zone is frange=umax * spill range;
To the method for adjusting greater than the pixel of critical point be:
As pu '〉(fRange) time, pu "=(pu '-m) * (1-m Range/10);
As pu '〉(fRange) and (pu '+frange)/umax * hue * 21 the time, pv "=0;
As pu '〉(fRange) and (pu '+frange)/umax * hue * 2<=1 the time, pv "=pv ' * (1-(pu '+frange)/umax * hue * 2);
Uout=pu″+bu′×(pu′+frange)/umax;
Vout=pv″+bv′×(pv′+frange)/umax;
As pu '〉(fRange) and blend luma 0 the time, Yout=py+ (1-py) * blend luma * (pu '+frange)/2/umax+ (1-py) * blend edge * 0.005;
As pu '〉(fRange) and blend luma<=0 the time, Yout=py+py * blend luma * (pu '+frange)/2/umax+py * blend edge * 0.005;
Wherein, U, the V value of pixel after pu " and pv " expression is adjusted, Uout, Vout, Yout represent to add the YUV value after the balance color, range represents the scope of overflowing, hue represents to overflow tone, and blend luma represents mixed brightness, and py represents that pixel is at the Y of yuv space component value, describedly overflow the skew that tone refers to control main color, mixed brightness refers to the brightness on operating key border;
(4) with the color of all pixels in the input picture in UV Space Rotating angle angle, adjust U, the V value of all pixels after the rotation;
(5) the V value of all pixels of input picture is adjusted in UV space back-pressure is retracted former space.
2. a kind of method that foreground color overflows and control mixed brightness that suppresses as claimed in claim 1, it is characterized in that: compression V value makes the UV space become a square space in the step (1), it is V=V * M/N that the formula that the V value in the UV space of each pixel after compression adopts in color and the input picture is overflowed in adjustment, V value before wherein the V on equal sign the right represents to compress, V value after the V on the equal sign left side represents to compress, M is the maximum of U, and N is the maximum of V, and N is greater than M.
3. a kind of method that foreground color overflows and control mixed brightness that suppresses as claimed in claim 1, it is characterized in that: in the step (4), first with Uout, Vout rotation angle angle, then "=Uout * cos (angle)-Vout * sin (angle); the pv ' "=Uout * sin (angle)+Vout * cos (angle) according to formula pu ', adjust U, the V value of all pixels, wherein pu ' ", pv ' " is U, the V value of pixel after adjusting.
4. a kind of method that foreground color overflows and control mixed brightness that suppresses as claimed in claim 2 is characterized in that: the former space of in the step (5) UV space back-pressure being retracted, the formula of V value employing of adjusting all pixels of input picture is V=V * N/M.
CN 200810238991 2008-12-08 2008-12-08 Method for restraining overflow of foreground color and controlling mixed brightness Expired - Fee Related CN101764911B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 200810238991 CN101764911B (en) 2008-12-08 2008-12-08 Method for restraining overflow of foreground color and controlling mixed brightness

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 200810238991 CN101764911B (en) 2008-12-08 2008-12-08 Method for restraining overflow of foreground color and controlling mixed brightness

Publications (2)

Publication Number Publication Date
CN101764911A CN101764911A (en) 2010-06-30
CN101764911B true CN101764911B (en) 2013-05-01

Family

ID=42495886

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 200810238991 Expired - Fee Related CN101764911B (en) 2008-12-08 2008-12-08 Method for restraining overflow of foreground color and controlling mixed brightness

Country Status (1)

Country Link
CN (1) CN101764911B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105139360A (en) * 2015-09-11 2015-12-09 新奥特(北京)视频技术有限公司 Method and apparatus for correcting image colour
CN107087123B (en) * 2017-04-26 2020-04-21 杭州奥点科技股份有限公司 Real-time high-definition image matting method based on cloud processing

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1318258A (en) * 1998-09-17 2001-10-17 通用仪器公司 Modified chroma keyed tech for simple shape coding for digital video
CN1477856A (en) * 2002-08-21 2004-02-25 北京新奥特集团 True three-dimensional virtual studio system and its implement method

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1318258A (en) * 1998-09-17 2001-10-17 通用仪器公司 Modified chroma keyed tech for simple shape coding for digital video
CN1477856A (en) * 2002-08-21 2004-02-25 北京新奥特集团 True three-dimensional virtual studio system and its implement method

Also Published As

Publication number Publication date
CN101764911A (en) 2010-06-30

Similar Documents

Publication Publication Date Title
US9324170B2 (en) Creating a blended image
Shi et al. Reducing illumination based on nonlinear gamma correction
CN107977989B (en) Method and equipment for determining image offset
US8860806B2 (en) Method, device, and system for performing color enhancement on whiteboard color image
Wang et al. Variational single nighttime image haze removal with a gray haze-line prior
CN101764911B (en) Method for restraining overflow of foreground color and controlling mixed brightness
CN111491149B (en) Real-time image matting method, device, equipment and storage medium based on high-definition video
CN104680518A (en) Blue screen image matting method based on chroma overflowing processing
CN100552713C (en) A kind of image processing method
TW201536029A (en) Image downsampling apparatus and method
WO2019090580A1 (en) System and method for image dynamic range adjusting
CN104469226A (en) Projection fusion method and device
CN106993140B (en) The method for generating the target gain value of wide dynamic range operation
CN101764909B (en) Method for determining key values of pixels in image
CN101764912B (en) Method for determining key value based on foreground and background color difference
CN114266803A (en) Image processing method, image processing device, electronic equipment and storage medium
Lee et al. Laplacian of Gaussian Based on Color Constancy Algorithm for Surrounding Image Stitching Application
WO2022105584A1 (en) Method and apparatus for creating panoramic picture on basis of large screen, and intelligent terminal and medium
CN100502459C (en) Picture color controlling method and system
CN108122216A (en) For the system and method for the dynamic range expansion of digital picture
US10165200B2 (en) Processing multiple image frames
RU2383055C2 (en) Method of determining and smoothing jagged edges on images
TW202008311A (en) Image saturation adjusting method and device
TW202042177A (en) Image processing device and method for image processing
US10530996B2 (en) Electronic device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
ASS Succession or assignment of patent right

Owner name: BEIJING CULTURAL AND SCIENTIFIC FINANCING LEASE CO

Free format text: FORMER OWNER: XIN'AOTE(BEIJING) VIDEO TECHNOLOGY CO., LTD.

Effective date: 20150319

C41 Transfer of patent application or patent right or utility model
COR Change of bibliographic data

Free format text: CORRECT: ADDRESS; FROM: 100080 HAIDIAN, BEIJING TO: 100044 SHUNYI, BEIJING

TR01 Transfer of patent right

Effective date of registration: 20150319

Address after: 100044, room 2, building 1, No. 401, Golden Sail Road, Beijing, Shunyi District

Patentee after: Beijing culture science and technology finance leasing Limited by Share Ltd

Address before: 100080 Beijing city Haidian District xicaochang No. 1 Beijing Silicon Valley computer city 15 1501-1506 room

Patentee before: China Digital Video (Beijing) Limited

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

Granted publication date: 20130501

Termination date: 20161208