CN111615714A - Color adjustment method for RGB data - Google Patents

Color adjustment method for RGB data Download PDF

Info

Publication number
CN111615714A
CN111615714A CN201880086830.7A CN201880086830A CN111615714A CN 111615714 A CN111615714 A CN 111615714A CN 201880086830 A CN201880086830 A CN 201880086830A CN 111615714 A CN111615714 A CN 111615714A
Authority
CN
China
Prior art keywords
rgb
hue
value
adjustment
input data
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
CN201880086830.7A
Other languages
Chinese (zh)
Other versions
CN111615714B (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.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies 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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Publication of CN111615714A publication Critical patent/CN111615714A/en
Application granted granted Critical
Publication of CN111615714B publication Critical patent/CN111615714B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N1/00Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
    • H04N1/46Colour picture communication systems
    • H04N1/56Processing of colour picture signals
    • H04N1/60Colour correction or control
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Color Image Communication Systems (AREA)
  • Facsimile Image Signal Circuits (AREA)
  • Image Processing (AREA)

Abstract

The embodiment of the application discloses a color adjustment method and a device of RGB data, wherein the method comprises the following steps: calculating a first hue interval corresponding to the hue adjustment value; determining a second color interval corresponding to the RGB output data according to the RGB input data and the first color interval; and adjusting the saturation and brightness of the RGB input data by using the saturation adjustment value and the brightness adjustment value respectively to obtain RGB adjustment data, and selecting RGB output data from the RGB adjustment data according to the second color interval. The hue adjustment value, the saturation adjustment value and the brightness adjustment value are used for carrying out color adjustment on the RGB input data in the RGB color space all the time, the RGB input data do not need to be firstly converted into the HSV color space and then inversely converted, and the whole color adjustment process is realized through addition operation, subtraction operation, comparison operation and multiplication operation, so that a large number of floating point operation and division operation are avoided, a large number of resources of LUTs or dividers are saved, and the power consumption of hardware is reduced.

Description

Color adjustment method for RGB data Technical Field
The present application relates to the field of image processing, and in particular, to a method and an apparatus for adjusting color of RGB data.
Background
In the field of Image Processing, such as Camera Image Signal Processing (ISP) for Camera, Image Processing (Image Processing for Display), Digital Image Processing (Digital Image Processing), and other related fields, adjusting the hue (hue), saturation (saturation), and brightness (brightness) of an Image is a common method for improving Image quality. In the prior art, a color adjustment method mainly based on HSV/HSL mainly includes: converting input RGB data into HSV/HSL color space to obtain hue, brightness and saturation corresponding to the input RGB data; carrying out a large number of floating point operations on the obtained 3 parameters of the hue, the brightness and the saturation, and the hue adjustment value, the brightness adjustment value and the saturation adjustment value to obtain the hue, the brightness and the saturation after color adjustment; then converting the adjusted hue, brightness and saturation into RGB color space; and finally displayed on the electronic device.
In order to realize the forward transformation and the inverse transformation of the image data in the RGB color space and the HSV/HSL color space and the calculation of the hue, the brightness, the saturation and the corresponding adjustment value, a corresponding hardware circuit needs to carry out a large number of floating point operations, especially division operations. The division operation can be implemented by a divider or a Look Up Table (LUT), but the divider requires a complex and high-precision fixed point reduction process, and the LUT occupies a large amount of hardware resources and increases clock delay, thereby increasing hardware area and reducing the rate of color adjustment of RGB data.
Disclosure of Invention
The embodiment of the application provides a color adjustment method for RGB data, which can be used for solving the problems of larger hardware and higher power consumption caused by an LUT or a divider used as a floating point operation in the color adjustment process.
For a more clear description of the present application, three color spaces (modes) are illustrated below:
RGB: a color space (mode) adds color lights of three primary colors of Red (Red), Green (Green) and Blue (Blue) in different proportions to generate various color lights.
HSL: a color space (mode) in which colors are represented by the superposition of hue h (hue), saturation s (saturation), and luminance (brightness) 3 components.
HSV: the Hue preservation Value, a color space (mode) similar to HSL.
In a first aspect, in an embodiment of the present application, a color adjustment method for RGB data is provided for adjusting hue, saturation and brightness of RGB input data. The adjusting method comprises the following steps: acquiring RGB input data, and acquiring a hue adjustment value, a saturation adjustment value and a brightness adjustment value which are required by color adjustment of the RGB input data; calculating a first hue interval corresponding to the hue adjustment value; determining a second hue interval corresponding to the RGB output data according to the RGB input data and the obtained first hue interval; adjusting the saturation of the RGB input data by using the saturation adjustment value, adjusting the brightness of the RGB input data by using the brightness adjustment value to obtain RGB adjustment data, and selecting RGB output data from the RGB adjustment data according to the second color interval; and displaying the obtained RGB output data.
The hue adjustment value, the saturation adjustment value and the brightness adjustment value are used for carrying out color adjustment on the RGB input data in the RGB color space all the time, the RGB input data do not need to be firstly converted into the HSV color space and then inversely converted, and the whole color adjustment process is realized through addition operation, subtraction operation, comparison operation and multiplication operation, so that a large number of floating point operation and division operation are avoided, a large number of resources of LUTs or dividers are saved, and the power consumption of hardware is reduced.
In one embodiment, calculating the first hue range corresponding to the hue adjustment value includes: the tone adjustment value H is compared with the divisor 2N1Dividing to obtain corresponding quotient Q and remainder Rem, wherein divisor 2N1N1 is a non-negative integer for the total angle of hue. The quotient Q obtained in the above calculation process represents the first hue interval corresponding to the hue adjustment value H, and the remainder Rem represents the hueThe integer value H is a tone change amount of the tone value of the RGB input data in the adjusted tone section. The first tone range corresponding to the tone adjustment value can be obtained by dividing the tone adjustment value to determine the change amount of the tone adjustment value to the tone range of the RGB input data.
In one embodiment, when the hue adjustment value is greater than or equal to the hue threshold, the hue adjustment value is subtracted from the hue adjustment value, otherwise the hue adjustment value is kept unchanged, the hue threshold being the integer power of the maximum interval number multiplied by 2. And adjusting the tone adjustment value to enable the tone adjustment value to be in a proper tone interval, and avoiding the phenomenon that the calculated amount is increased due to the fact that the tone interval in which the tone adjustment value is located is too large.
In one embodiment, the step of determining the second hue interval corresponding to the RGB output data according to the RGB input data and the first hue interval includes: preprocessing RGB input data to obtain an RGB parameter set; performing linear calculation on the remainder and one or more parameters in the RGB parameter set to obtain an alternative parameter set; and determining a second hue interval corresponding to the RGB output data according to the magnitude relation between the RGB input data and the parameters in the RGB parameter set and the magnitude relation between the RGB input data and the parameters in the alternative parameter set. The second tone interval corresponding to the RGB output data can be determined through the calculation process, and the calculation process only involves simple addition operation, subtraction operation, multiplication operation and comparison operation, so that a large amount of hardware resources are saved through a simple logic calculation circuit.
In one embodiment, the step of calculating the RGB parameter set includes: calculating the maximum value and the minimum value of the RGB input data; calculating the difference between the maximum value and the minimum value; and calculating a sub-pixel difference value, wherein the sub-pixel difference value comprises the absolute value of the difference value of every two color components. Because the calculation of the RGB parameter set only involves addition and subtraction operations of non-negative integers, a large amount of hardware resources are saved.
In one embodiment, the above alternative parameter set includes a first parameter S1, and the calculation expression of the first parameter S1 is: s1 is Δ RGB · Rem, where Δ RGB is a difference between a maximum value and a minimum value of the RGB input data, and Rem is the remainder. The first parameters are calculated S1 providing a basis for calculation for subsequent alternative parameter sets.
In one embodiment, the magnitude relationship between one color component in the RGB input data and one parameter in the RGB parameter set and the magnitude relationship between one color component in the RGB input data and one parameter in the candidate parameter set are compared, and one parameter is selected from the candidate parameter set as the saturation coefficient according to the magnitude relationship. And comparing the parameters to obtain a saturation coefficient which is used as a calculation parameter for subsequent brightness adjustment and saturation adjustment.
In one embodiment, a hue interval index value is calculated based on the magnitude relationship, the hue interval index value being a sum of the quotient and a hue constant, wherein the hue constant is determined by the magnitude relationship. And obtaining the tone interval index value through the size relation, and using the tone interval index value as a basis for subsequently selecting RGB output data.
In one embodiment, the RGB adjustment data includes a second parameter p1A third parameter p2A fourth parameter p3And a fifth parameter RGBmaxWherein:
p1=(2n1·RGBmax-△RGB·S)·2n2·V;
p2=(2n3·V-S·Sx)·2n4·V;
p3=[RGBmin·S·2n5+S·Sx-2n6·RGBmax·(Sat-128)]·2n7v (when S.gtoreq.128);
p3=[RGBmin·S·2n5+S·Sx+2n6·RGBmax·(128-Sat)]·2n7v (when S < 128);
wherein n 1-n 7 are integers, RGBmax△ RGB is the difference between the maximum value and the minimum value, S is the saturation adjustment value, V is the brightness adjustment value, Sx is the saturation coefficient, the second parameter p is obtained by the above process1A third parameter p2A fourth parameter p3And a fifth parameter RGBmaxAs the alternative parameters of the RGB output data, the calculation process of the RGB adjustment data only comprises addition operation, subtraction operation, comparison operation and multiplication operation which can be realized by shifting, so that hardware resources are greatly saved, and power consumption is reduced.
In one embodiment, 3 parameters of the RGB adjustment data are selected as RGB output data according to the hue section index value. The RGB output data is selected according to the tone interval index value to obtain the RGB output data in the correct tone interval.
In one embodiment, when the hue interval index value is greater than or equal to the maximum number of hue intervals, then the hue interval index value is subtracted by the maximum number of hue intervals; when the tone interval index value is smaller than the maximum number of tone intervals, the tone interval index value is kept unchanged. The tone interval index value is adjusted to a proper value range to reduce unnecessary calculation and save hardware resources.
In a second aspect, in an embodiment of the present application, there is provided a color adjusting apparatus for RGB data, which is used for adjusting hue, saturation and brightness of RGB input data. The color adjusting device comprises an acquisition module, a color adjusting module and a color adjusting module, wherein the acquisition module is used for acquiring RGB input data and acquiring a hue adjusting value, a saturation adjusting value and a brightness adjusting value which are required by color adjustment of the RGB input data; the first calculation module is used for calculating a first hue interval corresponding to the hue adjustment value; the second calculation module is used for determining a second hue interval corresponding to the RGB output data according to the RGB input data and the obtained first hue interval; the adjusting module is used for adjusting the saturation of the RGB input data by using the saturation adjusting value, adjusting the brightness of the RGB input data by using the brightness adjusting value to obtain RGB adjusting data, and selecting RGB output data from the RGB adjusting data according to the obtained second color interval; the display module is used for displaying the obtained RGB output data;
the hue adjustment value, the saturation adjustment value and the brightness adjustment value are used for carrying out color adjustment on the RGB input data in the RGB color space all the time, the RGB input data do not need to be firstly converted into the HSV color space and then inversely converted, and the whole color adjustment process is realized through addition operation, subtraction operation, comparison operation and multiplication operation, so that a large number of floating point operation and division operation are avoided, a large number of resources of LUTs or dividers are saved, and the power consumption of hardware is reduced.
In one possible implementation, the first calculating module 320 compares the tone adjustment value with the divisor 2N1Dividing to obtain corresponding quotient Q and remainder Rem, wherein divisor 2N1N1 is a non-negative integer for the total angle of hue. The quotient Q obtained in the above calculation process represents a first tone range corresponding to the tone adjustment, and the remainder represents a tone change amount of the tone adjustment value to the tone value of the RGB input data in the adjusted tone range. The first tone range corresponding to the tone adjustment value can be obtained by dividing the tone adjustment value to determine the change amount of the tone adjustment value to the tone range of the RGB input data.
In a possible embodiment, the first calculation module is further configured to subtract the hue adjustment value from the hue threshold value when the hue adjustment value is greater than or equal to the hue threshold value, and otherwise keep the hue adjustment value unchanged, where the hue threshold value is an integer power of the maximum hue interval number multiplied by 2. And adjusting the tone adjustment value to enable the tone adjustment value to be in a proper tone interval, and avoiding the phenomenon that the calculated amount is increased due to the fact that the tone interval in which the tone adjustment value is located is too large.
In a possible implementation, the second computing module is configured to pre-process the RGB input data to obtain an RGB parameter set; performing linear calculation on the remainder Rem and one or more parameters in the RGB parameter set to obtain an alternative parameter set; and determining a second hue interval corresponding to the RGB output data according to the magnitude relation between the RGB input data and the parameters in the RGB parameter set and the magnitude relation between the RGB input data and the parameters in the alternative parameter set. The second tone interval corresponding to the RGB output data can be determined through the calculation process, and the calculation process only involves simple addition operation, subtraction operation, multiplication operation and comparison operation, so that a large amount of hardware resources are saved through a simple logic calculation circuit.
In a possible implementation, the second calculating module is configured to calculate a maximum value and a minimum value of the RGB input data; calculating the difference between the maximum value and the minimum value; and calculating a sub-pixel difference value, wherein the sub-pixel difference value comprises the absolute value of the difference value of every two color components. Because the calculation of the RGB parameter set only involves addition and subtraction operations of non-negative integers, a large amount of hardware resources are saved.
In a possible implementation manner, the second calculating module calculates an alternative parameter set, where the alternative parameter set includes a first parameter S1, and the calculation expression of the first parameter S1 is: s1 ═ Δ RGB · Rem; wherein Δ RGB is a difference between a maximum value and a minimum value of the RGB input data, and Rem is the remainder. The first parameters are calculated S1 providing a basis for calculation for subsequent alternative parameter sets.
In one possible embodiment, the magnitude relationship between one color component in the RGB input data and one parameter in the RGB parameter set, and the magnitude relationship between one color component in the RGB input data and one parameter in the candidate parameter set are compared, respectively. And the second calculation module selects one parameter from the alternative parameter set as a saturation coefficient according to the magnitude relation. And comparing the parameters to obtain a saturation coefficient which is used as a calculation parameter for subsequent brightness adjustment and saturation adjustment.
In one possible embodiment, the second calculation module calculates a hue interval index value which is a sum of a quotient and a hue constant, wherein the hue constant is determined by the magnitude relationship. And obtaining the tone interval index value through the size relation, and using the tone interval index value as a basis for subsequently selecting RGB output data.
In a possible embodiment, the adjustment module calculates RGB adjustment data, which includes the second parameter p1A third parameter p2A fourth parameter p3And a fifth parameter RGBmaxWherein:
p1=(2n1·RGBmax-△RGB·S)·2n2·V;
p2=(2n3·V-S·Sx)·2n4·V;
p3=[RGBmin·S·2n5+S·Sx-2n6·RGBmax·(Sat-128)]·2n7v (when S.gtoreq.128);
p3=[RGBmin·S·2n5+S·Sx+2n6·RGBmax·(128-Sat)]·2n7v (when S < 128);
wherein n 1-n 7 are integers, RGBmax△ RGB is the difference between the maximum and minimum values, S is the saturation adjustment value Sat, V is the brightness adjustment value V, Sx is the saturation coefficient, the second parameter p is obtained by the above process1A third parameter p2A fourth parameter p3And a fifth parameter RGBmaxAs the alternative parameters of the RGB output data, the calculation process of the RGB adjustment data only comprises addition operation, subtraction operation, comparison operation and multiplication operation which can be realized by shifting, so that hardware resources are greatly saved, and power consumption is reduced.
In a possible implementation manner, the adjustment module 340 uses the hue interval index value Indx as the index value of the RGB adjustment data, and selects the second p of the index values1The third p2Fourth p3And fifth RGBmaxAs the values of the 3 color components R, G and B of the RGB output data. The RGB output data is selected according to the tone interval index value to obtain the RGB output data in the correct tone interval.
In a possible embodiment, when the hue interval index value is greater than or equal to the maximum number of hue intervals, the adjustment module subtracts the maximum number of hue intervals from the hue interval index value; when the tone interval index value is smaller than the maximum tone interval number, the adjusting module keeps the tone interval index value unchanged. The tone interval index value is adjusted to a proper value range to reduce unnecessary calculation and save hardware resources.
In a third aspect, in an embodiment of the present application, there is provided a color adjustment apparatus for RGB data, which is used for adjusting hue, saturation and brightness of RGB input data. The color adjustment apparatus includes a memory for storing computer instructions, and a processor. The processor is communicatively coupled to the memory, wherein the computer instructions configure the processor and are configured to perform the color adjustment method of the first aspect and its possible implementation.
The hue adjustment value, the saturation adjustment value and the brightness adjustment value are used for carrying out color adjustment on the RGB input data in the RGB color space all the time, the RGB input data do not need to be firstly converted into the HSV color space and then inversely converted, and the whole color adjustment process is realized through addition operation, subtraction operation, comparison operation and multiplication operation, so that a large number of floating point operation and division operation are avoided, a large number of resources of LUTs or dividers are saved, and the power consumption of hardware is reduced.
In a fourth aspect, a computer-readable storage medium is provided in an embodiment of the present application, which is characterized in that the computer-readable storage medium stores a computer program, which is read and executed by one or more processors to implement the color adjustment method in the first aspect and its possible implementation.
The hue adjustment value, the saturation adjustment value and the brightness adjustment value are used for carrying out color adjustment on the RGB input data in the RGB color space all the time, the RGB input data do not need to be firstly converted into the HSV color space and then inversely converted, and the whole color adjustment process is realized through addition operation, subtraction operation, comparison operation and multiplication operation, so that a large number of floating point operation and division operation are avoided, a large number of resources of LUTs or dividers are saved, and the power consumption of hardware is reduced.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below.
Fig. 1 is a flowchart illustrating a color adjustment method according to an embodiment of the invention.
Fig. 2 is a more detailed data flow diagram of a color adjustment method according to an embodiment of the invention.
Fig. 3 is a schematic structural diagram of a color adjustment apparatus according to an embodiment of the invention.
Fig. 4 is an electronic device for color adjustment according to an embodiment of the invention.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly described below with reference to the drawings in the embodiments of the present application.
In the HSV/HSL color space, pixel data is represented by hue, saturation, and brightness. The hue represents the basic attribute of the color, namely the name of the color, and the value range of the hue is 0-360 degrees. For example, a color represented by a hue of 0 ° or 360 ° is red, a color represented by a hue of 120 ° is green, and a color represented by a hue of 240 ° is blue. The saturation represents the purity of the color, the value range of the saturation is 0-100%, the higher the saturation is, the less the gray is, and the more the color is bright. The value range of the brightness is 0-100%, the brightness represents the brightness of the color, and the color is closer to white when the brightness is higher. For example, when the hue is 0 °, the color represented by 100% is white, and the color represented by 50% is gray. For convenience, the HSV color space is employed in accordance with all embodiments of the present application. It should be noted that the HSL color space may also be employed according to all embodiments of the present application.
Fig. 1 is a schematic flow chart of a color adjustment method according to an embodiment of the present application, which performs a hue adjustment, a saturation adjustment, and a brightness adjustment on RGB input data in an RGB color space according to an input hue adjustment value H, a saturation adjustment value S, and a brightness adjustment value V, and outputs RGB output data subjected to the color adjustment. The RGB input data and the RGB output data are both represented in the RGB color space, i.e. the values of the three color components R (Red), G (Green ) and B (Blue ) in the RGB color space.
As shown in fig. 1, in step 110, RGB input data is acquired, and a hue adjustment value, a saturation adjustment value, and a brightness adjustment value required for color adjustment of the RGB input data are acquired; in step 120, a first hue range corresponding to the hue adjustment value is calculated; in step 130, determining a second hue interval corresponding to the RGB output data according to the RGB input data and the obtained first hue interval; in step 140, adjusting the saturation of the RGB input data using the saturation adjustment value and adjusting the luminance of the RGB input data using the luminance adjustment value to obtain RGB adjustment data, and selecting RGB output data from the RGB adjustment data according to the second hue interval obtained in step 130; finally, in step 150, the resulting RGB output data is displayed.
On the one hand, in the color adjustment process, the hue adjustment value H, the saturation adjustment value S and the brightness adjustment value V always perform color adjustment on RGB input data in an RGB color space, and the RGB input data does not need to be converted into an HSV color space first and then subjected to inverse transformation, so that a large number of floating point operations and division operations are avoided. On the other hand, the color adjustment process can be realized by only performing addition, subtraction, comparison and multiplication operations on the color adjustment value, the RGB input data and the intermediate parameter, wherein the data participating in the operations are all non-negative integers, and the multiplication operations are all equal to 2nWherein n is an integer. Thus, the multiplication operation may be implemented by a shift or other simple calculation method. Compared with the prior art, the color adjustment method realizes the color adjustment of the RGB input data through the addition operation, the subtraction operation, the comparison operation and the multiplication operation of the nonnegative integers, avoids the use of a large number of LUTs or dividers in the prior art, saves hardware resources and reduces the power consumption of hardware.
Fig. 2 is a more specific data flow diagram of a color adjustment method according to an embodiment of the present application.
First, an input hue adjustment value H is calculated to obtain a first hue range corresponding to the hue adjustment value H. In HSV color space, a hue having a total angle of 360 ° is typically divided into a number of hue intervals by a maximum number of hue intervals, where the maximum number of hue intervals is a positive integer. For example, when the maximum number of tone sections is 6, one tone section is determined every 60 °. When the maximum number of tone sections is larger, the tone sections are divided into finer tone sections, and therefore the accuracy of tone adjustment increases, which complicates the calculationThe degree also increases. In the present embodiment, the total angle of the color tone is 2N1Angle of 2 thereinN1Divided by the maximum number of hue sections M, and the angle of each divided hue section is (2)N1[ 0 ] M DEG, e.g., the angle of the 0 th tone zone is 0 to (2)N1A 1 st hue interval of (2)N1/M)°~(2.2N1/M) ° and so on.
Specifically, calculating the first hue range corresponding to the hue adjustment value includes: the tone adjustment value H is compared with the divisor 2N1 Division operation 210 is performed, and corresponding quotient Q and remainder Rem are obtained, wherein divisor 2N1N1 is a non-negative integer for the total angle of hue. It should be noted that division calculation of the hue adjustment value H is not the only implementation method for performing the division operation 210 in the present application, and the division operation may be implemented by using smaller hardware resources by implementing calculation of the quotient Q and the remainder Rem by other methods, which will be listed in detail below. The quotient Q obtained in the above calculation process represents the first hue range corresponding to the hue adjustment value H, that is, the quotient Q may reflect the change of the hue adjustment value H to the hue range in which the RGB input data is located, or how many hue ranges are increased or decreased, that is, the change of the color attribute; the remainder Rem represents the tone change amount of the tone adjustment value H to the tone value of the RGB input data in the adjusted tone section, that is, the remainder Rem may reflect the specific change amount of the tone adjustment value H to the tone value of the RGB input data in the adjusted tone section. The quotient Q obtained by the division has a value range from 0 to the maximum hue interval number M, and the remainder Rem is less than or equal to 2N1-1。
Alternatively, when the hue adjustment value H is large, the hue threshold H may be exceededthdTherefore, before the division operation (210) is performed on the hue adjustment value H, the value range processing (211) needs to be performed on the hue adjustment value H to make the hue adjustment value H in an appropriate hue interval, so as to avoid the increase of the calculation amount caused by the overlarge hue adjustment value H. Specifically, when the hue adjustment value H is greater than or equal to the hue threshold value HthdIf so, the hue threshold value H is subtracted from the hue adjustment value HthdOtherwise, keeping the hue adjustment value H unchanged, wherein the hue is obtainedThreshold value HthdThe expression of (a) is:
Hthd=M·2N1
where N1 is an integer and M is the maximum number of intervals. The divisor in the division operation is 2N1Therefore, the division operation (210) can be realized by a simpler method to obtain the quotient Q and the remainder Rem, and the division operation is avoided by adopting a divider or an LUT, so that the area occupied by hardware resources of the division operation (210) is reduced, and the power consumption is saved. For example, the hue is adjusted by the value H and n.2N1One by one, where n is 0, 1, 2 …. When the hue adjustment value H satisfies n.2N1≤H<(n+1)·2N1Then, the value of the quotient Q-n is determined, and Rem-H-n.2 is calculatedN1To determine the value of the remainder Rem.
Since the hue adjustment value H is a non-negative integer, both the quotient Q and the remainder Rem obtained are non-negative integers. The first hue range corresponding to the hue adjustment value H can be determined by dividing (210) the hue adjustment value H as described above. When the hue adjustment value H is too large, the value range processing (211) is performed to adjust the first hue range corresponding to the hue adjustment value H so that the first hue range is within the appropriate hue range.
After the tone range adjustment amount is obtained, a second tone range corresponding to the RGB output data is determined based on the RGB input data and the first tone range. The step of determining the second hue interval corresponding to the RGB output data according to the RGB input data and the first hue interval includes: pre-processing (220) the RGB input data to obtain an RGB parameter set; performing linear calculation (230) on the remainder Rem and one or more parameters in the RGB parameter set to obtain an alternative parameter set; and determining a second hue interval corresponding to the RGB output data according to the magnitude relation between the RGB input data and the parameters in the RGB parameter set and the magnitude relation between the RGB input data and the parameters in the alternative parameter set.
In particular, the step of pre-processing (220) the RGB input data to obtain the RGB parameter set comprises:
calculating a maximum value RGB of RGB input datamaxAnd minimum value RGBmin
Calculating the maximum value RGBmaxAnd minimum value RGBmin△ RGB, i.e., △ RGB-RGBmax-RGBmin
And calculating a sub-pixel difference value, wherein the sub-pixel difference value comprises the absolute value of the difference value of every two color components, namely the absolute value RB of the difference value of the red color component R and the blue color component BabsAbsolute value RG of the difference between red component R and green component GabsAnd the absolute value GB of the difference between the green component G and the blue component Babs
Thus, the above-mentioned RGB parameter set comprises RGBmax、RGBmin、△RGB、RBabs、RGabsAnd GBabs. Since the RGB input data are all non-negative integers, the RGB parameter sets obtained are all non-negative integers.
And performing linear calculation (230) on the remainder Rem obtained by performing division operation (210) on the hue adjustment value H and one or more parameters in the RGB parameter set to obtain an alternative parameter set. Wherein the alternative parameter set comprises a result of performing linear transformation on the remainder Rem and one or more parameters in the RGB parameter set, i.e. a parameter S1~S11. Parameter S in the candidate parameter set1~S11Is determined by the expression in the following table:
S 1=△RGB·Rem
S 2=S 1+2 n·GB abs
S 3=S 1+2 n·RG abs
S 4=S 1+2 n·RB abs
S 5=S 2-2 n·△RGB
S 6=S 3-2 n·△RGB
S 7=S 4-2 n·△RGB
S 8=S 1+2 n·△RGB-2 n·GB abs
S 9=△RGB·Rem-2 n·GB abs
S 10=△RGB·Rem-2 n·RG abs
S 11=△RGB·Rem-2 n·RB abs
it should be noted that the parameters in the alternative parameter set in the present application are not limited to the above 11 parameters, nor to the expression form of the above parameters. The alternative parameter set may comprise one or more other parameters, but at least the first parameter S of these parameters1Or by fitting a first parameter S1The resulting one or more parameters are calculated (230) linearly. In the expressions of the parameters in the candidate parameter set, n is an integer, where n in the expression of each parameter is an independent value. In calculating the parameter S1~S11In order to align the variables on both sides of the plus sign or the minus sign to the same bit width and ensure that the calculation result is a non-negative integer when the addition operation or the subtraction operation is carried out, △ RGB and RB are usedabs、RGabsAnd GBabsMultiplication by the power of an integer of 2, e.g. in the calculation of S1And GBabsWhen the bit widths of the data bits are different, the GB is addedabsAnd 2nMultiplication alignment S1And GBabsSpecifically, △ RGB, RBabs、RGabsAnd GBabsAnd 2nThe multiplication can be performed by shifting the data one or more times to the left or to the right.
After the calculation of the candidate parameter set is completed, determining a second hue interval corresponding to the RGB output data according to the magnitude relationship between the RGB input data and the parameters in the RGB parameter set and the magnitude relationship between the RGB input data and the parameters in the candidate parameter set. Specifically, the magnitude relationship between one color component in the RGB input data and one parameter in the RGB parameter set, and the magnitude relationship between one color component in the RGB input data and one parameter in the candidate parameter set are compared (240), and one parameter is selected from the candidate parameter set as the saturation coefficient Sx according to the magnitude relationship, and the hue interval index value Indx is calculated according to the magnitude relationship and the quotient Q obtained by the division operation (210).
Specifically, the process of comparing (240) includes at least one first type of comparison and at least one second type of comparison. The first type of comparison includes RGB inputSize comparison between three color components R, G and B in the data, RGB input data, and maximum RGBmaxAnd the RGB input data and the first threshold thd1And a second threshold value thd2Or an expression satisfying a plurality of the comparisons described above at the same time. Wherein a first threshold value thd is calculated1And a second threshold value thd2Are respectively:
thd1=2n·△RGB+B;
thd2=2n·△RGB+R。
wherein n is an integer and thd1And thd2Where n is an independent value, B is a blue color component, and R is a red color component, multiplying the difference △ RGB by the integer power of 2 can align the bit widths of the two addends in the above expression.
The second comparison includes the parameter S2、S3、S4、RBabs、RGabsAnd GBabsParameter (2) and S1And △ RGB 2n+S1A comparison between them. And determining the saturation coefficient Sx and the hue interval index value Indx according to the results of the two comparisons. Specifically, the parameter S is selected from the candidate parameter set according to the size relationship1~S11One of the parameters is used as a saturation index value Sx, and a hue interval index value Indx is calculated according to the above magnitude relation. The hue interval index value Indx may be expressed as Indx ═ Q + k, where k is a hue constant, the value range thereof is a non-negative integer, and Q is the quotient obtained in step 120. By the above-described magnitude relation, the value of k can be determined, and the tone section index value Indx can be calculated.
For example, in the first type of comparison, it is determined whether the color component R is the maximum value of the RGB input data, and at the same time, it is determined whether the value of the color component G is equal to or greater than the value of the color component B, that is, G.gtoreq.B, and in the second type of comparison, it is determined △ RGB 2n+S1Value of and RBabs、S5The magnitude relationship of (1). One case of the comparison result is enumerated here. In a first type of comparison, when R is RGBmaxAnd R is not less than B; at the same time, in the second placeIn the second type of comparison, when △ RGB 2n+S1=RBabsWhen the hue interval index value Indx is Q +1, the saturation coefficient Sx is S1When △ RGB 2n+S1≤S5When the hue interval index value Indx is Q +1, the saturation coefficient Sx is S5-△RGB·2n+S1. Where n is an integer to align the bit widths of the two addends in the above expression. If the two second comparisons are not satisfied, the hue interval index value Indx is Q, and the saturation coefficient Sx is S5. For the other cases in the first type of comparison, the values of the saturation coefficient Sx and the hue interval index value Indx are determined by a second type of comparison in other ways.
Since the RGB input data and the color tone adjustment value H are different physical quantities, the color tone section corresponding to the RGB output data can be indirectly determined by calculating the color tone section index value Indx through the comparison (240). Specifically, the quotient Q obtained by the division operation (210) may reflect an amount of change of the hue adjustment value H in the RGB color space for the hue interval of the RGB input data, and the remainder Rem obtained by the division operation (210) may reflect an amount of adjustment of the hue adjustment value H in the hue interval for the hue of the RGB input data. By comparing the above size relationship, the hue interval corresponding to the RGB output data, that is, the hue interval index value Indx can be determined to reflect the hue interval after the hue adjustment value H acts on the RGB input data, that is, the hue interval corresponding to the RGB output data.
After the saturation coefficient and the hue interval index value are obtained, the saturation of the RGB input data is adjusted by using a saturation adjustment value S, the brightness of the RGB input data is adjusted by using a brightness adjustment value V to obtain RGB adjustment data, and the RGB output data is selected from the RGB adjustment data according to a second hue interval corresponding to the RGB output data. Optionally, before the adjustment (260), a value range process may be performed on the tone range index value Indx. Specifically, when the tone section index value Indx is greater than or equal to the maximum number of tone sections, the tone section index value Indx is subtracted by the maximum number of tone sections; when the tone section index value Indx is smaller than the maximum number of tone sections, the tone section index value Indx is kept unchanged.
In the adjusting (260), adjusting the saturation of the RGB input data by a saturation adjustment value S and adjusting the luminance of the RGB input data by a luminance adjustment value V includes: RGB adjustment data is calculated. Wherein the RGB adjustment data comprise a second parameter p1A third parameter p2A fourth parameter p3And a fifth parameter RGBmax. For the second parameter p in the RGB adjustment data1And a third parameter p2The calculation formula is determined by the following expression:
p1=(2n·RGBmax-△RGB·S)·2n·V;
p2=(2n·V-S·Sx)·2n·V;
the second parameter p1And a third parameter p2In the expression of (a), n is an integer, wherein n in the expression of each parameter is an independent value. In calculating the second parameter p1And a third parameter p2In addition, in order to align the variables on both sides of the plus sign or the minus sign to the same bit width when performing addition or subtraction, RGB is usedmaxAnd V and 2nMultiplication. In the above calculation of p1In the expression of (1), the maximum value RGBmaxSubtracting the product of the saturation adjustment value S and the difference value △ RGB as the saturation adjustment value S for the RGB input data, multiplying the result by the brightness adjustment value V as the brightness adjustment value V for the RGB input data2In the expression (2), the saturation adjustment value S is multiplied by a saturation coefficient Sx and used as the saturation adjustment value S for adjusting the saturation of the RGB input data; the result of subtracting the brightness adjustment value V is multiplied by the brightness adjustment value V to be used as the brightness adjustment of the RGB input data by the brightness adjustment value V.
For the fourth parameter p in the RGB adjustment data3First, the intermediate parameter p needs to be calculated31、p32And p33For the parameter p31And p32The calculation formula is determined by the following expression:
P31=RGBmin·S·2n
P32=S·Sx。
wherein n is an integer. In the above calculation of p31And p32In the expression (2), the saturation adjustment value S is respectively equal to the minimum value RGBminAnd multiplying the saturation coefficient Sx to be used as saturation adjustment value S for adjusting the saturation of the RGB input data.
For parameter p33In order to make the parameter p33The calculation result of (2) is positive, and it needs to be determined whether the saturation adjustment value S exceeds a saturation standard value, which may be 2nWhere n is a positive integer, e.g., n ═ 7. The parameter p is illustrated by taking n as 733However, it should be noted that the saturation standard value according to the embodiment of the present application may also be other values satisfying 2nE.g., 32, 64, etc. When the saturation adjustment value S is greater than or equal to the saturation standard value, i.e., S ≧ 128, i.e., the saturation adjustment value acts to enhance saturation, so p33Sat-128 otherwise, when S < 128, the saturation adjustment value acts to attenuate the saturation, when p33=128-Sat。
Therefore, when the parameter Sat ≧ 128, then:
p3=[p31+p32-(2n1·RGBmax·p33)]·2n2·V;
when the parameter Sat < 128, then:
p3=[p31+p32+(2n1·RGBmax·p33)]·2n2·V。
the above parameter p3In the expression of (1), n1And n2Are independent integers. In calculating the parameter p3In order to align variables on two sides of plus sign or minus sign to the same bit width and ensure that the calculation result is a non-negative integer when addition operation or subtraction operation is carried out, RGB is usedmax·p33And V is multiplied by an integer power of 2. Specifically, RGBmax·p33And V multiplied by the integer power of 2 can be obtained byData is shifted left or right one or more times.
After the calculation of the RGB adjustment data is completed, the hue interval index value Indx is used as the index value of the RGB adjustment data, and the second p of the index values is selected1The third p2Fourth p3And fifth RGBmaxAs the values of the 3 color components R, G and B of the RGB output data. For example, when the hue interval index value lndx is 0, R in the RGB output data is RGBmax、G=p3、B=p1(ii) a When the tone section index value lndx is 1, R in the RGB output data is p2、G=RGBmax、B=p1. It should be noted that the tone range index value Indx and the manner of selecting RGB output data are not limited in any way in the present application. The selected RGB output data may be the parameter p according to different hue interval index values Indx1、p2、p3And RGBmaxAny 3 of them.
After the adjustment (260) is completed, the resulting RGB output data is displayed (270) on a display device to obtain a color adjustment effect on the RGB input data.
The foregoing details illustrate the method of the embodiments of the present application, and in order to better implement the above-described scheme of the embodiments of the present application, the embodiments of the present application further provide a corresponding color adjustment apparatus.
Fig. 3 is a schematic structural diagram of a color adjusting apparatus 300 for RGB data according to an embodiment of the present disclosure. The color adjustment apparatus 300 includes:
an obtaining module 310, configured to obtain RGB input data, and obtain a hue adjustment value, a saturation adjustment value, and a brightness adjustment value required for performing color adjustment on the RGB input data;
the first calculating module 320 is configured to calculate a first hue interval corresponding to the hue adjustment value;
the second calculating module 330 is configured to determine a second hue interval corresponding to the RGB output data according to the RGB input data and the obtained first hue interval;
an adjusting module 340, configured to adjust the saturation of the RGB input data by using the saturation adjustment value, adjust the luminance of the RGB input data by using the luminance adjustment value to obtain RGB adjustment data, and select RGB output data from the RGB adjustment data according to the obtained second hue interval;
a display module 350, configured to display the obtained RGB output data;
in one possible embodiment, the first calculating module 320 compares the hue adjustment value H with the divisor 2N1 Division operation 210 is performed, and corresponding quotient Q and remainder Rem are obtained, wherein divisor 2N1N1 is a non-negative integer for the total angle of hue. The quotient Q obtained in the above calculation process represents a first hue range corresponding to the hue adjustment value H, and the remainder Rem represents a hue change amount of the hue adjustment value H to the hue value of the RGB input data in the adjusted hue range.
In one possible embodiment, when the hue adjustment value H is greater than or equal to the hue threshold value HthdThe first calculating module 320 is further configured to subtract the hue threshold H from the hue adjustment value HthdOtherwise, keeping the tone adjusting value H unchanged, wherein the tone threshold is the integral power of the maximum tone interval number multiplied by 2.
In a possible implementation, the second calculating module 330 is configured to pre-process the RGB input data to obtain an RGB parameter set; performing linear calculation on the remainder Rem and one or more parameters in the RGB parameter set to obtain an alternative parameter set; and determining a second hue interval corresponding to the RGB output data according to the magnitude relation between the RGB input data and the parameters in the RGB parameter set and the magnitude relation between the RGB input data and the parameters in the alternative parameter set.
In a possible implementation, the second calculating module 330 is used for calculating the maximum RGB of the RGB input datamaxAnd minimum value RGBmin(ii) a Calculating the maximum value RGBmaxAnd minimum value RGBmin△ RGB, i.e., △ RGB-RGBmax-RGBmin(ii) a And calculating a sub-pixel difference value, wherein the sub-pixel difference value comprises the absolute value of the difference value of every two color components,
in a possible implementation, the second calculating module 330 calculates an alternative parameter set, where the alternative parameter set includes a first parameter S1, and the calculation expression of the first parameter S1 is: s1 ═ Δ RGB · Rem; wherein Δ RGB is a difference between a maximum value and a minimum value of the RGB input data, and Rem is the remainder.
In one possible embodiment, the magnitude relationship between one color component in the RGB input data and one parameter in the RGB parameter set, and the magnitude relationship between one color component in the RGB input data and one parameter in the candidate parameter set are compared, respectively.
In one possible embodiment, the second calculation module 330 calculates a hue interval index value, which is the sum of the quotient Q and a hue constant, wherein the hue constant is determined by the magnitude relationship.
In a possible implementation manner, the second calculating module 330 selects one parameter from the candidate parameter set as the saturation coefficient according to the magnitude relationship.
In a possible embodiment, when the hue interval index value Indx is greater than or equal to the maximum number of hue intervals, the adjustment module 340 subtracts the maximum number of hue intervals from the hue interval index value Indx; when the tone interval index value Indx is smaller than the maximum number of tone intervals, the adjustment module 340 keeps the tone interval index value Indx unchanged.
In one possible embodiment, the adjustment module 340 calculates RGB adjustment data, which includes the second parameter p1A third parameter p2A fourth parameter p3And a fifth parameter RGBmaxWherein:
p1=(2n1·RGBmax-△RGB·S)·2n2·V;
p2=(2n3·V-S·Sx)·2n4·V;
p3=[RGBmin·S·2n5+S·Sx-2n6·RGBmax·(Sat-128)]·2n7v (when S.gtoreq.128);
p3=[RGBmin·S·2n5+S·Sx+2n6·RGBmax·(128-Sat)]·2n7v (when S < 128);
wherein n 1-n 7 are integers, RGBmaxThe maximum value is △ RGB, S is the saturation adjustment value Sat, V is the luminance adjustment value V, and Sx is the saturation coefficient.
In a possible implementation manner, the adjustment module 340 uses the hue interval index value Indx as the index value of the RGB adjustment data, and selects the second p of the index values1The third p2Fourth p3And fifth RGBmaxAs the values of the 3 color components R, G and B of the RGB output data.
The electronic device 400 shown in fig. 4 is a device that can perform the color adjustment method in the above-described embodiment. The electronic device 400 comprises a bus 401, a processor 402, a memory 403, a display device 404, and optionally the electronic device 400 may further comprise an input device 405, a radio frequency circuit 406, a communication device 407, a sensor device 408, an audio device 409, and a power device 410. The electronic device 400 may be a communication device such as a mobile phone, a portable computer, etc. The processor 402 and the memory 403 are communicatively coupled to each other, and there is a high-speed data transmission connection, which may be implemented by a bus 401 that communicatively connects the processor 402 and the memory 403, respectively, where the bus 401 may be an axi (advanced eXtensible interface) bus protocol or other bus protocols. The processor 402 may be a Central Processing Unit (CPU) that runs software programs and/or instructions stored in the memory 403 to perform various functions of the electronic device 400, and the CPU may be a CPU based on the X86 architecture, an ARM architecture, and a core-a architecture. The Processor 402 may also be an Application Processor (AP) and/or an Image Signal Processor (ISP). The Memory 403 may include a volatile Memory, such as a Random Access Memory (RAM), a non-volatile Memory, such as a flash Memory (flash Memory), a hard disk or a Solid-State Drive (SSD), or a combination of the above memories. The Display device 404 is used to output visible text, graphics, video, and any combination thereof, and the Display device 404 may be an LCD (Liquid Crystal Display) or an LPD (Lighting Power Density). A user may enter commands and information into the electronic device 400, such as image data or video stream data of the color to be adjusted, through the input device 405, where the input device 405 may be a mouse, a keyboard, a scanner or a camera, etc. The radio frequency circuit 406 is used for receiving and transmitting electromagnetic waves, converting electrical signals into electromagnetic waves, or converting electromagnetic waves into electrical signals, and communicating with a communication network or other communication devices through electromagnetic waves. The communication module 407 is configured to process communication data, such as communication data represented by an electrical signal converted from an electromagnetic wave received by the radio frequency circuit 406. Sensor device 408 includes one or more sensors for receiving external environmental stimuli and providing physical responses, e.g., sensor device 408 may include a distance sensor configured to detect the presence of an object in the vicinity; sensor device 408 may also include a light sensor, an acceleration sensor, a temperature sensor, and the like. The audio device 409 is used for inputting or outputting audio signals, for example, the audio device 409 may include a microphone for receiving external audio signals. The power device 410 is used to provide power to the various devices/circuits/modules described above, and the power device 410 may include a power management system, as well as one or more power sources.
In one embodiment, image data is written to memory 403 via bus 401 via input device 405, where in memory 403 the image data is of the RGB color space. Parameters such as a hue adjustment value, a saturation adjustment value, and a brightness adjustment value may be input through the input device 405 or may be read from the memory 403. The processor 402 reads the image data in the memory 403 through the bus 401, and reads instructions that can execute the color adjustment method as in all embodiments of the present application, and performs color adjustment on the image data according to the instructions. The color-adjusted image data may be saved in the memory 403 or displayed on the display device 404 in the form of an image.
The steps of a method or algorithm described in connection with the disclosure herein may be embodied in hardware or in software instructions executed by a processor. The software instructions may consist of corresponding software modules that may be stored in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. Of course, the storage medium may also be integral to the processor. The processor and the storage medium may reside in an ASIC. Additionally, the ASIC may reside in a data receiving device and/or a data transmitting device. Of course, the processor and the storage medium may reside as discrete components in a data receiving device and/or a data transmitting device.
Those skilled in the art will recognize that in one or more of the examples described above, the functions described herein may be implemented in hardware, software, firmware, or any combination thereof. When implemented in software, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
The above-mentioned embodiments, objects, technical solutions and advantages of the present application are further described in detail, it should be understood that the above-mentioned embodiments are only examples of the present application, and are not intended to limit the scope of the present application, and any modifications, equivalent substitutions, improvements and the like made on the basis of the technical solutions of the present application should be included in the scope of the present application.

Claims (24)

  1. A color adjustment method of RGB data, comprising:
    acquiring RGB input data, a hue adjustment value, a saturation adjustment value and a brightness adjustment value;
    calculating a first hue interval corresponding to the hue adjustment value;
    determining a second hue interval corresponding to the RGB output data according to the RGB input data and the first hue interval;
    respectively adjusting the saturation of the RGB input data by using the saturation adjustment value, adjusting the brightness of the RGB input data by using the brightness adjustment value to obtain RGB adjustment data, and selecting the RGB output data from the RGB adjustment data according to the second color interval;
    and displaying the RGB output data.
  2. The color adjustment method according to claim 1, wherein the step of calculating the first hue interval corresponding to the hue adjustment value comprises:
    calculating a quotient and a remainder of the color tone adjustment value divided by a divisor, wherein the quotient represents a first color tone interval corresponding to the color tone adjustment value, the remainder represents a color tone variation amount of the color tone adjustment value in the adjusted color tone interval of the RGB input data, and the divisor is 2nWherein n is an integer.
  3. The color adjustment method according to claim 1 or 2, wherein the step of calculating the first hue interval corresponding to the hue adjustment value further comprises:
    and when the hue adjustment value is larger than or equal to a hue threshold value, subtracting the hue threshold value from the hue adjustment value, otherwise keeping the hue adjustment value unchanged, wherein the hue threshold value is the integral power of the maximum hue interval number multiplied by 2.
  4. The color adjustment method according to claim 2 or 3, wherein the step of determining a second hue interval corresponding to the RGB output data according to the RGB input data and the first hue interval comprises:
    calculating an RGB parameter set from the RGB input data;
    performing linear calculation on the remainder and one or more parameters in the RGB parameter set to obtain an alternative parameter set;
    and determining a second hue interval corresponding to the RGB output data according to the RGB input data and the RGB parameter set and the size relationship between the RGB input data and the parameters in the alternative parameter set.
  5. The color adjustment method of claim 4, wherein the step of calculating an RGB parameter set from the RGB input data comprises:
    calculating a maximum value and a minimum value in the RGB input data;
    calculating a difference between the maximum value and the minimum value;
    calculating a sub-pixel difference value, wherein the sub-pixel difference value is an absolute value of the difference value of every two color components in the RGB input data.
  6. The color adjustment method according to claim 4 or 5, wherein the alternative parameter set includes a first parameter S1, and the calculation expression of the first parameter S1 is:
    S1=△RGB·Rem;
    wherein Δ RGB is a difference between a maximum value and a minimum value of the RGB input data, and Rem is the remainder.
  7. The color adjustment method according to any one of claims 4 to 6, wherein the step of determining the second hue interval corresponding to the RGB output data according to the magnitude relationship between the RGB input data and the RGB parameter set and between the RGB input data and the parameters in the candidate parameter set comprises:
    comparing a color component in the RGB input data with a parameter in the RGB parameter set, and comparing a magnitude relationship between a color component in the RGB input data and a parameter in the candidate parameter set, respectively;
    and selecting one parameter from the candidate parameter set as a saturation coefficient according to the size relation.
  8. The color adjustment method according to any one of claims 4 to 7, wherein the step of determining a second hue interval corresponding to RGB output data according to the RGB input data and the first hue interval further comprises:
    and calculating a hue interval index value which is the sum of the quotient and a hue constant, wherein the hue constant is determined by the size relation.
  9. The color adjustment method of claim 8, wherein the RGB adjustment data comprises:
    second parameter p1A third parameter p2A fourth parameter p3And a fifth parameter RGBmaxWherein:
    p1=(2n1·RGBmax-△RGB·S)·2n2·V;
    p2=(2n3·V-S·Sx)·2n4·V;
    p3=[RGBmin·S·2n5+S·Sx-2n6·RGBmax·(Sat-128)]·2n7v (when S.gtoreq.128);
    p3=[RGBmin·S·2n5+S·Sx+2n6·RGBmax·(128-Sat)]·2n7v (when S < 128);
    wherein n 1-n 7 are integers, RGBmaxAnd △ RGB is the difference value between the maximum value and the minimum value, S is the saturation adjustment value, V is the brightness adjustment value, and Sx is the saturation coefficient.
  10. The color adjustment method of claim 9, wherein the step of selecting RGB output data from the RGB adjustment data according to the second color gamut comprises:
    and selecting 3 parameters in the RGB adjustment data as the RGB output data according to the hue interval index value.
  11. The color adjustment method according to any one of claims 7 to 10, wherein said step of selecting said RGB output data from said RGB adjustment input data according to said second color gamut further comprises, before said step of selecting said RGB output data from said RGB adjustment input data according to said second color gamut:
    and when the hue interval index value is greater than or equal to the maximum hue interval number, subtracting the maximum hue interval number from the hue interval index value, and otherwise, keeping the hue interval index value unchanged.
  12. An apparatus for color adjustment of RGB data, comprising:
    an acquisition module that acquires RGB input data, a hue adjustment value, a saturation adjustment value, and a brightness adjustment value;
    the first calculation module calculates a first hue interval corresponding to the hue adjustment value;
    the second calculation module determines a second hue interval corresponding to the RGB output data according to the RGB input data and the first hue interval;
    the adjusting module is used for adjusting the saturation of the RGB input data by using the saturation adjusting value and adjusting the brightness of the RGB input data by using the brightness adjusting value to obtain RGB adjusting data, and selecting the RGB output data from the RGB adjusting data according to the second color interval;
    a display module that displays the RGB output data.
  13. The color adjustment apparatus of claim 12, wherein the first computing module computing the first hue interval corresponding to the hue adjustment value comprises:
    calculating a quotient and a remainder of the hue adjustment value divided by a divisor, wherein the quotient represents a first quotient corresponding to the hue adjustment valueA hue interval, wherein the remainder represents a hue change amount of the adjusted hue interval of the RGB input data by the hue adjustment value, and the divisor is 2nWherein n is an integer.
  14. The color adjustment method according to claim 12 or 13, wherein the first calculation module, before calculating the first hue interval corresponding to the hue adjustment value, is further configured to:
    and when the hue adjustment value is larger than or equal to a hue threshold value, subtracting the hue threshold value from the hue adjustment value, otherwise keeping the hue adjustment value unchanged, wherein the threshold value is the integral power of the maximum hue interval number multiplied by 2.
  15. The color adjustment apparatus of claim 13 or 14, wherein the second computing module determining a second hue interval corresponding to RGB output data according to the RGB input data and the first hue interval comprises:
    calculating an RGB parameter set from the RGB input data;
    performing linear calculation on the remainder and one or more parameters in the RGB parameter set to obtain an alternative parameter set;
    and determining a second hue interval corresponding to the RGB output data according to the RGB input data and the RGB parameter set and the size relationship between the RGB input data and the parameters in the alternative parameter set.
  16. The color adjustment apparatus of claim 15, wherein the second calculation module calculating an RGB parameter set from the RGB input data comprises:
    calculating a maximum value and a minimum value in the RGB input data;
    calculating a difference between the maximum value and the minimum value;
    calculating a sub-pixel difference value, wherein the sub-pixel difference value is an absolute value of the difference value of every two color components in the RGB input data.
  17. The color adjustment apparatus of claim 15 or 16, wherein the alternative parameter set includes a first parameter S1, and the computational expression of the first parameter S1 is:
    S1=△RGB·Rem;
    wherein Δ RGB is a difference between a maximum value and a minimum value of the RGB input data, and Rem is the remainder.
  18. The color adjustment apparatus of any of claims 15-17, wherein the second computing module determines the second hue interval corresponding to the RGB output data according to the magnitude relationship between the RGB input data and the RGB parameter set and between the RGB input data and the parameters in the candidate parameter set comprises:
    comparing a color component in the RGB input data with a parameter in the RGB parameter set, and comparing a magnitude relationship between a color component in the RGB input data and a parameter in the candidate parameter set, respectively;
    and selecting one parameter from the candidate parameter set as a saturation coefficient according to the size relation.
  19. The color adjustment apparatus according to any one of claims 15 to 18, wherein the second calculation module is further configured to:
    and calculating a hue interval index value which is the sum of the quotient and a hue constant, wherein the hue constant is determined by the size relation.
  20. The color adjustment apparatus of claim 19, wherein the RGB adjustment data comprises:
    second parameter p1A third parameter p2A fourth parameter p3And a fifth parameter RGBmaxWherein:
    p1=(2n1·RGBmax-△RGB·S)·2n2·V;
    p2=(2n3·V-S·Sx)·2n4·V;
    p3=[RGBmin·S·2n5+S·Sx-2n6·RGBmax·(Sat-128)]·2n7v (when S.gtoreq.128);
    p3=[RGBmin·S·2n5+S·Sx+2n6·RGBmax·(128-Sat)]·2n7v (when S < 128);
    wherein n 1-n 6 are integers, RGBmaxAnd △ RGB is the difference value between the maximum value and the minimum value, S is the saturation adjustment value, V is the brightness adjustment value, and Sx is the saturation coefficient.
  21. The color adjustment apparatus of claim 20, wherein said adjustment module selects RGB output data from said RGB adjustment data based on said second color gamut comprises:
    and selecting 3 parameters in the RGB adjustment data as the RGB output data according to the hue interval index value.
  22. The color adjustment apparatus of any of claims 18-21, wherein before the adjustment module selects the RGB output data from the RGB adjustment input data based on the second color interval, the adjustment module is further configured to:
    and when the hue interval index value is greater than or equal to the maximum hue interval number, subtracting the maximum hue interval number from the hue interval index value, and otherwise, keeping the hue interval index value unchanged.
  23. An apparatus for color adjustment of RGB data, comprising:
    a memory for storing computer instructions;
    a processor communicatively coupled to the memory, wherein the computer instructions configure the processor and are configured to perform the color adjustment method of any of claims 1 to 11.
  24. A computer-readable storage medium storing a computer program which is read by one or more processors and which, when executed, implements the color adjustment method of any one of claims 1 to 11.
CN201880086830.7A 2018-06-27 2018-06-27 Color adjustment method of RGB data Active CN111615714B (en)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2018/093105 WO2020000255A1 (en) 2018-06-27 2018-06-27 Rgb data color adjustment method

Publications (2)

Publication Number Publication Date
CN111615714A true CN111615714A (en) 2020-09-01
CN111615714B CN111615714B (en) 2023-12-15

Family

ID=68985566

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201880086830.7A Active CN111615714B (en) 2018-06-27 2018-06-27 Color adjustment method of RGB data

Country Status (2)

Country Link
CN (1) CN111615714B (en)
WO (1) WO2020000255A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112288661A (en) * 2020-12-28 2021-01-29 成都索贝数码科技股份有限公司 Image color correction method

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114663548A (en) * 2022-02-16 2022-06-24 广东时谛智能科技有限公司 Method, system, equipment and storage medium for changing color of image or image area

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030063145A1 (en) * 2001-10-01 2003-04-03 Takashi Fujita Image processing method and apparatus, storage medium and program
CN102446345A (en) * 2010-09-30 2012-05-09 株式会社理光 Method, device and system for carrying out color enhancement on whiteboard colored image
CN105100762A (en) * 2015-07-17 2015-11-25 敦泰电子有限公司 Image processing method and image processing apparatus
CN107862657A (en) * 2017-10-31 2018-03-30 广东欧珀移动通信有限公司 Image processing method, device, computer equipment and computer-readable recording medium
CN108024104A (en) * 2017-12-12 2018-05-11 上海顺久电子科技有限公司 The method and display device that a kind of high dynamic range images to input are handled

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101742340B (en) * 2010-02-08 2012-05-30 腾讯科技(深圳)有限公司 Method and device for optimizing and editing image
CN103339944B (en) * 2011-01-31 2016-09-07 马维尔国际贸易有限公司 Color monitor performs the system and method that the color of pixel adjusts
US9129445B2 (en) * 2012-03-14 2015-09-08 Dolby Laboratories Licensing Corporation Efficient tone-mapping of high-bit-depth video to low-bit-depth display

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030063145A1 (en) * 2001-10-01 2003-04-03 Takashi Fujita Image processing method and apparatus, storage medium and program
CN102446345A (en) * 2010-09-30 2012-05-09 株式会社理光 Method, device and system for carrying out color enhancement on whiteboard colored image
CN105100762A (en) * 2015-07-17 2015-11-25 敦泰电子有限公司 Image processing method and image processing apparatus
CN107862657A (en) * 2017-10-31 2018-03-30 广东欧珀移动通信有限公司 Image processing method, device, computer equipment and computer-readable recording medium
CN108024104A (en) * 2017-12-12 2018-05-11 上海顺久电子科技有限公司 The method and display device that a kind of high dynamic range images to input are handled

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112288661A (en) * 2020-12-28 2021-01-29 成都索贝数码科技股份有限公司 Image color correction method

Also Published As

Publication number Publication date
CN111615714B (en) 2023-12-15
WO2020000255A1 (en) 2020-01-02

Similar Documents

Publication Publication Date Title
US8325198B2 (en) Color gamut mapping and brightness enhancement for mobile displays
US8452094B2 (en) Real-time image generator
US10783837B2 (en) Driving method and driving device of display device, and related device
WO2019238071A1 (en) Colour gamut conversion method, colour gamut converter, display apparatus, image signal conversion method, computer device, and non-transitory storage medium
US11288783B2 (en) Method and system for image enhancement
CN107564493B (en) Color gamut compression method and device and display equipment
TW201410005A (en) Image processing method and image processing apparatus
CN111626967A (en) Image enhancement method, image enhancement device, computer device and readable storage medium
CN113507598A (en) Video picture display method, device, terminal and storage medium
KR101113483B1 (en) Apparatus for enhancing visibility of color image
CN111615714B (en) Color adjustment method of RGB data
US20140092116A1 (en) Wide dynamic range display
KR20190000811A (en) Method for tone adapting an image to a target peak luminance lt of a target display device
JP2008011286A (en) Image processing program and image processor
TWI523500B (en) Dynamic range compression method for image and image processing device
EP4372730A1 (en) Image enhancement method and apparatus, computer device, and storage medium
CN115775215A (en) Image processing method, image processing device, electronic equipment and storage medium
CN112534466A (en) Directional scaling system and method
CN115862534A (en) Color correction method, color correction device, electronic device and storage medium
US9852531B2 (en) Electronic apparatus and method for controlling the same
CN114418896A (en) Image optimization method, device, equipment and storage medium
JP4632100B2 (en) Image processing apparatus, image processing method, recording medium, and program
CN109417616B (en) Method and apparatus for image processing
US20180102108A1 (en) Image processing apparatus and image processing method
CN114566131B (en) Display brightness control method and device and display lookup table acquisition method and device

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