CN110070507A - A kind of stingy drawing method of video image, device, storage medium and stingy figure equipment - Google Patents

A kind of stingy drawing method of video image, device, storage medium and stingy figure equipment Download PDF

Info

Publication number
CN110070507A
CN110070507A CN201910309802.3A CN201910309802A CN110070507A CN 110070507 A CN110070507 A CN 110070507A CN 201910309802 A CN201910309802 A CN 201910309802A CN 110070507 A CN110070507 A CN 110070507A
Authority
CN
China
Prior art keywords
color
pixel
video image
error value
transformed error
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201910309802.3A
Other languages
Chinese (zh)
Other versions
CN110070507B (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.)
Anhui Kelang Electronic Technology Co.,Ltd.
Original Assignee
Beijing Wen Xiang Information 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 Wen Xiang Information Technology Co Ltd filed Critical Beijing Wen Xiang Information Technology Co Ltd
Priority to CN201910309802.3A priority Critical patent/CN110070507B/en
Publication of CN110070507A publication Critical patent/CN110070507A/en
Application granted granted Critical
Publication of CN110070507B publication Critical patent/CN110070507B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/90Dynamic range modification of images or parts thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Processing (AREA)

Abstract

The present invention discloses stingy drawing method, device, storage medium and the stingy figure equipment of a kind of video image, and wherein method includes the following steps: the color for obtaining target video image;By the color of target video image from the first color space conversion to the second color space, the color transformation result of target video image is obtained;According to color transformation result, the color transformed error value of each pixel of target video image is obtained;Color transformed error value is corrected using error diffusion algorithm;Video image is carried out to the target video image after amendment color transformed error value and scratches figure.The present invention converts existing color transformed error by space using color of the error diffusion algorithm to target video image and handles, target video image collimation error caused by human eye can be effectively reduced, while being also beneficial to the quickly FIG pull handle to target video image.

Description

A kind of stingy drawing method of video image, device, storage medium and stingy figure equipment
Technical field
The present invention relates to technical field of video image processing, and in particular to a kind of stingy drawing method of video image, is deposited device Storage media and stingy figure equipment.
Background technique
The stingy diagram technology of video image refers to before accurately will be interested in still image or continuous video sequence The process that scape object is separated from background.A kind of crucial skill of the stingy diagram technology of video image as visual effect field Art is widely used in the fields such as video image editor and film making.
Rgb pixel is mainly transformed into hexagonal vertebral model by the stingy drawing method of the video image in currently available technology (HSV) in, since the color codomain of different pixels is different, so in the color conversion processes of video image, and it is based on HSV mould The color transfer algorithm of type is relatively fixed, when lightness V is smaller, or, when color saturation S is smaller, corresponding coloration H's Component value fluctuation is larger, therefore, during rgb pixel carries out color conversion, it is easy to generate apparent vision difference, one Error amount accumulation during conversion of denier current pixel point is increasing, and the picture for eventually leading to image generates local microgroove.
Summary of the invention
In view of this, the embodiment of the invention provides a kind of stingy drawing method of video image, it is in the prior art to solve The stingy drawing method of video image, during rgb pixel carries out color conversion, it is easy to generate apparent vision difference, one Error amount accumulation during conversion of denier current pixel point is increasing, and the picture for eventually leading to image generates local microgroove Problem.
According in a first aspect, including the following steps: the embodiment of the invention provides a kind of stingy drawing method of video image
Obtain the color of target video image;
By the color of the target video image from the first color space conversion to the second color space, the target is obtained The color transformation result of video image;
According to the color transformation result, the color transformed error value of each pixel of the target video image is obtained;
The color transformed error value is corrected using error diffusion algorithm;
Video image is carried out to the target video image after the amendment color transformed error value and scratches figure.
With reference to first aspect, in first aspect first embodiment, first color space is RGB color, Second color space is hsv color space.
First embodiment with reference to first aspect, it is described by the target video in first aspect second embodiment The color of image obtains the color conversion of the target video image from the first color space conversion to the second color space As a result it is obtained by the color transfer algorithm that RGB color is converted to hsv color space.
With reference to first aspect, described to correct the face using error diffusion algorithm in first aspect third embodiment The step of color transformed error value further include:
Obtain the first adjacent pixel of the target pixel points of the target video image, the second pixel and third pixel Point, wherein first pixel is located at the first direction of the target pixel points, and second pixel is located at the target The second direction of pixel, the third pixel are located at the third direction of the target pixel points;
Obtain the color transformed error value of the target pixel points;
Setting for being diffused into the first pixel, second pixel and described for the color transformed error value respectively Preset ratio rule on third pixel;
The color transformed error value is diffused into first pixel, described second according to the preset ratio rule The color transformed error value is corrected on pixel and the third pixel.
It is described according to described default in the 4th embodiment of first aspect with reference to first aspect in third embodiment The color transformed error value is diffused into first pixel, second pixel and the third pixel by ratio rules The step of correcting the color transformed error value on point further include:
According to the color transformation result, obtain respectively the target pixel points the first color transformed error value, second Color transformed error value and third color transformed error value;
According to the color transformation result, obtain respectively the target pixel points the first pixel chromaticity conversion value, second Pixel chromaticity conversion value and third pixel chromaticity conversion value;
According to the preset ratio rule and the first pixel chromaticity conversion value, the second pixel chromaticity conversion value and The third pixel chromaticity conversion value corrects the first color transformed error value, the second color transformed error value and institute State third color transformed error value.
With reference to first aspect in the 4th embodiment, in the 5th embodiment of first aspect, according to the preset ratio The regular and described first pixel chromaticity conversion value, the second pixel chromaticity conversion value and the third pixel chromaticity conversion value, Correct the step of the first color transformed error value, the second color transformed error value and the third color transformed error value Suddenly it is corrected by following formula:
HR1=HR+D1*x/(x+y+z);
HG1=HG+D2*y/(x+y+z);
HB1=HB+D3*z/(x+y+z);
Wherein, HR1Conversion value, H are corrected for the first pixel chromaticityG1Conversion value, H are corrected for the second pixel chromaticityB1For third Pixel chromaticity corrects conversion value, HRFor the first pixel chromaticity conversion value, HGFor the second pixel chromaticity conversion value, HBFor The third pixel chromaticity conversion value, D1For the first color transformed error value, D2For the second color transformed error value, D3For the third color transformed error value, x is first be assigned on first pixel in the preset ratio rule Proportionality coefficient, y are the second proportionality coefficient that second pixel is assigned in the preset ratio rule, and z is described default The third proportionality coefficient of the third pixel is assigned in rule.
With reference to first aspect in the 5th embodiment, in first aspect sixth embodiment, the setting is for by institute State the default ratio that color transformed error value is diffused into respectively on the first pixel, second pixel and the third pixel Convention then the step of further include:
First proportionality coefficient, second proportionality coefficient and the third proportionality coefficient are distributed according to iterative algorithm, Until the first pixel chromaticity conversion value, the second pixel chromaticity conversion value and the third pixel chromaticity conversion value reach Dbjective state iteration terminates.
According to second aspect, the embodiment of the invention provides a kind of stingy map devices of video image, comprising:
Color obtains module, for obtaining the color of target video image;
Color conversion module, for by the color of the target video image from the first color space conversion to the second color Space obtains the color transformation result of the target video image;
Error amount obtains module, for obtaining each pixel of the target video image according to the color transformation result The color transformed error value of point;
Error correction module, for correcting the color transformed error value using error diffusion algorithm;
Module is scratched, for carrying out video image to the target video image after the amendment color transformed error value Scratch figure.
According to the third aspect, the stingy figure equipment based on GPU that the embodiment of the invention provides a kind of, including at memory, GPU The computer program managing device and storage on a memory and can running on the GPU processor, the GPU processor execute institute The step of the stingy drawing method of frequency image described in any one embodiment of row first aspect or first aspect when stating program Suddenly.
According to fourth aspect, the embodiment of the invention provides a kind of storage mediums, are stored thereon with computer instruction, this refers to When enabling described program when being executed by GPU processor described in any one embodiment of row first aspect or first aspect The step of stingy drawing method of frequency image.
Technical solution of the embodiment of the present invention, has the advantages that
The present invention provides stingy drawing method, device, storage medium and the stingy figure equipment of a kind of video image, and wherein method includes Following steps: the color of target video image is obtained;By the color of target video image from the first color space conversion to second Color space obtains the color transformation result of target video image;According to color transformation result, each of target video image is obtained The color transformed error value of pixel;Color transformed error value is corrected using error diffusion algorithm;To amendment color transformed error Target video image after value carries out video image and scratches figure.The present invention is using error diffusion algorithm to the color of target video image It is handled by the existing color transformed error of space conversion, target video image can be effectively reduced caused by human eye The collimation error, while being also beneficial to the quickly FIG pull handle to target video image.
Detailed description of the invention
It, below will be to specific in order to illustrate more clearly of the specific embodiment of the invention or technical solution in the prior art Embodiment or attached drawing needed to be used in the description of the prior art be briefly described, it should be apparent that, it is described below Attached drawing is some embodiments of the present invention, for those of ordinary skill in the art, before not making the creative labor It puts, is also possible to obtain other drawings based on these drawings.
Fig. 1 is the first pass figure of the stingy drawing method of video image in the embodiment of the present invention;
Fig. 2 is the second flow chart of the stingy drawing method of video image in the embodiment of the present invention;
Fig. 3 is the schematic diagram of the target pixel points progress error diffusion in the embodiment of the present invention;
Fig. 4 is the 4th flow chart of the stingy drawing method of video image in the embodiment of the present invention;
Fig. 5 is the first structure block diagram of the stingy map device of video image in the embodiment of the present invention;
Fig. 6 is the second structural block diagram of the stingy map device of video image in the embodiment of the present invention;
Fig. 7 is the hardware structural diagram of the stingy figure equipment in the embodiment of the present invention based on GPU.
Specific embodiment
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention In attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is A part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, those skilled in the art are not having Every other embodiment obtained under the premise of creative work is made, shall fall within the protection scope of the present invention.
Embodiment 1
The embodiment of the present invention provides a kind of stingy drawing method of video image, the stingy drawing method of the video image in the present embodiment It is to be run in GPU processor, processing speed can be significantly improved using GPU processor processing video image, as shown in Figure 1, Include the following steps:
Step S1: the color of target video image is obtained.Target video image herein is the video image of figure to be scratched, Color is extracted in the target video image, is convenient for color conversion.
Step S2: by the color of target video image from the first color space conversion to the second color space, target is obtained The color transformation result of video image.The first color space herein is RGB color, and the second color space is hsv color Target video image is converted from RGB color to hsv color space and is applied in video image processing also more extensively by space It is general.
Specifically, the color of target video image is obtained into target from the first color space conversion to the second color space The color transformation result of video image is obtained by the color transfer algorithm that RGB color is converted to hsv color space.
Color transfer algorithm among the above are as follows:
Max=max (R, G, B);
Min=min (R, G, B);
If R=max, H=(G-B)/(max-min);
If G=max, H=2+ (B-R)/(max-min);
If B=max, H=4+ (R-G)/(max-min);
H=H*60 if H < 0, H=H+360;
V=max (R, G, B);
S=(max-min)/max;
Wherein, R is red pixel, and G is green pixel, and B is blue pixel;H is chroma conversion value, and certain H also represents ash Information is spent, usual H is angle value, represent the present position of certain pixel chroma conversion value of target video image, red pixel, The chroma conversion value of green pixel and blue pixel respectively differs 120 degree respectively in HSV space, and V is target video image Lightness in the color transformed space of HSV, for usual V between the range of 0-1, S is that color of the target video image in HSV turns The color saturation or excitation purity in space are changed, usual S is between the range of 0-1.
Step S3: according to color transformation result, the color transformed error value of each pixel of target video image is obtained.This The color transformed error value at place is that each pixel of target video image distinguishes corresponding face during carrying out color conversion Color transformed error value.Turned according to the above-mentioned color obtained to hsv color space of converting target video image from RGB color It changes as a result, the color transformed error value of target video image is therefrom obtained, if the color transformed error value is D, color conversion Error amount includes the first color transformed error value, the second color transformed error value and third color transformed error value, wherein first Color transformed error value is red pixel transformed error value, and the second color transformed error value is green pixel transformed error value, third face Color transformed error value is blue pixel transformed error value, by the first color transformed error value D1It indicates, the second color is converted and is missed Difference D2It indicates, by third color transformed error value D3It indicates.
Step S4: color transformed error value is corrected using error diffusion algorithm.Turned using error diffusion algorithm amendment color Changing error amount is exactly to shift color transformed error to surrounding space.
In one embodiment, above-mentioned steps S4 is during execution, as shown in Fig. 2, may particularly include following step It is rapid:
Step S41: the first adjacent pixel of the target pixel points of target video image, the second pixel and third are obtained Pixel, wherein the first pixel is located at the first direction of target pixel points, and the second pixel is located at the second of target pixel points Direction, third pixel are located at the third direction of target pixel points.As shown in figure 3, target pixel points are O, with target pixel points Adjacent pixel be the first pixel be L, the second pixel M and third pixel N, in fig. 3 it can be seen that the first pixel Point L, the second pixel M and third pixel N are located at the different directions of target pixel points O, and the first pixel L is located at mesh The first direction of pixel O is marked, the second pixel M is located at the second direction of target pixel points O, and third pixel N is located at target The third direction of pixel O, exactly, the first pixel on first direction are the pixel on the right of target pixel points, the The second pixel on two directions is the following pixel of target pixel points, and the third pixel on third direction is object pixel The pixel on point bottom right side is conducive to target pixel points usually according to the corresponding pixel of these three above-mentioned different directions Color transformed error diffusion.
Step S42: the color transformed error value of target pixel points is obtained.The color transformed error of target pixel points herein Value includes the first color transformed error value of target pixel points, if the color transformed error value is D, the color transformed error value packet The first color transformed error value, the second color transformed error value and third color transformed error value are included, wherein the first color is converted Error amount is red pixel transformed error value, and the second color transformed error value is green pixel transformed error value, and the conversion of third color misses Difference is blue pixel transformed error value, by the first color transformed error value D1It indicates, by the second color transformed error value D2Table Show, by third color transformed error value D3It indicates.
Step S43: it is arranged for color transformed error value to be diffused into the first pixel, the second pixel and third respectively Preset ratio rule on pixel.
In a preferred embodiment, above-mentioned steps S43 may particularly include during execution:
The first proportionality coefficient of the first pixel, the second proportionality coefficient of the second pixel and the are distributed according to iterative algorithm The third proportionality coefficient of three pixels, until the first pixel chromaticity conversion value, the second pixel chromaticity conversion value and third pixel color Degree conversion value, which reaches dbjective state iteration, to be terminated.Such as: the first proportionality coefficient is x, and the second proportionality coefficient is y, third ratio system Number is z reaches dbjective state, so-called dbjective state is exactly the first picture until x:y:z is iteratively assigned to properly Plain color degree conversion value reaches the first pixel chromaticity amendment conversion value by amendment, the second pixel chromaticity conversion value reaches by amendment Second pixel chromaticity amendment conversion value and third pixel chromaticity conversion value, which reach the amendment of third pixel chromaticity by amendment, to be converted Value, therefore, without apparent vision difference for human eye.First pixel chromaticity conversion value is red pixel chromaticity conversion value, Use HRIt indicates, the second pixel chromaticity conversion value is green pixel chroma conversion value, uses HGIt indicates, third pixel chromaticity conversion value is indigo plant Pixel chromaticity conversion value, uses HBIt indicates, the first pixel chromaticity corrects conversion value HR1It indicates, the second pixel chromaticity corrects conversion value Use HG1It indicates, third pixel chromaticity corrects conversion value HB1It indicates.Such as: for HR1=HR+D1*x/(x+y+z);Specifically, Iterative algorithm be continuously attempt to distribution setting the first proportionality coefficient of the first pixel, the second pixel the second proportionality coefficient and The third proportionality coefficient of third pixel is until HR1Correction effect it is best.
Step S44: according to preset ratio rule by color transformed error value be diffused into the first pixel, the second pixel and Color transformed error value is corrected on third pixel.
In one embodiment, above-mentioned steps S44 is during execution, as shown in figure 4, may particularly include following step It is rapid:
Step S441: according to color transformation result, obtain respectively target pixel points the first color transformed error value, second Color transformed error value and third color transformed error value.Color transformed error value includes the first color conversion of target pixel points Error amount, if the color transformed error value is D, which includes the first color transformed error value, the second color Transformed error value and third color transformed error value, wherein the first color transformed error value be red pixel transformed error value, second Color transformed error value is green pixel transformed error value, and third color transformed error value is blue pixel transformed error value, by first Color transformed error value D1It indicates, by the second color transformed error value D2It indicates, by third color transformed error value D3Table Show.
Step S442: according to color transformation result, obtain respectively target pixel points the first pixel chromaticity conversion value, second Pixel chromaticity conversion value and third pixel chromaticity conversion value.First pixel chromaticity conversion value is red pixel chromaticity conversion value, uses HR It indicates, the second pixel chromaticity conversion value is green pixel chroma conversion value, uses HGIt indicates, third pixel chromaticity conversion value is blue pixel Chroma conversion value, uses HBIt indicates.
Step S443: according to preset ratio rule and the first pixel chromaticity conversion value, the second pixel chromaticity conversion value and Three pixel chromaticity conversion values, the first color transformed error value of amendment, the second color transformed error value and third color transformed error Value.
In one embodiment, above-mentioned steps S443 can be corrected during execution especially by following formula:
HR1=HR+D1*x/(x+y+z);
HG1=HG+D2*y/(x+y+z);
HB1=HB+D3*z/(x+y+z);
Wherein, HR1Conversion value, H are corrected for the first pixel chromaticityG1Conversion value, H are corrected for the second pixel chromaticityB1For third Pixel chromaticity corrects conversion value, HRFor the first pixel chromaticity conversion value, HGFor the second pixel chromaticity conversion value, HBFor third pixel Chroma conversion value, D1For the first color transformed error value, D2For the second color transformed error value, D3For third color transformed error Value, x are the first proportionality coefficient being assigned on the first pixel in preset ratio rule, and y is to be assigned in preset ratio rule Second proportionality coefficient of the second pixel, z are the third proportionality coefficient that third pixel is assigned in preset rules.
In one more specifically embodiment, above-mentioned steps S443 during execution, RGB color convert to On the basis of the color transfer algorithm in hsv color space, error diffusion algorithm is turned in increase with the color for correcting target pixel points Change error.Specific formula is as follows:
Max=max (R, G, B);
Min=min (R, G, B);
If R=max, HR=(G-B)/(max-min);
If G=max, HG=2+ (B-R)/(max-min);
If B=max, HB=4+ (R-G)/(max-min);
H(R、G、B)=* 60 if < 0, H(R、G、B)=H(R、G、B)+360;V=max (R, G, B);
S=(max-min)/max;
HR1=HR+D1*x/(x+y+z);(R=max)
HG1=HG+D2*y/(x+y+z);(G=max)
HB1=HB+D3*z/(x+y+z);(B=max)
Wherein R is red pixel, and G is green pixel, and B is blue pixel;H is chroma conversion value, and certain H also represents gray scale Information, usual H are angle values, represent the present position of certain pixel chroma conversion value of target video image, V is target video Lightness of the image in the color transformed space of HSV, for usual V between the range of 0-1, S is face of the target video image in HSV Color saturation or excitation purity in color transformed space, usual S is between the range of 0-1, HR1It corrects and converts for the first pixel chromaticity Value, HG1Conversion value, H are corrected for the second pixel chromaticityB1Conversion value, H are corrected for third pixel chromaticityRFor the conversion of the first pixel chromaticity Value, HGFor the second pixel chromaticity conversion value,
HBFor third pixel chromaticity conversion value, D1For the first color transformed error value, D2For the second color transformed error value, D3For third color transformed error value, x is the first proportionality coefficient being assigned on the first pixel in preset ratio rule, and y is The second proportionality coefficient of the second pixel is assigned in preset ratio rule, z is to be assigned to third pixel in preset rules Third proportionality coefficient.
It is improved on the basis of color transformed error algorithm, that is, increases upper error diffusion algorithm modifying factor in RGB color Space is converted to color transformed error existing for hsv color space, that is, reduces the existing loss of color transformed error, Ke Yixian Write the visual effect for improving target video image.
Step S5: video image is carried out to the target video image after amendment color transformed error value and scratches figure.
The process for executing above-mentioned steps S1- step S4, carries out color transformed error processing to entire target video image, Color transformed error processing is carried out to all pixels point of target video image, specifically, by GPU processor, in conjunction with Error diffusion algorithm is scanned all pixels of target video image line by line, completes the institute of all target video images There is the color transformed error of pixel to handle, avoid people to the collimation error of target video image, and then can be quickly complete At the stingy figure of target video image.
The stingy drawing method of video image in the embodiment of the present invention, using error diffusion algorithm to the face of target video image Color is handled by the existing color transformed error of space conversion, and target video image can be effectively reduced and cause to human eye The collimation error, while being also beneficial to the quickly FIG pull handle to target video image.
Embodiment 2
The embodiment of the present invention provides a kind of stingy map device of video image, as shown in Figure 5, comprising:
Color obtains module 51, for obtaining the color of target video image.
Color conversion module 52, for the color of target video image is empty from the first color space conversion to the second color Between, obtain the color transformation result of target video image.
Error amount obtains module 53, for obtaining the face of each pixel of target video image according to color transformation result Color transformed error value.
Error correction module 54, for correcting color transformed error value using error diffusion algorithm.
Module 55 is scratched, scratches figure for carrying out video image to the target video image after amendment color transformed error value.
The stingy map device of video image in the embodiment of the present invention, the first color space in color conversion module 52 are RGB color, the second color space are hsv color space.
The stingy map device of video image in the embodiment of the present invention, by the face of target video image in color conversion module 52 For color from the first color space conversion to the second color space, the color transformation result for obtaining target video image passes through RGB color The color transfer algorithm that space is converted to hsv color space obtains.
The stingy map device of video image in the embodiment of the present invention, in Fig. 5, error correction module 54 further include:
First acquisition submodule 541, the first adjacent pixel of target pixel points for obtaining target video image, Two pixels and third pixel, wherein the first pixel is located at the first direction of target pixel points, and the second pixel is located at mesh The second direction of pixel is marked, third pixel is located at the third direction of target pixel points;
Second acquisition submodule 542, for obtaining the color transformed error value of target pixel points;
Submodule 543 is set, for being arranged for color transformed error value to be diffused into the first pixel, the second picture respectively Preset ratio rule on vegetarian refreshments and third pixel;
Submodule 544 is corrected, for color transformed error value to be diffused into the first pixel, the according to preset ratio rule Color transformed error value is corrected on two pixels and third pixel.
The stingy map device of video image in the embodiment of the present invention corrects submodule 544, as shown in Figure 6, further includes:
First acquisition unit 5441, the first color for according to color transformation result, obtaining target pixel points respectively turn Change error amount, the second color transformed error value and third color transformed error value;
Second acquisition unit 5442, for obtaining the first pixel color of target pixel points respectively according to color transformation result Spend conversion value, the second pixel chromaticity conversion value and third pixel chromaticity conversion value;
Amending unit 5443, for being turned according to preset ratio rule and the first pixel chromaticity conversion value, the second pixel chromaticity Change value and third pixel chromaticity conversion value, the first color transformed error value of amendment, the second color transformed error value and third color Transformed error value.
The stingy map device of video image in the embodiment of the present invention, amending unit 5443 are corrected by following formula:
HR1=HR+D1*x/(x+y+z);
HG1=HG+D2*y/(x+y+z);
HB1=HB+D3*z/(x+y+z);
Wherein, HR1Conversion value, H are corrected for the first pixel chromaticityG1Conversion value, H are corrected for the second pixel chromaticityB1For third Pixel chromaticity corrects conversion value, HRFor the first pixel chromaticity conversion value, HGFor the second pixel chromaticity conversion value, HBFor third pixel Chroma conversion value, D1For the first color transformed error value, D2For the second color transformed error value, D3For third color transformed error Value, x are the first proportionality coefficient being assigned on the first pixel in preset ratio rule, and y is to be assigned in preset ratio rule Second proportionality coefficient of the second pixel, z are the third proportionality coefficient that third pixel is assigned in preset rules.
Submodule 543 is arranged in the stingy map device of video image in the embodiment of the present invention, further includes:
Iteration unit, for distributing the first proportionality coefficient, the second proportionality coefficient and third proportionality coefficient according to iterative algorithm, Until the first pixel chromaticity conversion value, the second pixel chromaticity conversion value and third pixel chromaticity conversion value reach dbjective state iteration Terminate.
The stingy map device of video image in the embodiment of the present invention, using error diffusion algorithm to the face of target video image Color is handled by the existing color transformed error of space conversion, and target video image can be effectively reduced and cause to human eye The collimation error, while being also beneficial to the quickly FIG pull handle to target video image.
Embodiment 3
The embodiment of the present invention provides a kind of stingy figure equipment based on GPU, is somebody's turn to do the stingy figure equipment based on GPU, as shown in fig. 7, Including memory 720, GPU processor 710 and it is stored in the computer that can be run on memory 720 and on GPU processor 710 It the step of program, GPU processor 710 realizes method in embodiment 1 when executing program, can be quickly to reality using GPU processor It applies error diffusion algorithm in example 1 and carries out comprehensive operation, concurrent operation can be carried out using GPU processor, multithreading carries out, each Thread can handle a pixel, and target video image has how many a pixels, GPU processor can with distribution how much A thread, therefore, GPU processor can significantly improve the processing speed of target video image.
Fig. 7 is that a kind of stingy figure based on GPU of the processing method of execution list items operation provided in an embodiment of the present invention is set Standby hardware structural diagram includes one or more processors 710 and deposits as shown in fig. 7, being somebody's turn to do the stingy figure equipment based on GPU Reservoir 720, in Fig. 7 by taking a processor 710 as an example.
It can also include: input unit 730 and defeated for executing the stingy figure equipment based on GPU of the processing method of list items operation Device 740 out.
Processor 710, memory 720, input unit 730 and output device 740 can pass through bus or other modes It connects, in Fig. 7 for being connected by bus.
Processor 710 can be central processing unit (Central Processing Unit, CPU).Processor 710 may be used also Think other general processors, digital signal processor (Digital Signal Processor, DSP), specific integrated circuit (Application Specific Integrated Circuit, ASIC), field programmable gate array (Field- Programmable Gate Array, FPGA) either other programmable logic device, discrete gate or transistor logic, The combination of the chips such as discrete hardware components or above-mentioned all kinds of chips.
Embodiment 4
The embodiment of the present invention provides a kind of storage medium, is stored thereon with computer instruction, which is held by GPU processor The step of method in embodiment 1 is realized when row.Color, the color conversion of target video image are also stored on the storage medium As a result, color transformed error value etc..Wherein, storage medium can be magnetic disk, CD, read-only memory (Read-Only Memory, ROM), random access memory (RandomAccessMemory, RAM), flash memory (Flash Memory), Hard disk (Hard Disk Drive, abbreviation: HDD) or solid state hard disk (Solid-State Drive, SSD) etc.;The storage is situated between Matter can also include the combination of the memory of mentioned kind.
It is that can lead to it will be understood by those skilled in the art that realizing all or part of the process in above-described embodiment method Computer program is crossed to instruct relevant hardware and complete, program can be stored in a computer-readable storage medium, the journey Sequence is when being executed, it may include such as the process of the embodiment of above-mentioned each method.Wherein, storage medium can for magnetic disk, CD, read-only deposit Store up memory body (ROM) or random access memory (RAM) etc..
Obviously, the above embodiments are merely examples for clarifying the description, and does not limit the embodiments.It is right For those of ordinary skill in the art, can also make on the basis of the above description it is other it is various forms of variation or It changes.There is no necessity and possibility to exhaust all the enbodiments.And it is extended from this it is obvious variation or It changes still within the protection scope of the invention.

Claims (10)

1. a kind of stingy drawing method of video image, which comprises the steps of:
Obtain the color of target video image;
By the color of the target video image from the first color space conversion to the second color space, the target video is obtained The color transformation result of image;
According to the color transformation result, the color transformed error value of each pixel of the target video image is obtained;
The color transformed error value is corrected using error diffusion algorithm;
Video image is carried out to the target video image after the amendment color transformed error value and scratches figure.
2. the stingy drawing method of video image according to claim 1, which is characterized in that first color space is RGB Color space, second color space are hsv color space.
3. the stingy drawing method of video image according to claim 2, which is characterized in that described by the target video image Color from the first color space conversion to the second color space, obtain the color transformation result of the target video image It is obtained by the color transfer algorithm that RGB color is converted to hsv color space.
4. the stingy drawing method of video image according to claim 1, which is characterized in that described to be repaired using error diffusion algorithm Just the color transformed error value the step of further include:
The first adjacent pixel of the target pixel points of the target video image, the second pixel and third pixel are obtained, Wherein, first pixel is located at the first direction of the target pixel points, and second pixel is located at the target picture The second direction of vegetarian refreshments, the third pixel are located at the third direction of the target pixel points;
Obtain the color transformed error value of the target pixel points;
It is arranged for the color transformed error value to be diffused into the first pixel, second pixel and the third respectively Preset ratio rule on pixel;
The color transformed error value is diffused into first pixel, second pixel according to the preset ratio rule The color transformed error value is corrected on point and the third pixel.
5. the stingy drawing method of video image according to claim 4, which is characterized in that described to be advised according to the preset ratio Then the color transformed error value is diffused on first pixel, second pixel and the third pixel and is repaired Just the color transformed error value the step of further include:
According to the color transformation result, the first color transformed error value, the second color of the target pixel points are obtained respectively Transformed error value and third color transformed error value;
According to the color transformation result, the first pixel chromaticity conversion value, the second pixel of the target pixel points are obtained respectively Chroma conversion value and third pixel chromaticity conversion value;
According to the preset ratio rule and the first pixel chromaticity conversion value, the second pixel chromaticity conversion value and described Third pixel chromaticity conversion value corrects the first color transformed error value, the second color transformed error value and described the Three color transformed error values.
6. the stingy drawing method of video image according to claim 5, which is characterized in that according to the preset ratio rule and The first pixel chromaticity conversion value, the second pixel chromaticity conversion value and the third pixel chromaticity conversion value correct institute The step of stating the first color transformed error value, the second color transformed error value and the third color transformed error value passes through Following formula amendment:
HR1=HR+D1*x/(x+y+z);
HG1=HG+D2*y/(x+y+z);
HB1=HB+D3*z/(x+y+z);
Wherein, HR1Conversion value, H are corrected for the first pixel chromaticityG1Conversion value, H are corrected for the second pixel chromaticityB1For third pixel Color correction conversion value, HRFor the first pixel chromaticity conversion value, HGFor the second pixel chromaticity conversion value, HBIt is described Third pixel chromaticity conversion value, D1For the first color transformed error value, D2For the second color transformed error value, D3For The third color transformed error value, x are the first ratio being assigned on first pixel in the preset ratio rule Coefficient, y are the second proportionality coefficient that second pixel is assigned in the preset ratio rule, and z is the preset rules In be assigned to the third proportionality coefficient of the third pixel.
7. the stingy drawing method of video image according to claim 6, which is characterized in that the setting is for by the color Transformed error value is diffused into the rule of the preset ratio on the first pixel, second pixel and the third pixel respectively The step of further include:
First proportionality coefficient, second proportionality coefficient and the third proportionality coefficient are distributed according to iterative algorithm, until The first pixel chromaticity conversion value, the second pixel chromaticity conversion value and the third pixel chromaticity conversion value reach target State iteration terminates.
8. a kind of stingy map device of video image characterized by comprising
Color obtains module, for obtaining the color of target video image;
Color conversion module, for the color of the target video image is empty from the first color space conversion to the second color Between, obtain the color transformation result of the target video image;
Error amount obtains module, for obtaining each pixel of the target video image according to the color transformation result Color transformed error value;
Error correction module, for correcting the color transformed error value using error diffusion algorithm;
Module is scratched, is scratched for carrying out video image to the target video image after the amendment color transformed error value Figure.
9. a kind of stingy figure equipment based on GPU, including memory, GPU processor and storage are on a memory and can be in the GPU The computer program run on processor, which is characterized in that the GPU processor realizes claim 1- when executing described program The step of stingy drawing method of 7 described in any item frequency images.
10. a kind of storage medium, is stored thereon with computer instruction, which is characterized in that real when the instruction is executed by GPU processor The step of stingy drawing method of the existing described in any item video images of claim 1-7.
CN201910309802.3A 2019-04-17 2019-04-17 Matting method and device for video image, storage medium and matting equipment Active CN110070507B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910309802.3A CN110070507B (en) 2019-04-17 2019-04-17 Matting method and device for video image, storage medium and matting equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910309802.3A CN110070507B (en) 2019-04-17 2019-04-17 Matting method and device for video image, storage medium and matting equipment

Publications (2)

Publication Number Publication Date
CN110070507A true CN110070507A (en) 2019-07-30
CN110070507B CN110070507B (en) 2021-03-02

Family

ID=67367935

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910309802.3A Active CN110070507B (en) 2019-04-17 2019-04-17 Matting method and device for video image, storage medium and matting equipment

Country Status (1)

Country Link
CN (1) CN110070507B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110298894A (en) * 2019-06-28 2019-10-01 京东数字科技控股有限公司 Image processing method, device, system and medium
CN112203024A (en) * 2020-03-09 2021-01-08 北京文香信息技术有限公司 Matting method, device, equipment and storage medium
CN112330692A (en) * 2020-11-11 2021-02-05 北京文香信息技术有限公司 Matting method, device, equipment and storage medium
CN112991366A (en) * 2021-02-18 2021-06-18 广州光锥元信息科技有限公司 Method and device for carrying out real-time chroma matting on image and mobile terminal
CN113436097A (en) * 2021-06-24 2021-09-24 湖南快乐阳光互动娱乐传媒有限公司 Video matting method, device, storage medium and equipment

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103347140A (en) * 2009-04-17 2013-10-09 佳能株式会社 Image processing apparatus and image processing method
CN103702841A (en) * 2011-05-24 2014-04-02 雷恩哈德库兹基金两合公司 Film and method for producing same
CN104200470A (en) * 2014-08-29 2014-12-10 电子科技大学 Blue screen image-matting method
CN105893649A (en) * 2015-03-23 2016-08-24 温州大学 Optimal model based interactive image recolorating method
CN106204567A (en) * 2016-07-05 2016-12-07 华南理工大学 A kind of natural background video matting method
CN106847185A (en) * 2015-11-11 2017-06-13 株式会社日本有机雷特显示器 Display device, the bearing calibration of display device, manufacture method and display methods
CN107481261A (en) * 2017-07-31 2017-12-15 中国科学院长春光学精密机械与物理研究所 A kind of color video based on the tracking of depth prospect scratches drawing method
CN107516299A (en) * 2017-08-10 2017-12-26 浙江理工大学 Symmetrical multi thresholds error diffusion method and its application for the conversion of fabric color range
CN108460770A (en) * 2016-12-13 2018-08-28 华为技术有限公司 Scratch drawing method and device
CN108965647A (en) * 2017-05-18 2018-12-07 北京金山云网络技术有限公司 A kind of foreground image preparation method and device
CN109191520A (en) * 2018-09-30 2019-01-11 湖北工程学院 A kind of Measurement Approach of Leaf Area and system based on color calibration
CN109543596A (en) * 2018-11-20 2019-03-29 浙江大华技术股份有限公司 A kind of water level monitoring method, apparatus, electronic equipment and storage medium

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103347140A (en) * 2009-04-17 2013-10-09 佳能株式会社 Image processing apparatus and image processing method
CN103702841A (en) * 2011-05-24 2014-04-02 雷恩哈德库兹基金两合公司 Film and method for producing same
US20140177057A1 (en) * 2011-05-24 2014-06-26 Leonhard Kurz Stiftung & Co. Kg Film and Method for Producing Same
CN104200470A (en) * 2014-08-29 2014-12-10 电子科技大学 Blue screen image-matting method
CN105893649A (en) * 2015-03-23 2016-08-24 温州大学 Optimal model based interactive image recolorating method
CN106847185A (en) * 2015-11-11 2017-06-13 株式会社日本有机雷特显示器 Display device, the bearing calibration of display device, manufacture method and display methods
CN106204567A (en) * 2016-07-05 2016-12-07 华南理工大学 A kind of natural background video matting method
CN108460770A (en) * 2016-12-13 2018-08-28 华为技术有限公司 Scratch drawing method and device
CN108965647A (en) * 2017-05-18 2018-12-07 北京金山云网络技术有限公司 A kind of foreground image preparation method and device
CN107481261A (en) * 2017-07-31 2017-12-15 中国科学院长春光学精密机械与物理研究所 A kind of color video based on the tracking of depth prospect scratches drawing method
CN107516299A (en) * 2017-08-10 2017-12-26 浙江理工大学 Symmetrical multi thresholds error diffusion method and its application for the conversion of fabric color range
CN109191520A (en) * 2018-09-30 2019-01-11 湖北工程学院 A kind of Measurement Approach of Leaf Area and system based on color calibration
CN109543596A (en) * 2018-11-20 2019-03-29 浙江大华技术股份有限公司 A kind of water level monitoring method, apparatus, electronic equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
江丽: "基于 Matlab 空间域算法的图像增强技术的研究与应用", 《电子设计工程》 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110298894A (en) * 2019-06-28 2019-10-01 京东数字科技控股有限公司 Image processing method, device, system and medium
CN112203024A (en) * 2020-03-09 2021-01-08 北京文香信息技术有限公司 Matting method, device, equipment and storage medium
CN112203024B (en) * 2020-03-09 2023-07-21 安徽文香科技股份有限公司 Matting method, device, equipment and storage medium
CN112330692A (en) * 2020-11-11 2021-02-05 北京文香信息技术有限公司 Matting method, device, equipment and storage medium
CN112991366A (en) * 2021-02-18 2021-06-18 广州光锥元信息科技有限公司 Method and device for carrying out real-time chroma matting on image and mobile terminal
CN112991366B (en) * 2021-02-18 2024-05-03 广州光锥元信息科技有限公司 Method, device and mobile terminal for carrying out real-time chromaticity matting on image
CN113436097A (en) * 2021-06-24 2021-09-24 湖南快乐阳光互动娱乐传媒有限公司 Video matting method, device, storage medium and equipment

Also Published As

Publication number Publication date
CN110070507B (en) 2021-03-02

Similar Documents

Publication Publication Date Title
CN110070507A (en) A kind of stingy drawing method of video image, device, storage medium and stingy figure equipment
CN105069756B (en) Image enchancing method
CN101534384B (en) Image processing method, image processing device, and image capturing device
WO2016197450A1 (en) Liquid crystal panel and driving method therefor
US10504419B2 (en) Data converting method and apparatus, and computer-readable storage medium
CN109255760A (en) Distorted image correction method and device
CN101742340B (en) Method and device for optimizing and editing image
CN101123679A (en) Image processing apparatus, image processing method, and computer product
CN108335678B (en) The driving method and device of display panel
CN104486608B (en) Image processing method and device
JP2018526755A (en) Image contrast enhancement method
CN108337496A (en) White balancing treatment method, processing unit, processing equipment and storage medium
US20140111672A1 (en) Image processing device and image capture device
US7657115B2 (en) Image edge enhancement apparatus and method thereof
CN113160091A (en) Color temperature adjusting method and device of display equipment, storage medium and electronic equipment
KR20130095206A (en) Signal processing device and semiconductor device
CN107864365B (en) Method for eliminating purple border of image
CN105894473B (en) A kind of image correction method and device based on FPGA
US10178359B2 (en) Macropixel processing system, method and article
CN113409196B (en) High-speed global chromatic aberration correction method for real-time video splicing
JP2009164674A (en) Distortion correction device
CN101146234B (en) Stream media image processing method
WO2013125198A1 (en) Image processor, imaging device, and image processing program
JP2012134626A (en) Image processing device, image processing method, and imaging apparatus
JP2016136660A (en) Integrated circuit and image processing method by integrated circuit

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
TA01 Transfer of patent application right

Effective date of registration: 20210118

Address after: 247100 building A1, science and Technology Incubation Park, Jiangnan industrial concentration zone, Chizhou City, Anhui Province

Applicant after: Anhui Kelang Electronic Technology Co.,Ltd.

Address before: 100176 11th floor, block B, AVIC Plaza, 15 ronghua South Road, economic and Technological Development Zone, Daxing District, Beijing

Applicant before: BEIJING WENXIANG INFORMATION TECHNOLOGY Co.,Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant