CN109903347B - Color mixing method, system, computer equipment and storage medium - Google Patents

Color mixing method, system, computer equipment and storage medium Download PDF

Info

Publication number
CN109903347B
CN109903347B CN201711296891.XA CN201711296891A CN109903347B CN 109903347 B CN109903347 B CN 109903347B CN 201711296891 A CN201711296891 A CN 201711296891A CN 109903347 B CN109903347 B CN 109903347B
Authority
CN
China
Prior art keywords
color
superimposed
value
rendering
alpha
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
CN201711296891.XA
Other languages
Chinese (zh)
Other versions
CN109903347A (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.)
New Founder Holdings Development Co ltd
Original Assignee
Pku Founder Information Industry Group Co ltd
Peking University Founder Group 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 Pku Founder Information Industry Group Co ltd, Peking University Founder Group Co Ltd filed Critical Pku Founder Information Industry Group Co ltd
Priority to CN201711296891.XA priority Critical patent/CN109903347B/en
Publication of CN109903347A publication Critical patent/CN109903347A/en
Application granted granted Critical
Publication of CN109903347B publication Critical patent/CN109903347B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Generation (AREA)

Abstract

The invention provides a method, a system, a computer device and a computer readable storage medium for color mixing. The color mixing method comprises the following steps: acquiring a source color, at least one superimposed color and a transparency value corresponding to the at least one superimposed color in the image; performing first rendering according to the source color and the transparency value to obtain a first rendering color value; determining an accumulated additive color according to at least one additive color; determining an empirical parameter according to the transparency value; and performing second rendering according to the first rendering color value, the accumulated superposed color and the empirical parameters to obtain an output color value. By the technical scheme, the final mixed color can be determined without depending on the sequence of the arrangement of the superposed colors, and the obtained mixed effect is close to the rendering effect obtained by the traditional semitransparent mixed technology.

Description

Color mixing method, system, computer equipment and storage medium
Technical Field
The present invention relates to the field of computer graphics, and in particular, to a method, system, computer device and computer-readable storage medium for color mixing.
Background
Translucent blending (AlphaBlending) is a common color blending method that is intended to achieve a translucent effect. Transparency (Alpha) is a type of data that appears in a 32-bit bitmap file that specifies the transparency of pixels in an image, i.e., the file can specify the transparency of each pixel by adding a fourth channel, the Alpha channel, to the original 24-bit true color file. Alpha set to 0 indicates transparent, Alpha set to 1 indicates opaque, and values in between this range indicate translucent. The semi-transparent mixing is to calculate a new color and an old color to generate the new color, the semi-transparent mixing technology at the present stage is to multiply a source color and a superposition color by a coefficient and then add them to obtain an output color value, when a plurality of colors are superposed, each color needs to be superposed according to the sequence of the superposition colors, but the traditional calculation mode completely depends on the arrangement sequence of the superposition colors, when the superposed colors cannot be sorted, for example: when objects in a three-dimensional scene are drawn, the traditional semitransparent mixing technology can be very difficult to calculate the color superposition.
Therefore, a color mixing method is required to solve the above problems.
Disclosure of Invention
The present invention is directed to solving at least one of the problems of the prior art or the related art.
To this end, one aspect of the invention is to propose a method of color mixing.
Another aspect of the invention is to provide a system for color mixing.
Yet another aspect of the invention is directed to a computer device.
Yet another aspect of the present invention is to provide a computer-readable storage medium.
In view of the above, according to one aspect of the present invention, there is provided a method of color mixing, comprising: acquiring a source color, at least one superimposed color and a transparency value corresponding to the at least one superimposed color in the image; performing first rendering according to the source color and the transparency value to obtain a first rendering color value; determining an accumulated additive color according to at least one additive color; determining an empirical parameter according to the transparency value; and performing second rendering according to the first rendering color value, the accumulated superposed color and the empirical parameters to obtain an output color value.
According to the color mixing method provided by the invention, the source color, the superimposed color and the corresponding transparency value in the superimposed color in the image are obtained, and the first rendering color value is obtained according to the source color and the transparency values of all the superimposed colors; calculating through at least one superimposed color to determine an accumulated superimposed color, and determining an empirical parameter according to transparency values of all superimposed colors; therefore, the output color value, namely the final mixed color, can be obtained according to the three parameters of the first rendering color value, the accumulated superposed color and the empirical parameter. In the process, the determination of the final mixed color can be completed only by acquiring the source color and the transparency values corresponding to the superposed color without depending on the sequence of the arrangement of the superposed colors, the determination process is simple, the mixed color can be determined without repeatedly accumulating and repeatedly superposing, the obtained mixed effect is close to the rendering effect obtained by the traditional semitransparent mixing technology, the transparent mixing calculation with definite sequence of the superposed colors is completely suitable, the data calculation amount in the color mixing process is reduced, and the problem of processing the superposed color mixing in a modeling manner can be realized.
The above-mentioned method for color mixing according to the present invention may further have the following technical features:
in the above technical solution, preferably, the output color value is calculated by the following formula:
Coutput=Coutput1+C×ρ
wherein, CoutputIs an output color value, Coutput1Is a first rendering color value, CIs the cumulative additive color and ρ is an empirical parameter.
In the technical scheme, the formula for calculating the output color is as the formula, and the output color value C isoutputRendering color value C with first pass, respectivelyoutput1Cumulative additive color CAnd the empirical parameter rho is correlated, the mixed color after superposition of multiple superposed colors can be directly obtained through calculation by the formula, iteration is not required to be repeatedly carried out on the source color once according to the superposition color superposition sequence, the calculation amount in the color superposition process is reduced, and the final output color can be directly obtained through formula calculation, so that the color superposition process can be modeled and digitized, and the color superposition processing is accelerated.
In the above technical solution, preferably, the first-pass rendering color value is calculated by the following formula:
Figure GDA0002781448880000031
wherein, Coutput1Is a first rendering color value, CBaseIs the source color, AlphaiIs the transparency value corresponding to the ith superimposed color, and n is the number of superimposed colors.
In the technical scheme, the color value C is rendered for the first timeoutput1Is calculated with CBaseIs the source color CBaseAnd the transparency value Alpha corresponding to the ith superimposed coloriIt is relevant to thereby introduce the source colour in the calculation of rendering to carry out the multiplication accumulation after getting the benefit respectively to the transparency of all stack colours, use the multiplication accumulation result that obtains to carry out the preliminary treatment to the source colour, so that render as the object of being rendered in the rendering of second time, the computational formula of rendering colour value for the first time is simple and clear in addition, easily realizes digitization and modelling.
In the above technical solution, preferably, the accumulated superimposed color is calculated by the following formula:
Figure GDA0002781448880000032
wherein, CIs the cumulative addition of color CiIs the ith superimposed color and n is the number of superimposed colors.
In this solution, the additive color C is accumulatedIs a superimposed color CiThe accumulated result is used for calculating all the superimposed colors, when the second rendering is carried out, the result is used as the superimposed colors to process the first rendering result, and no limit requirement is set for the sequence of the superimposed colors in the accumulation process, so that the situation that semitransparent mixed calculation is difficult when the sequence of the superimposed colors cannot be determined is avoided.
In the above technical solution, preferably, the empirical parameter is calculated by the following formula:
ρ=g(Alpha1,Alpha2,Alpha3,……Alphan)
where ρ is an empirical parameter and g is AlphaiFunction as input value, AlphaiIs the transparency value corresponding to the ith superimposed color.
In the technical scheme, the experience parameter rho and the transparency value Alpha corresponding to the ith superimposed coloriCorrelation, the calculated result can be obtained directly by inputting the transparency value of each superimposed color as an input value into the function g for the cumulative superimposed color CThe weight is set, numerical value overflow and color error are avoided after the color value is rendered for the first time and the accumulated superposed color is added, and the fact that the calculated output color value is close to the rendering effect obtained by the traditional semitransparent mixing technology can be effectively guaranteed by using empirical parameters.
According to another aspect of the invention, there is provided a system for color mixing, comprising:
the system comprises an acquisition unit, a display unit and a display unit, wherein the acquisition unit is used for acquiring a source color, at least one superposed color and a transparency value corresponding to the at least one superposed color in an image; the first computing unit is used for performing first rendering according to the source color and the transparency value to obtain a first rendering color value; the second calculation unit is used for determining the accumulated superposition color according to at least one superposition color; the third calculation unit is used for determining an empirical parameter according to the transparency value; and the fourth calculating unit is used for performing second rendering according to the first rendering color value, the accumulated superposition color and the experience parameter to obtain an output color value.
According to the color mixing system, the first calculation unit is used for conducting first-pass rendering on the source color, the superposed colors and the transparency values corresponding to the superposed colors in the image acquired by the acquisition unit according to the source color and the transparency values corresponding to all the superposed colors to obtain first-pass rendering color values; calculating at least one superposition color by using a second calculating unit to determine an accumulated superposition color, and determining an empirical parameter according to transparency values of all the superposition colors by using a third calculating unit; therefore, the output color value, namely the final mixed color, can be obtained by using the fourth calculation unit according to the three parameters of the first rendering color value, the accumulated superposition color and the empirical parameter. In the process, the determination of the final mixed color can be completed only by acquiring the source color and the transparency values corresponding to the superposed color without depending on the sequence of the arrangement of the superposed colors, the determination process is simple, the mixed color can be determined without repeatedly accumulating and repeatedly superposing, the obtained mixed effect is close to the rendering effect obtained by the traditional semitransparent mixing technology, the transparent mixing calculation with definite sequence of the superposed colors is completely suitable, the data calculation amount in the color mixing process is reduced, and the problem of processing the superposed color mixing in a modeling manner can be realized.
In the foregoing technical solution, preferably, the fourth calculating unit calculates the output color value by using the following formula:
Coutput=Coutput1+C×ρ
wherein, CoutputIs an output color value, Coutput1Is a first rendering color value, CIs the cumulative additive color and ρ is an empirical parameter.
In the technical scheme, the formula for calculating the output color is as the formula, and the output color value C isoutputRendering color value C with first pass, respectivelyoutput1Cumulative additive color CAnd the empirical parameter rho is correlated, the fourth calculation unit can be used for directly calculating the mixed color after the superposition of multiple superposed colors through the formula, iteration is not required to be repeatedly performed on the source color once according to the superposition color superposition sequence, the calculated amount in the color superposition process is reduced, the final output color can be directly obtained through formula calculation, and the color superposition process can be modeled and digitized, so that the color superposition processing is accelerated.
In the above technical solution, preferably, the first calculating unit calculates the first rendering color value by using the following formula:
Figure GDA0002781448880000051
wherein, Coutput1Is a first rendering color value, CBaseIs the source color, AlphaiIs the transparency value corresponding to the ith superimposed color, and n is the number of superimposed colors.
In the technical scheme, the color value C is rendered for the first timeoutput1Is calculated with CBaseIs the source color CBaseAnd the transparency value Alpha corresponding to the ith superimposed coloriIt is relevant to thereby introduce the source colour in the calculation of rendering to carry out the multiplication accumulation after getting the benefit respectively to the transparency that all stack colours correspond, use the multiplication accumulation result that obtains to carry out the preliminary treatment to the source colour, so that render as the object of being rendered in the rendering of second time, the computational formula of rendering colour value for the first time is simple and clear in addition, easily realizes digitization and modelling.
In the above technical solution, preferably, the second calculating unit calculates the cumulative superimposed color using the following formula:
Figure GDA0002781448880000061
wherein, CIs the cumulative addition of color CiIs the ith superimposed color and n is the number of superimposed colors.
In this solution, the additive color C is accumulatedIs a superimposed color CiThe accumulated result is used for calculating all the superimposed colors, when the second rendering is carried out, the result is used as the superimposed colors to process the first rendering result, and no limit requirement is set for the sequence of the superimposed colors in the accumulation process, so that the situation that semitransparent mixed calculation is difficult when the sequence of the superimposed colors cannot be determined is avoided.
In the above technical solution, preferably, the third calculating unit calculates the empirical parameter by using the following formula:
ρ=g(Alpha1,Alpha2,Alpha3,……Alphan)
where ρ is an empirical parameter and g is AlphaiFunction as input value, AlphaiIs the transparency value corresponding to the ith superimposed color.
In the technical scheme, the experience parameter rho and the transparency value Alpha corresponding to the ith superimposed coloriCorrelation, the calculated result can be obtained directly by inputting the transparency value of each superimposed color as an input value into the function g for the cumulative superimposed color CThe weight is set, numerical value overflow and color error are avoided after the color value is rendered for the first time and the accumulated superposed color is added, and the fact that the calculated output color value is close to the rendering effect obtained by the traditional semitransparent mixing technology can be effectively guaranteed by using empirical parameters.
According to yet another aspect of the invention, a computer device is proposed, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the method of color mixing as defined in any of the above when executing the computer program.
According to the computer equipment provided by the invention, when a processor executes a computer program, the first-pass rendering is carried out by acquiring the source color, the superposed color and the corresponding transparency value in the superposed color in the image and according to the source color and the transparency values corresponding to all the superposed colors, so as to obtain a first-pass rendering color value; calculating through at least one superimposed color to determine an accumulated superimposed color, and determining an empirical parameter according to transparency values of all superimposed colors; therefore, the output color value, namely the final mixed color, can be obtained according to the three parameters of the first rendering color value, the accumulated superposed color and the empirical parameter. In the process, the determination of the final mixed color can be completed only by acquiring the source color and the transparency values corresponding to the superposed color without depending on the sequence of the arrangement of the superposed colors, the determination process is simple, the mixed color can be determined without repeatedly accumulating and repeatedly superposing, the obtained mixed effect is close to the rendering effect obtained by the traditional semitransparent mixing technology, the transparent mixing calculation with definite sequence of the superposed colors is completely suitable, the data calculation amount in the color mixing process is reduced, and the problem of processing the superposed color mixing in a modeling manner can be realized.
According to yet another aspect of the invention, a computer-readable storage medium is proposed, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method of color mixing as defined in any of the above.
When the computer program is executed by the processor, the first-pass rendering is carried out according to the source color and the transparency values corresponding to all the superposed colors by acquiring the source color, the superposed colors and the corresponding transparency values in the superposed colors in the image, so as to obtain first-pass rendering color values; calculating through at least one superimposed color to determine an accumulated superimposed color, and determining an empirical parameter according to transparency values of all superimposed colors; therefore, the output color value, namely the final mixed color, can be obtained according to the three parameters of the first rendering color value, the accumulated superposed color and the empirical parameter. In the process, the determination of the final mixed color can be completed only by acquiring the source color and the transparency values corresponding to the superposed color without depending on the sequence of the arrangement of the superposed colors, the determination process is simple, the mixed color can be determined without repeatedly accumulating and repeatedly superposing, the obtained mixed effect is close to the rendering effect obtained by the traditional semitransparent mixing technology, the transparent mixing calculation with definite sequence of the superposed colors is completely suitable, the data calculation amount in the color mixing process is reduced, and the problem of processing the superposed color mixing in a modeling manner can be realized.
Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
Drawings
The above and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
FIG. 1 shows a schematic flow chart diagram of one embodiment of a method of color mixing of the present invention;
FIG. 2 shows a schematic block diagram of one embodiment of a system for color mixing of the present invention;
FIG. 3 shows a schematic block diagram of a computer apparatus 300 of one embodiment of the present invention.
Detailed Description
In order that the above objects, features and advantages of the present invention can be more clearly understood, a more particular description of the invention will be rendered by reference to the appended drawings. It should be noted that the embodiments and features of the embodiments of the present application may be combined with each other without conflict.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention, however, the present invention may be practiced in other ways than those specifically described herein, and therefore the scope of the present invention is not limited to the specific embodiments disclosed below.
An embodiment of the first aspect of the present invention proposes a method of color mixing, and fig. 1 shows a schematic flow chart of an embodiment of the method of color mixing of the present invention. Wherein, the method comprises the following steps:
s102, obtaining a source color, at least one superimposed color and a transparency value corresponding to the at least one superimposed color in the image;
s104, performing first rendering according to the source color and the transparency value to obtain a first rendering color value;
s106, determining the accumulated superimposed color according to at least one superimposed color;
s108, determining empirical parameters according to the transparency value;
and S110, performing second rendering according to the first rendering color value, the accumulated superposed color and the empirical parameters to obtain an output color value.
In the embodiment, a first rendering pass is performed by obtaining a source color, a superimposed color and a corresponding transparency value in the superimposed color in an image and according to the source color and the transparency values of all the superimposed colors to obtain a first rendering color value; calculating through at least one superimposed color to determine an accumulated superimposed color, and determining an empirical parameter according to transparency values of all superimposed colors; therefore, the output color value, namely the final mixed color, can be obtained according to the three parameters of the first rendering color value, the accumulated superposed color and the empirical parameter. In the process, the determination of the final mixed color can be completed only by acquiring the source color and the transparency values corresponding to the superposed color without depending on the sequence of the arrangement of the superposed colors, the determination process is simple, the mixed color can be determined without repeatedly accumulating and repeatedly superposing, the obtained mixed effect is close to the rendering effect obtained by the traditional semitransparent mixing technology, the transparent mixing calculation with definite sequence of the superposed colors is completely suitable, the data calculation amount in the color mixing process is reduced, and the problem of processing the superposed color mixing in a modeling manner can be realized.
In one embodiment of the present invention, preferably, the output color value is calculated by the following formula:
Coutput=Coutput1+C×ρ
wherein, CoutputIs an output color value, Coutput1Is a first rendering color value, CIs the cumulative additive color and ρ is an empirical parameter.
In this embodiment, the formula for the calculation of the output color is as above, the output color value CoutputRendering color value C with first pass, respectivelyoutput1Cumulative additive color CAnd the empirical parameter rho is correlated, the mixed color after superposition of multiple superposed colors can be directly obtained through calculation by the formula, iteration is not required to be repeatedly carried out on the source color once according to the superposition color superposition sequence, the calculation amount in the color superposition process is reduced, and the final output color can be directly obtained through formula calculation, so that the color superposition process can be modeled and digitized, and the color superposition processing is accelerated.
In one embodiment of the present invention, preferably, the first-pass rendering color value is calculated by the following formula:
Figure GDA0002781448880000091
wherein, Coutput1Is a first rendering color value, CBaseIs the source color, AlphaiIs the transparency value corresponding to the ith superimposed color, and n is the number of superimposed colors.
In this embodiment, color value C is rendered for the first timeoutput1Is calculated with CBaseIs the source color CBaseAnd the transparency value Alpha corresponding to the ith superimposed coloriIt is relevant to thereby introduce the source colour in the calculation of rendering to carry out the multiplication accumulation after getting the benefit respectively to the transparency of all stack colours, use the multiplication accumulation result that obtains to carry out the preliminary treatment to the source colour, so that render as the object of being rendered in the rendering of second time, the computational formula of rendering colour value for the first time is simple and clear in addition, easily realizes digitization and modelling.
In one embodiment of the present invention, preferably, the cumulative superimposed color is calculated by the following formula:
Figure GDA0002781448880000101
wherein, CIs the cumulative addition of color CiIs the ith superimposed color and n is the number of superimposed colors.
In this embodiment, the cumulative superimposed color CIs a superimposed color CiThe accumulated result is used for calculating all the superimposed colors, when the second rendering is carried out, the result is used as the superimposed colors to process the first rendering result, and no limit requirement is set for the sequence of the superimposed colors in the accumulation process, so that the situation that semitransparent mixed calculation is difficult when the sequence of the superimposed colors cannot be determined is avoided.
In one embodiment of the present invention, preferably, the empirical parameters are calculated from the following formula:
ρ=g(Alpha1,Alpha2,Alpha3,……Alphan)
where ρ is an empirical parameter and g is AlphaiFunction as input value, AlphaiIs the transparency value corresponding to the ith superimposed color.
In this embodiment, the empirical parameter ρ is the transparency value Alpha corresponding to the ith superimposed coloriCorrelation, the calculated result can be obtained directly by inputting the transparency value of each superimposed color as an input value into the function g for the cumulative superimposed color CThe weight is set, numerical value overflow and color error are avoided after the color value is rendered for the first time and the accumulated superposed color is added, and the fact that the calculated output color value is close to the rendering effect obtained by the traditional semitransparent mixing technology can be effectively guaranteed by using empirical parameters.
In an embodiment of the second aspect of the present invention, a system for color mixing is proposed, and fig. 2 shows a schematic block diagram of an embodiment of the system for color mixing of the present invention. The proposed system 200 of color mixing comprises: an obtaining unit 202, configured to obtain a transparency value corresponding to a source color, at least one superimposed color, and at least one superimposed color in an image; the first calculation unit 204 is configured to perform a first rendering pass according to the source color and the transparency value to obtain a first rendering color value; a second calculating unit 206, configured to determine an accumulated additive color according to at least one additive color; a third calculation unit 208 for determining an empirical parameter based on the transparency value; and the fourth calculating unit 210 is configured to perform second rendering according to the first rendering color value, the accumulated superposition color, and the experience parameter to obtain an output color value.
In the embodiment, the first calculation unit performs first rendering on the source color, the superimposed color and the transparency value corresponding to the superimposed color in the image acquired by the acquisition unit according to the source color and the transparency value to obtain a first rendering color value; calculating at least one superposition color by using a second calculating unit to determine an accumulated superposition color, and determining an empirical parameter by using a third calculating unit according to transparency values of all superposition colors; therefore, the output color value, namely the final mixed color, can be obtained by using the fourth calculation unit according to the three parameters of the first rendering color value, the accumulated superposition color and the empirical parameter. In the process, the determination of the final mixed color can be completed only by acquiring the source color and the transparency values corresponding to the superposed color without depending on the sequence of the arrangement of the superposed colors, the determination process is simple, the mixed color can be determined without repeatedly accumulating and repeatedly superposing, the obtained mixed effect is close to the rendering effect obtained by the traditional semitransparent mixing technology, the transparent mixing calculation with definite sequence of the superposed colors is completely suitable, the data calculation amount in the color mixing process is reduced, and the problem of processing the superposed color mixing in a modeling manner can be realized.
In an embodiment of the present invention, preferably, the fourth calculating unit 210 calculates the output color value by using the following formula:
Coutput=Coutput1+C×ρ
wherein, CoutputIs an output color value, Coutput1Is a first rendering color value, CIs the cumulative additive color and ρ is an empirical parameter.
In the technical scheme, the formula for calculating the output color is as the formula, and the output color value C isoutputRendering color value C with first pass, respectivelyoutput1Cumulative additive color CAnd the empirical parameter ρ is correlated, the fourth calculating unit 210 can directly calculate the mixed color obtained by superimposing a plurality of superimposed colors by the formula, iteration is not required to be repeatedly performed once for the source color according to the superimposed color superimposing sequence, the calculated amount in the color superimposing process is reduced, and the final output color can be directly obtained by formula calculation, so that the color superimposing process can be modeled and digitized, and the color superimposing process is accelerated.
In an embodiment of the present invention, preferably, the first calculation unit 204 calculates the first-pass rendering color value by using the following formula:
Figure GDA0002781448880000121
wherein, Coutput1Is a first rendering color value, CBaseIs the source color, AlphaiIs the transparency value corresponding to the ith superimposed color, and n is the number of superimposed colors.
In this embodiment, color value C is rendered for the first timeoutput1Is calculated with CBaseIs the source color CBaseAnd the transparency value Alpha corresponding to the ith superimposed coloriIt is relevant to thereby introduce the source colour in the calculation of rendering to carry out the multiplication accumulation after getting the benefit respectively to the transparency of all stack colours, use the multiplication accumulation result that obtains to carry out the preliminary treatment to the source colour, so that render as the object of being rendered in the rendering of second time, the computational formula of rendering colour value for the first time is simple and clear in addition, easily realizes digitization and modelling.
In one embodiment of the present invention, preferably, the second calculation unit calculates the cumulative superimposed color using the following formula:
Figure GDA0002781448880000122
wherein, CIs the cumulative addition of color CiIs the ith superimposed color and n is the number of superimposed colors.
In this embodiment, the cumulative superimposed color CIs a superimposed color CiThe accumulated result is used for calculating all the superimposed colors, when the second rendering is carried out, the result is used as the superimposed colors to process the first rendering result, and no limit requirement is set for the sequence of the superimposed colors in the accumulation process, so that the situation that semitransparent mixed calculation is difficult when the sequence of the superimposed colors cannot be determined is avoided.
In one embodiment of the present invention, preferably, the third calculating unit calculates the empirical parameter by using the following formula:
ρ=g(Alpha1,Alpha2,Alpha3,……Alphan)
where ρ is an empirical parameter and g is AlphaiFunction as input value, AlphaiIs the transparency value corresponding to the ith superimposed color.
In this embodiment, the empirical parameter ρ is the transparency value Alpha corresponding to the ith superimposed coloriCorrelation, the calculated result can be obtained directly by inputting the transparency value of each superimposed color as an input value into the function g for the cumulative superimposed color CThe weight is set, numerical value overflow and color error are avoided after the color value is rendered for the first time and the accumulated superposed color is added, and the fact that the calculated output color value is close to the rendering effect obtained by the traditional semitransparent mixing technology can be effectively guaranteed by using empirical parameters.
In an embodiment of the third aspect of the present invention, a computer device is provided, and fig. 3 shows a schematic block diagram of a computer apparatus 300 according to an embodiment of the present invention. Wherein, this computer device 300 includes: a memory 302, a processor 304 and a computer program stored on the memory 302 and executable on the processor 304, the processor 304 when executing the computer program implementing the steps of the method of color mixing as described in any one of the above.
In the computer device 300 provided by the invention, when the processor 304 executes the computer program, the first-pass rendering is performed by obtaining the source color, the superimposed color and the corresponding transparency value in the superimposed color in the image and according to the source color and the transparency values corresponding to all the superimposed colors, so as to obtain a first-pass rendering color value; calculating through at least one superimposed color to determine an accumulated superimposed color, and determining an empirical parameter according to transparency values of all superimposed colors; therefore, the output color value, namely the final mixed color, can be obtained according to the three parameters of the first rendering color value, the accumulated superposed color and the empirical parameter. In the process, the determination of the final mixed color can be completed only by acquiring the source color and the transparency values corresponding to the superposed color without depending on the sequence of the arrangement of the superposed colors, the determination process is simple, the mixed color can be determined without repeatedly accumulating and repeatedly superposing, the obtained mixed effect is close to the rendering effect obtained by the traditional semitransparent mixing technology, the transparent mixing calculation with definite sequence of the superposed colors is completely suitable, the data calculation amount in the color mixing process is reduced, and the problem of processing the superposed color mixing in a modeling manner can be realized.
An embodiment of the fourth aspect of the invention proposes a computer-readable storage medium having stored thereon a computer program which, when being executed by a processor, carries out the steps of the method of color mixing according to any one of the above.
When the computer program is executed by the processor, the first-pass rendering is carried out according to the source color and the transparency values corresponding to all the superposed colors by acquiring the source color, the superposed colors and the corresponding transparency values in the superposed colors in the image, so as to obtain first-pass rendering color values; calculating through at least one superimposed color to determine an accumulated superimposed color, and determining an empirical parameter according to transparency values of all superimposed colors; therefore, the output color value, namely the final mixed color, can be obtained according to the three parameters of the first rendering color value, the accumulated superposed color and the empirical parameter. In the process, the determination of the final mixed color can be completed only by acquiring the source color and the transparency values corresponding to the superposed color without depending on the sequence of the arrangement of the superposed colors, the determination process is simple, the mixed color can be determined without repeatedly accumulating and repeatedly superposing, the obtained mixed effect is close to the rendering effect obtained by the traditional semitransparent mixing technology, the transparent mixing calculation with definite sequence of the superposed colors is completely suitable, the data calculation amount in the color mixing process is reduced, and the problem of processing the superposed color mixing in a modeling manner can be realized.
In the description herein, the description of the terms "one embodiment," "some embodiments," "specific embodiments," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (12)

1. A method of color mixing, characterized in that,
acquiring a source color, at least one superimposed color and a transparency value corresponding to the at least one superimposed color in an image;
performing first rendering according to the source color and the transparency value to obtain first rendering color values;
determining an accumulated superimposed color according to the at least one superimposed color;
determining an empirical parameter according to the transparency value;
and performing second rendering according to the first rendering color value, the accumulated superposition color and the empirical parameters to obtain an output color value.
2. The method of color mixing of claim 1 wherein the output color values are calculated by the formula:
Coutput=Coutput1+C×ρ
wherein, CoutputIs an output color value, Coutput1Is a first rendering color value, CIs the cumulative additive color and ρ is an empirical parameter.
3. The method of color mixing according to claim 2, wherein the first pass rendering color values are calculated by the following formula:
Figure FDA0002781448870000011
wherein, Coutput1Is a first rendering color value, CBaseIs the source color, AlphaiIs the transparency value corresponding to the ith superimposed color, and n is the number of superimposed colors.
4. The method of color mixing according to claim 2, wherein the cumulative additive color is calculated by the formula:
Figure FDA0002781448870000021
wherein, CIs the cumulative addition of color CiIs the ith superimposed color and n is the number of superimposed colors.
5. The method of color mixing according to claim 2, wherein the empirical parameters are calculated from the following formula:
ρ=g(Alpha1,Alpha2,Alpha3,……Alphan)
where ρ is an empirical parameter and g is AlphaiFunction as input value, AlphaiIs the transparency value corresponding to the ith superimposed color.
6. A system for color mixing, characterized in that,
the device comprises an acquisition unit, a display unit and a display unit, wherein the acquisition unit is used for acquiring a source color, at least one superimposed color and a transparency value corresponding to the at least one superimposed color in an image;
the first computing unit is used for conducting first-pass rendering according to the source color and the transparency value to obtain first-pass rendering color values;
the second calculation unit is used for determining the accumulated superposition color according to the at least one superposition color;
the third calculation unit is used for determining an empirical parameter according to the transparency value;
and the fourth calculation unit is used for performing second rendering according to the first rendering color value, the accumulated superposition color and the experience parameter to obtain an output color value.
7. The color mixing system of claim 6 wherein the fourth calculation unit calculates the output color value using the following equation:
Coutput=Coutput1+C×ρ
wherein, CoutputIs an output color value, Coutput1Is a first rendering color value, CIs the cumulative additive color and ρ is an empirical parameter.
8. The color mixing system of claim 7, wherein the first computing unit computes the first-pass rendered color values using the following formula:
Figure FDA0002781448870000031
wherein, Coutput1Is a first rendering color value, CBaseIs the source color, AlphaiIs the transparency value corresponding to the ith superimposed color, and n is the number of superimposed colors.
9. The color mixing system according to claim 7, wherein the second calculation unit calculates the cumulative superimposed color using the following formula:
Figure FDA0002781448870000032
wherein, CIs the cumulative addition of color CiIs the ith superimposed color and n is the number of superimposed colors.
10. The system for color mixing according to claim 7, wherein said third calculation unit calculates said empirical parameters using the following formula:
ρ=g(Alpha1,Alpha2,Alpha3,……Alphan)
where ρ is an empirical parameter and g is AlphaiFunction as input value, AlphaiIs the transparency value corresponding to the ith superimposed color.
11. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that: the processor is configured to perform the steps of the method of color mixing as claimed in any one of claims 1 to 5.
12. A computer-readable storage medium having stored thereon a computer program, characterized in that: the computer program realizing the steps of the method of color mixing as claimed in any one of claims 1 to 5 when executed by a processor.
CN201711296891.XA 2017-12-08 2017-12-08 Color mixing method, system, computer equipment and storage medium Expired - Fee Related CN109903347B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711296891.XA CN109903347B (en) 2017-12-08 2017-12-08 Color mixing method, system, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711296891.XA CN109903347B (en) 2017-12-08 2017-12-08 Color mixing method, system, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN109903347A CN109903347A (en) 2019-06-18
CN109903347B true CN109903347B (en) 2021-04-09

Family

ID=66940641

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711296891.XA Expired - Fee Related CN109903347B (en) 2017-12-08 2017-12-08 Color mixing method, system, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN109903347B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110458921B (en) * 2019-08-05 2021-08-03 腾讯科技(深圳)有限公司 Image processing method, device, terminal and storage medium
CN111124404B (en) * 2019-11-29 2023-06-20 武汉虹信技术服务有限责任公司 Custom color display method and system
CN113822961B (en) * 2021-09-22 2024-04-26 广州博冠信息科技有限公司 Method, device, equipment and medium for 2D rendering of 3D model
CN116438566A (en) * 2022-11-09 2023-07-14 卓永红 Fast parallel processing method and device for multi-layer hybrid rendering

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100914120B1 (en) * 2002-04-15 2009-08-27 마이크로소프트 코포레이션 Facilitating interaction between video renderers and graphics device drivers
CN101295408A (en) * 2007-04-27 2008-10-29 新奥特硅谷视频技术有限责任公司 3D videotext rendering method and system
US8217934B2 (en) * 2008-01-23 2012-07-10 Adobe Systems Incorporated System and methods for rendering transparent surfaces in high depth complexity scenes using hybrid and coherent layer peeling
US20110193871A1 (en) * 2010-02-07 2011-08-11 Microsoft Corporation Rendering multi-layered image
CN102637303B (en) * 2012-04-26 2014-05-28 珠海医凯电子科技有限公司 Ultrasonic three-dimensional mixed and superposed volumetric rendering processing method based on GPU (Graphic Processing Unit)
CN104781851B (en) * 2012-11-19 2017-12-12 索尼电脑娱乐公司 Image processing apparatus and image processing method
US20160328871A1 (en) * 2015-05-05 2016-11-10 Mediatek Inc. Graphics system and associated method for displaying blended image having overlay image layers

Also Published As

Publication number Publication date
CN109903347A (en) 2019-06-18

Similar Documents

Publication Publication Date Title
CN109903347B (en) Color mixing method, system, computer equipment and storage medium
CN108446694B (en) Target detection method and device
CN102480626A (en) Image processing apparatus, display apparatus and image processing program
CN104658030B (en) The method and apparatus of secondary image mixing
JP2018512913A5 (en)
CN110288692B (en) Illumination rendering method and device, storage medium and electronic device
CN110378947B (en) 3D model reconstruction method and device and electronic equipment
CN104408708A (en) Global-local-low-rank-based image salient target detection method
CN104574495A (en) Method and device for rendering image
CN108960012B (en) Feature point detection method and device and electronic equipment
CN102480629A (en) Image processing apparatus, display apparatus, image processing method and image processing program
US20150187051A1 (en) Method and apparatus for estimating image noise
CN109600605A (en) Detection method, electronic equipment and the computer program product of 4K ultra high-definition video
CN109754372B (en) Image defogging method and device
CN111641822A (en) Method for evaluating quality of repositioning stereo image
CN103955921B (en) Image noise estimation method based on human eye visual features and partitioning analysis method
CN111462278B (en) Depth-based material sequencing rendering method, medium, equipment and device
CN110378948B (en) 3D model reconstruction method and device and electronic equipment
EP3193327B1 (en) Image processing device and image processing method
CN111882498A (en) Image processing method, image processing device, electronic equipment and storage medium
CN115457206A (en) Three-dimensional model generation method, device, equipment and storage medium
CN116309494A (en) Method, device, equipment and medium for determining interest point information in electronic map
US9035964B2 (en) Method and apparatus for obtaining lighting information and material information in image modeling system
CN112700526B (en) Concave-convex material image rendering method and device
CN109388311A (en) A kind of image display method, device and equipment

Legal Events

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

Effective date of registration: 20230613

Address after: 3007, Hengqin international financial center building, No. 58, Huajin street, Hengqin new area, Zhuhai, Guangdong 519031

Patentee after: New founder holdings development Co.,Ltd.

Address before: 100871, Beijing, Haidian District Cheng Fu Road 298, founder building, 9 floor

Patentee before: PEKING UNIVERSITY FOUNDER GROUP Co.,Ltd.

Patentee before: PKU FOUNDER INFORMATION INDUSTRY GROUP CO.,LTD.

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: 20210409