CN109166162A - 2D color changing method based on fixed form and aspect - Google Patents

2D color changing method based on fixed form and aspect Download PDF

Info

Publication number
CN109166162A
CN109166162A CN201811168896.9A CN201811168896A CN109166162A CN 109166162 A CN109166162 A CN 109166162A CN 201811168896 A CN201811168896 A CN 201811168896A CN 109166162 A CN109166162 A CN 109166162A
Authority
CN
China
Prior art keywords
color
picture
become
fixed form
changing method
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201811168896.9A
Other languages
Chinese (zh)
Inventor
林澄
易黎明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Xianfeng Network Technology Co Ltd
Original Assignee
Suzhou Xianfeng Network 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 Suzhou Xianfeng Network Technology Co Ltd filed Critical Suzhou Xianfeng Network Technology Co Ltd
Priority to CN201811168896.9A priority Critical patent/CN109166162A/en
Publication of CN109166162A publication Critical patent/CN109166162A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/001Texturing; Colouring; Generation of texture or colour
    • 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/10024Color image

Landscapes

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

Abstract

The invention discloses a kind of 2D color changing methods based on fixed form and aspect, comprising the following steps: S1, obtains original image, and the color space of the original image is changed into HSV color-values from rgb color code, obtain the first picture;S2, color to be become and color of object are determined;S3, each of first picture point is chosen, and is compared with the color to be become;If the color of S4, point in first picture is identical as the color to be become, discoloration processing is carried out to the point and is changed into the color of object.

Description

2D color changing method based on fixed form and aspect
Technical field
The present invention relates to color-change technology fields, and in particular to the 2D color changing method based on fixed form and aspect.
Background technique
2D is otherwise known as planar graph comprising picture and frame animation etc..2D picture or frame animation are general in the prior art It is changed into the transformation that HSV model carries out color using RGB model, the change of color is then carried out using the form and aspect H in HSV model It can only be converted for entire picture or frame animation when changing, but carrying out the transformation of form and aspect in 2D picture or frame animation, nothing Method realizes the conversion that color is carried out to the part in 2D picture or frame animation.
Summary of the invention
The technical problem to be solved in the present invention is to provide a kind of 2D color changing methods based on fixed form and aspect, can scheme to 2D Piece or frame animation carry out the discoloration processing of part.
In order to solve the above-mentioned technical problems, the present invention provides a kind of 2D color changing methods based on fixed form and aspect, including with Lower step:
S1, picture is obtained, and the color space of picture is changed into HSV color-values from rgb color code, obtain the first figure Piece;
S2, color to be become and color of object are determined;
S3, each of first picture point is chosen, and is compared with the color to be become;
If the point in S4, first picture is identical as the color to be become, discoloration processing is carried out to the point and is changed into The color of object;Otherwise it is not processed.
Further, step S2 includes:
The gamut range of S21, the gamut range for obtaining color to be become and color of object;
S22, it determines described wait become deviation of the color transition into the color of object when.
Further, step S3 includes:
S31, each of first picture segment is chosen;
S32, H numerical value in all segments is taken out;
S33, successively compare whether H numerical value is located in the gamut range of the color to be become.
Further, step S4 includes:
If H numerical value in S41, the segment is located in the gamut range of the color to be become, by the H numerical value and described Deviation superposition, and superimposed color gamut value is exported to obtain the first segment;Otherwise directly H numerical value is exported;
S42, will be on first binds pieces node corresponding into first picture.
Further, further include step S5 after step S4:
S5, the adjustment deviation, continuous circulation step S2-S4, until reaching preset cycle-index.
Further, further include step S0 before step S1:
S0, the color of the color change interval in first picture is set in advance as red.
Further, rgb color code is changed into the conversion formulas of HSV color-values in step S1 are as follows:
V=max
, wherein (r, g, b) is the red, green and blue coordinate an of color respectively, their value is the real number between 0 to 1; If max is equivalent to r, the maximum in g and b.If min is equal to r, the reckling in g and b;H ∈ [0,360) be angle form and aspect Angle, and s, v ∈ [0,1] are respectively saturation degree and lightness.
Further, the picture obtained in step S1 includes static picture or frame animation.
Further, in step S31, each of described first picture segment is chosen using pixel coloring device.
Beneficial effects of the present invention:
The color space that will acquire in picture is changed into HSV color-values from rgb color code, then to being changed into HSV model The first picture be compared, the point can be changed into color of object when the point in the first picture is identical with wait become color; Otherwise without any processing;To realize the technical effect for carrying out local discolouration processing to 2D picture.
Detailed description of the invention
Fig. 1 is flow chart of the invention.
Specific embodiment
The present invention will be further explained below with reference to the attached drawings and specific examples, so that those skilled in the art can be with It more fully understands the present invention and can be practiced, but illustrated embodiment is not as a limitation of the invention.
Shown in referring to Fig.1, the present invention is based on an embodiments of the 2D picture color changing method of fixed form and aspect, including following step It is rapid:
S1, picture is obtained, and the color space of picture is changed into HSV color-values from rgb color code, obtain the first figure Piece;
S2, color to be become and color of object are determined;
S3, each of the first picture point is chosen, and is compared with color to be become;
If the point in S4, the first picture is identical as color to be become, discoloration processing is carried out to the point and is changed into color of object; Otherwise it is not processed.
The color space of picture is changed into the formula of HSV color-values from rgb color code in step sl are as follows:
V=max
Wherein, (r, g, b) is the red, green and blue coordinate an of color respectively, their value is the real number between 0 to 1. If max is equivalent to r, the maximum in g and b.If min is equal to r, the reckling in g and b.Find in HSV space (h, S, v) value, here h ∈ [0,360) be angle hue angle, and s, v ∈ [0,1] are respectively saturation degree and lightness.
By the way that RGB model is changed into HSV model, carried out at selection and discoloration convenient for the subsequent point in the first picture Reason.
It can be simultaneously static picture in the picture that original state obtains in step S1, or frame animation, and The mode of the two subsequent processing is similar.The face of regional area in picture can be changed when choosing static picture and being handled Color, and when acquisition frame animation is handled, it can change colour for the local color of frame animation.
It may include step S0 before step S1, step S0 includes that the color of the color change interval in the first picture is preparatory It is set as red, to increase subsequent color change interval.
Because red form and aspect numerical value is close to 0 degree in HSV model, thus in the initial state that the region of discoloration is preparatory It is set as red, is capable of increasing subsequent color change interval, naturally it is also possible to be arranged to other colors.
Step S2 it is specific the following steps are included:
The gamut range of S21, the gamut range for obtaining color to be become and color of object.
Colour gamut be to a kind of method that color is encoded, in computer graphical processing, colour gamut be color some is complete Full subset.The picture that will acquire in step sl changes for the first picture under HSV model, thus can according to The range of its specific corresponding colour gamut of the color lookup of change, while can also find out the corresponding gamut range of color of object.Its In, color to be become refers to the color for needing to change before discoloration processing, and color of object refers to the color wanted after discoloration processing.
S22, determination will be wait become deviation of the color transition into color of object when.
Utilize the gamut range of color to be become in step S21 and the gamut range of color of object, it will be able to calculate by The deviation of colour gamut when becoming color transition as color of object.I.e. when target face can be obtained when becoming color addition upper deviation value Color.
Step S3 is included the steps that in detail below:
S31, each of the first picture segment is chosen.
Pixel coloring device is a function, and the data of processing are segment (pixel fragment).Pixel coloring device Task is for one color value of each fragment computations.Each of the first picture segment thus is chosen using pixel coloring device, And the color value of each segment is accordingly calculated, it is handled convenient for the comparison and discoloration in later period.
S32, H numerical value in whole segments is taken out.
The picture under RGB model is changed into the first picture under HSV model in step sl, thus utilizes pixel The segment that tinter selects corresponding can obtain form and aspect H numerical value.Form and aspect are the primary features of color, are the various differences of difference The most accurate standard of color, the feature of form and aspect are decided by the spectral composition of light source and each wavelength of colored objects surface reflection The ratio of radiation is to feeling caused by human eye.
S33, successively compare whether H numerical value is located in the gamut range of the color to be become.
The gamut range of color to be become has been obtained in the step s 21, the gamut range of color to be become can have been recorded For (origin_h_min, origin_h_max).By using pixel coloring device choose each segment in H numerical value successively with The gamut range of color to be become is compared, and judges whether the H numerical value of the segment is located inside the gamut range of color to be become.
Step S4 includes specific steps below:
If the H numerical value in S41, segment is located in the gamut range of color to be become, H numerical value and deviation are superimposed, and will Superimposed color gamut value exports to obtain the first segment;Otherwise directly H numerical value is exported.
It can be obtained by step S33, when the H numerical value and gamut range of segment to be compared, can judge the H number of segment Whether value is located in the gamut range of color to be become.When the H numerical value of a certain segment is located at the gamut range of color to be become When (origin_h_min, origin_h_max) is internal, that is, it can determine whether that the segment is identical as color to be become, need the segment pair The color transition answered is color of object.The deviation that will be determined in the H numerical value and step S22 of the segment is overlapped, thus It is color of object by the corresponding color transition of the segment.If the H numerical value of a certain segment is located at the gamut range of color to be become When the exterior of a set of (origin_h_min, origin_h_max), that is, it can determine whether that the segment and color to be become be not identical, so It does not need the segment carrying out discoloration processing.Thus directly the corresponding color value of the segment is exported, without any processing, from And keep the color of its script.
S42, will be on the first binds pieces node corresponding into the first picture.
When the segment of selection is located inside the gamut range wait become color, the H numerical value and deviation of segment are superimposed, together When by the segment after superposition processing be defined as the segment be the first segment, the end value of the first segment namely pixel.Then By the first binds pieces into the first picture the node of the node of corresponding picture or frame animation, picture or frame animation can be realized The variation of the color of corresponding position, to realize the local discolouration of picture or frame animation.
In gaming in order to reach the state of film flicker, step S5 can be increased after step s4, step S5 is specific The following steps are included:
S51, maximum cycle K is preset;
S52, the adjustment deviation, continuous circulation step S2-S4, and constantly accumulation loop number;
S53, when the cycle-index reaches the maximum cycle K, terminate circulation;Otherwise it continues cycling through.
Deviation is adjusted by Do statement, so that can be realized the continuous change of picture color in a circulation Change, to achieve the effect that picture flashes.
Embodiment described above is only to absolutely prove preferred embodiment that is of the invention and being lifted, protection model of the invention It encloses without being limited thereto.Those skilled in the art's made equivalent substitute or transformation on the basis of the present invention, in the present invention Protection scope within.Protection scope of the present invention is subject to claims.

Claims (9)

1. a kind of 2D color changing method based on fixed form and aspect, which comprises the following steps:
S1, original image is obtained, and the color space of the original image is changed into HSV color-values from rgb color code, obtained First picture;
S2, color to be become and color of object are determined;
S3, each of first picture point is chosen, and is compared with the color to be become;
If the color of S4, point in first picture is identical as the color to be become, discoloration processing transformation is carried out to the point For the color of object.
2. the 2D color changing method as described in claim 1 based on fixed form and aspect, which is characterized in that step S2 includes:
The gamut range of S21, the gamut range for obtaining color to be become and color of object;
S22, it determines described wait become deviation of the color transition into the color of object when.
3. the 2D color changing method as claimed in claim 2 based on fixed form and aspect, which is characterized in that step S3 includes:
S31, each of first picture segment is chosen;
S32, H numerical value in all segments is taken out;
S33, successively compare whether H numerical value is located in the gamut range of the color to be become.
4. the 2D color changing method as claimed in claim 3 based on fixed form and aspect, which is characterized in that step S4 includes:
If the H numerical value in S41, the segment is located in the gamut range of the color to be become, by the H numerical value and the deviation Value superposition, and superimposed color gamut value is exported to obtain the first segment;Otherwise directly H numerical value is exported;
S42, will be on first binds pieces node corresponding into first picture.
5. the 2D color changing method as claimed in claim 4 based on fixed form and aspect, which is characterized in that further include step after step S4 Rapid S5:
S5, the adjustment deviation, continuous circulation step S2-S4, until reaching preset cycle-index.
6. the 2D color changing method as described in claim 1 based on fixed form and aspect, which is characterized in that further include step before step S1 Rapid S0:
S0, the color of the color change interval in first picture is set in advance as red.
7. the 2D color changing method as described in claim 1 based on fixed form and aspect, which is characterized in that rgb color code in step S1 It is changed into the conversion formula of HSV color-values are as follows:
V=max, wherein (r, g, b) is the red, green and blue coordinate an of color respectively, their value is the reality between 0 to 1 Number;If max is equivalent to r, the maximum in g and b;If min is equal to r, the reckling in g and b;H ∈ [0,360) be angle color Phase angle, and s, v ∈ [0,1] are respectively saturation degree and lightness.
8. the 2D color changing method as described in claim 1 based on fixed form and aspect, which is characterized in that is obtained in step S1 is described Picture includes static picture, frame animation or its mixing.
9. the 2D color changing method as claimed in claim 3 based on fixed form and aspect, which is characterized in that in step S31, described the Each of one picture segment is chosen using pixel coloring device.
CN201811168896.9A 2018-10-08 2018-10-08 2D color changing method based on fixed form and aspect Pending CN109166162A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811168896.9A CN109166162A (en) 2018-10-08 2018-10-08 2D color changing method based on fixed form and aspect

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811168896.9A CN109166162A (en) 2018-10-08 2018-10-08 2D color changing method based on fixed form and aspect

Publications (1)

Publication Number Publication Date
CN109166162A true CN109166162A (en) 2019-01-08

Family

ID=64877531

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811168896.9A Pending CN109166162A (en) 2018-10-08 2018-10-08 2D color changing method based on fixed form and aspect

Country Status (1)

Country Link
CN (1) CN109166162A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101764913A (en) * 2008-12-10 2010-06-30 新奥特(北京)视频技术有限公司 Color replacement method base on HSV space
CN104851114A (en) * 2015-04-24 2015-08-19 广东欧珀移动通信有限公司 Method for partial color changing of image, and terminal
CN106780648A (en) * 2016-12-15 2017-05-31 北京金山软件有限公司 A kind of dynamic mapping method and device of color of image
CN108053797A (en) * 2017-12-20 2018-05-18 惠科股份有限公司 Driving method and driving device of display device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101764913A (en) * 2008-12-10 2010-06-30 新奥特(北京)视频技术有限公司 Color replacement method base on HSV space
CN104851114A (en) * 2015-04-24 2015-08-19 广东欧珀移动通信有限公司 Method for partial color changing of image, and terminal
CN106780648A (en) * 2016-12-15 2017-05-31 北京金山软件有限公司 A kind of dynamic mapping method and device of color of image
CN108053797A (en) * 2017-12-20 2018-05-18 惠科股份有限公司 Driving method and driving device of display device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
廖宁放 等: "《数字图文图像颜色管理***概论》", 北京理工大学出版社, pages: 223 - 224 *

Similar Documents

Publication Publication Date Title
Wang et al. An optimized tongue image color correction scheme
JP5883949B2 (en) Spectral synthesis for image capture device processing.
CN103108469B (en) Method and device for controlling output light of illuminating device and illuminating system
KR102007309B1 (en) Method and device for measuring the colour of an object
RU2450476C2 (en) Device and method to determine optimal backlighting
CN100551081C (en) A kind of method and device of realizing white balance correction
CN106791759B (en) The bearing calibration of medical display color uniformity and correction system
CN102858072B (en) Lighting control method and system
US7024034B2 (en) Color temperature conversion system and method using the same
CN109923385B (en) Method and apparatus for determining hair color uniformity
CN105493489B (en) Gamut mapping system and method
Wang et al. Fast automatic white balancing method by color histogram stretching
CN108401148A (en) Method for executing automatic white balance to image
Nguyen et al. Why you should forget luminance conversion and do something better
CN105898252A (en) Television color adjustment method and device
CN112185301A (en) Display device correction method and device and processor
Zhao et al. Spectral illumination correction: Achieving relative color constancy under the spectral domain
CN108462865A (en) It determines the light source of image and carries out the method and apparatus of colour vision adaptation to image
WO2022120799A1 (en) Image processing method and apparatus, electronic device, and storage medium
CN108833875A (en) A kind of method for correcting automatic white balance
CN105825020B (en) Three-dimensional can perceive colour gamut calculation method
CN104639924A (en) Method for reducing degree of dependence on device pixel to improve color value precision
KR20160098540A (en) Creation device for color table, correction and control device for camera image and method thereof
CN109166162A (en) 2D color changing method based on fixed form and aspect
US10242461B1 (en) Method to improve overlay mapping of out-of-gamut

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20190108

RJ01 Rejection of invention patent application after publication