Disclosure of Invention
In view of the above problems, the present invention provides a three-dimensional lookup table generation method, apparatus, display device and computer storage medium to improve the accuracy of color mapping.
In order to achieve the purpose, the invention adopts the following technical scheme:
a three-dimensional lookup table generation method comprises the following steps:
generating a target value of a target color according to the RGB value of the target color and the color gamut coordinate of a display screen;
displaying the target color in the display screen to obtain a test value of the target color;
calculating the offset of the target color when the target color is displayed in the display screen according to the target value and the test value;
and establishing a three-dimensional lookup table of the target color according to the test value and the offset so as to perform color gamut mapping by using the three-dimensional lookup table when the target color is displayed.
Preferably, the method for generating a three-dimensional lookup table further includes:
displaying the target color according to the three-dimensional lookup table, and obtaining the test value of the target color again;
when the remeasured test value is determined to be inconsistent with the corresponding target value, acquiring a new offset to update the three-dimensional lookup table;
and after the three-dimensional lookup table is updated, returning to displaying the target color according to the three-dimensional lookup table.
Preferably, the method for generating a three-dimensional lookup table further includes:
and when the re-measured test value is determined to be consistent with the corresponding target value, finishing acquiring the new offset.
Preferably, in the method for generating a three-dimensional lookup table, the "establishing a three-dimensional lookup table of the target color according to the test value and the offset" includes:
establishing a normalized RGB color model, and acquiring a color gamut range formula of the target color according to the RGB color model;
and importing the test value and the offset after the normalization processing into the color gamut range formula, and establishing the three-dimensional lookup table.
The invention also provides a device for generating the three-dimensional lookup table, which comprises:
the target value generation module is used for generating a target value of the target color according to the RGB value of the target color and the color gamut coordinate of the display screen;
the test value acquisition module is used for displaying the target color in the display screen to obtain a test value of the target color;
the offset calculation module is used for calculating the offset of the target color when the target color is displayed in the display screen according to the target value and the test value;
and the lookup table establishing module is used for establishing a three-dimensional lookup table of the target color according to the test value and the offset so as to carry out color gamut mapping by using the three-dimensional lookup table when the target color is displayed.
Preferably, in the three-dimensional lookup table generating device, the test value obtaining module is further configured to display the target color according to the three-dimensional lookup table, and obtain the test value of the target color again;
the three-dimensional lookup table generation apparatus further includes:
the offset adjusting module is used for obtaining a new offset to update the three-dimensional lookup table when the remeasured test value is determined to be inconsistent with the corresponding target value;
and the test returning module is used for returning to displaying the target color according to the three-dimensional lookup table after the three-dimensional lookup table is updated.
Preferably, the three-dimensional lookup table generating apparatus further includes:
and the end updating module is used for ending the acquisition of the new offset when the re-measured test value is determined to be consistent with the corresponding target value.
Preferably, in the three-dimensional lookup table generating device, the lookup table creating module includes:
the normalization unit is used for establishing a normalized RGB color model and acquiring a color gamut range formula of the target color according to the RGB color model;
and the lookup table establishing unit is used for importing the test value and the offset after the normalization processing into the color gamut range formula and establishing the three-dimensional lookup table.
The invention also provides a display device, which comprises a memory and a processor, wherein the memory is used for storing the computer program, and the processor runs the computer program to enable the display device to execute the three-dimensional lookup table generation method.
The present invention also provides a computer storage medium storing a computer program which, when executed by a processor, implements the three-dimensional lookup table generation method.
The invention provides a three-dimensional lookup table generation method, which comprises the following steps: generating a target value of a target color according to the RGB value of the target color and the color gamut coordinate of a display screen; displaying the target color in the display screen to obtain a test value of the target color; calculating the offset of the target color when the target color is displayed in the display screen according to the target value and the test value; and establishing a three-dimensional lookup table of the target color according to the test value and the offset so as to perform color gamut mapping by using the three-dimensional lookup table when the target color is displayed. The three-dimensional lookup table generation method can establish the three-dimensional lookup table according to the test value and the offset of the target color, the three-dimensional lookup table is more accurate compared with the method for mapping the target color of the display screen by using the fixed three-dimensional lookup table, and the target color can be more accurately mapped by changing and correcting the offset subsequently.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments.
The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without making any creative effort, shall fall within the protection scope of the present invention.
Hereinafter, the terms "including", "having", and their derivatives, which may be used in various embodiments of the present invention, are only intended to indicate specific features, numbers, steps, operations, elements, components, or combinations of the foregoing, and should not be construed as first excluding the existence of, or adding to, one or more other features, numbers, steps, operations, elements, components, or combinations of the foregoing.
Furthermore, the terms "first," "second," "third," and the like are used solely to distinguish one from another and are not to be construed as indicating or implying relative importance.
Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which various embodiments of the present invention belong. The terms (such as those defined in commonly used dictionaries) should be interpreted as having a meaning that is consistent with their contextual meaning in the relevant art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein in various embodiments of the present invention.
Example 1
Fig. 1 is a schematic flow chart of a method for generating a three-dimensional lookup table according to embodiment 1 of the present invention, where the method includes the following steps:
step S11: and generating a target value of the target color according to the RGB value of the target color and the color gamut coordinate of the display screen.
In the embodiment of the present invention, the three-dimensional lookup table generation method may be applied to an electronic device with a high color gamut screen, for example, may be applied to a display screen of a high definition television, and when color gamuts of display screens produced by different television manufacturers are different, that is, when a color gamut of a signal source received by the display screen is not completely consistent with a color gamut of the display screen, a correct color gamut mapping value may be looked up through the three-dimensional lookup table, so as to ensure that the color gamut of the signal source may be correctly mapped on the display screen.
In the embodiment of the present invention, before generating the three-dimensional lookup table, a preset number of target colors need to be established, where the preset number of target colors is used for comparing with colors actually output by the display screen, so as to obtain an offset of the output colors of the display screen, and as the number of the target colors is larger, the color gamut distinguishing precision of the colors of the display screen is higher, and as the color gamut mapping accuracy of the subsequently generated three-dimensional lookup table is higher, which is not limited herein. For example, 18 target colors, Rs, Gs, and Bs, which are RGB values of the target color, may be established, and the RGB values are converted into target values of the corresponding target colors according to the color gamut coordinates of the display screen, where the target values are expressed by three-dimensional coordinates, which are Xs, Ys, and Zs, respectively.
That is, the invention can convert the RGB value into the three-dimensional space color value, and the color value is represented by the three-dimensional space point coordinates Xs, Ys and Zs, thereby simplifying the workload of image analysis and processing in the color gamut mapping process and improving the display quality of the display screen. The principle of this method is similar to HIS (Hue, Saturation and lightness) two-dimensional color model in the industry today. The specific calculation formula for converting RGB into HIS coordinates is as follows:
r, G, B represents the RGB values of red, green, and blue, respectively.
Compared with HIS two-dimensional coordinate transformation, the three-dimensional coordinate can further reduce the workload of image analysis and processing.
In the embodiment of the present invention, the above 18 target colors are selected from the color gamut map according to 6 primary colors rgbmy (red, green, blue, cyan, magenta, and yellow), and the following table shows 18 target colors and corresponding RGB values:
| target
|
R
|
G
|
B
|
| dark skin
|
115
|
82
|
68
|
| light skin
|
195
|
145
|
28
|
| blue sky
|
93
|
123
|
157
|
| foliage
|
91
|
108
|
65
|
| blue flower
|
130
|
129
|
75
|
| bluish green
|
98
|
191
|
171
|
| Orange
|
220
|
123
|
46
|
| purplish blue
|
72
|
92
|
168
|
| moderate red
|
194
|
84
|
79
|
| Purple
|
91
|
59
|
104
|
| yellow green
|
161
|
189
|
62
|
| orange yellow
|
229
|
161
|
40
|
| Blue
|
42
|
63
|
147
|
| Green
|
72
|
149
|
72
|
| Red
|
175
|
50
|
57
|
| Yellow
|
238
|
200
|
22
|
| magenta
|
188
|
84
|
150
|
| Cyan
|
0
|
137
|
166 |
the three values Rs, Gs, and Bs of the 18 target colors are RGB values randomly selected from the color gamut map, so as to better cover the actual output color gamut of the display screen, and to test the offset of the color gamut in the display screen.
Step S12: and displaying the target color in the display screen to obtain a test value of the target color.
In the embodiment of the invention, after the target color is established and the target value of the target color output in the display screen is calculated, the target color is displayed in the display screen, and then the actual output test value of the target color in the display screen is measured and obtained. The corresponding test value is also expressed by three-dimensional space point coordinates Xt, Yt, Zt, specifically, the actual color gamut coordinate or RGB value of the target color displayed in the display screen can be obtained by using a CA-S410 color analyzer, then the color gamut coordinate or RGB value is converted into the three-dimensional space point coordinates Xt, Yt, Zt for expression by using a coordinate conversion algorithm, for example, one end of the CA-S410 color analyzer is connected to a computer device with an application program installed thereon, the other end is provided with a photosensitive device to measure the display screen, the measurement data is generated into an EXCEL file on the computer device by the application program, and the EXCEL file is input into the code of the display screen after being sorted.
In the embodiment of the present invention, an algorithm or an application program for converting color coordinates may be provided in the electronic device having the display screen, and after the target color is established and the RGB value of the target color is obtained, the RGB value may be converted into the three-dimensional color coordinates Xs, Ys, and Zs, and when the actual color gamut coordinate or the RGB value of the target color tested by the color analyzer is obtained, the RGB value is also converted into the corresponding three-dimensional color coordinates Xt, Yt, and Zt. Target values and test values for the target color are illustrated in the following table:
step S13: and calculating the offset of the target color when the target color is displayed in the display screen according to the target value and the test value.
In the embodiment of the present invention, after obtaining the target value and the test value of the target color, the offset amount of the target color at the time of display can be calculated by the difference value, and the offset amounts are expressed by three-dimensional color coordinates, which are Xoffset, Yoffset, and Zoffset, respectively, where Xoffset is Xs-Xt, Yoffset is Ys-Yt, and Zoffset is Zs-Zt.
The red offset in the above table is (0.32,0.78,0.06), Xoffset — Xs-Xt-58.56-58.24-0.32, yoffset-Ys-Yt-34.32-33.54-0.78, and Zoffset-Zs-Zt-13.35-0.06. When the display screen displays the corresponding color of the RGB value, the compensation of color output can be carried out according to the corresponding offset, thereby accurately outputting the red color on the display screen. And, when color output of the source signal is performed in the display apparatus, color mapping output can be performed according to the three-dimensional color coordinates, thereby reducing the workload of image analysis, color compensation, and processing.
Step S14: and establishing a three-dimensional lookup table of the target color according to the test value and the offset so as to perform color gamut mapping by using the three-dimensional lookup table when the target color is displayed.
In the embodiment of the invention, the three-dimensional lookup table can be established in the display equipment according to the obtained test value and the offset, and when the target color is displayed again, the display equipment can perform color gamut mapping compensation by using the offset according to the three-dimensional lookup table, so that more accurate color mapping is obtained. For example, the test values and the offsets of the 18 target colors can be recorded in a three-dimensional lookup table, and the offsets of three coordinates in the three-dimensional lookup table can be continuously changed to correct the target color output. By continuously correcting the offset, a more accurate color mapping can be obtained compared to a fixed three-dimensional look-up table in the display device.
As shown in fig. 2, a schematic flow chart for establishing a three-dimensional lookup table according to a test value and an offset according to embodiment 1 of the present invention includes the following steps:
step S21: and establishing a normalized RGB color model, and acquiring a color gamut range formula of the target color according to the RGB color model.
In the embodiment of the present invention, as shown in the RGB color model shown in fig. 3, XYZ respectively corresponds to RGB, that is, corresponds to red, green and blue, and for fixed intervals in X, Y and Z in the RGB color model, the value ranges after normalization are both 0 to 1, then the corresponding relationship of the corresponding color in the model can be obtained, for example, the corresponding relationship of six primary colors is as follows:
red: ((X +1), Y, Z); yellow: ((X +1), (Y +1), Z); green: (X, (Y +1), Z); cyan: (X, (Y +1), (Z + 1)); blue color: (X, Y, (Z + 1)); deep red: ((X +1), Y, (Z + 1)).
In the embodiment of the present invention, the X, Y and the Z-axis variation in the RGB color model are respectively dx, dy, and dz, and the color gamut range formula of each color can be obtained according to the correspondence relationship of the colors in the model, for example, the color gamut range formula of red is: (X +1) × (1-dx)) (Y × (1-dy)) (Z (1-dz)), so that, in the same way, the gamut range formula for the 18 target colors in the normalized RGB color model can be obtained.
Step S22: and importing the test value and the offset after the normalization processing into the color gamut range formula, and establishing the three-dimensional lookup table.
In the embodiment of the present invention, when the color gamut of a color is reduced to a point, (dx, dy, dz) is the (X, Y, Z) value in the current RGB color model, that is, the normalized test value and the offset may be introduced into the color gamut formula, and the offset of the color is corrected to obtain a new color gamut formula, that is, a three-dimensional lookup table of the color. For example, the color gamut range formula for red described above, obtains a new color gamut range for red after importing the test values and the offset: (X +1) ((1- (Xoffset + Xt)) (Y × (1- (Yoffset + Yt))) (Z (1- (Zoffset + Zt))), and the coordinate values of the corresponding red normalized RGB color model are (X ', Y', Z '), X' ═ X +1) ((1- (Xoffset + Xt)), Y '═ Y ((1- (Yoffset + Yt)), Z' ═ Z (1- (Zoffset + Zt), where Xt, Yt, Zt are known test values, and Xoffset is corrected by testing, so that a three-dimensional lookup table of red can be obtained.
Example 2
Fig. 4 is a schematic flowchart of a method for generating a three-dimensional lookup table according to embodiment 2 of the present invention, where the method includes the following steps:
step S41: and generating a target value of the target color according to the RGB value of the target color and the color gamut coordinate of the display screen.
The detailed description of this step is identical to the step S11, and is not repeated here.
Step S42: and displaying the target color in the display screen to obtain a test value of the target color.
The detailed description of this step is identical to the step S12, and is not repeated here.
Step S43: and calculating the offset of the target color when the target color is displayed in the display screen according to the target value and the test value.
The detailed description of this step is identical to the step S13, and is not repeated here.
Step S44: and establishing a three-dimensional lookup table of the target color according to the test value and the offset so as to perform color gamut mapping by using the three-dimensional lookup table when the target color is displayed.
The detailed description of this step is identical to the step S14, and is not repeated here.
Step S45: and displaying the target color according to the three-dimensional lookup table, and obtaining the test value of the target color again.
Step S46: and when the remeasured test value is determined to be inconsistent with the corresponding target value, acquiring a new offset to update the three-dimensional lookup table.
Step S47: and after the three-dimensional lookup table is updated, returning to displaying the target color according to the three-dimensional lookup table.
In the embodiment of the invention, in order to test the mapping accuracy of the three-dimensional lookup table about the target color, the target color can be mapped and displayed according to the three-dimensional lookup table, the test value of the target color is obtained again, the new test value is compared with the target value, a new offset is obtained when the test value is inconsistent with the target value, and the three-dimensional lookup table with the optimal target color is obtained until the test value is consistent with the target value.
Fig. 5 is a schematic flow chart of another three-dimensional lookup table generation method provided in embodiment 2 of the present invention, where the method further includes the following steps:
step S48: and when the re-measured test value is determined to be consistent with the corresponding target value, finishing acquiring the new offset.
In the embodiment of the invention, after the three-dimensional lookup table is continuously updated and the obtained test value is consistent with the target value, the display of the target color by using the updated three-dimensional lookup table can be finished, the calculation of the offset can be finished, and the continuous updating of the three-dimensional lookup table of the target color can be finished. Or a preset number of times can be set, and after the three-dimensional lookup table of the preset number of times is updated, the updating of the three-dimensional lookup table can be stopped, so that endless loop is avoided.
Example 3
Fig. 6 is a schematic structural diagram of a three-dimensional lookup table generation apparatus according to embodiment 3 of the present invention.
The three-dimensional lookup table generation apparatus 600 includes:
a target value generation module 610, configured to generate a target value of a target color according to an RGB value of the target color and a color gamut coordinate of a display screen;
a test value obtaining module 620, configured to display the target color on the display screen, and obtain a test value of the target color;
an offset calculating module 630, configured to calculate, according to the target value and the test value, an offset of the target color when the target color is displayed on the display screen;
a look-up table establishing module 640, configured to establish a three-dimensional look-up table of the target color according to the test value and the offset, so as to perform color gamut mapping by using the three-dimensional look-up table when displaying the target color.
In this embodiment of the present invention, the test value obtaining module 620 is further configured to display the target color according to the three-dimensional lookup table, and obtain the test value of the target color again;
as shown in fig. 7, the three-dimensional lookup table generating apparatus 600 further includes:
an offset adjustment module 650, configured to obtain a new offset to update the three-dimensional lookup table when it is determined that the re-measured test value is inconsistent with the corresponding target value;
and the test returning module 660 is configured to return to displaying the target color according to the three-dimensional lookup table after the three-dimensional lookup table is updated.
And an ending updating module 670, configured to end obtaining the new offset when it is determined that the re-measured test value is consistent with the corresponding target value.
As shown in fig. 8, the lookup table establishing module 640 includes:
the normalization unit 641 is configured to establish a normalized RGB color model, and obtain a color gamut range formula of the target color according to the RGB color model;
the lookup table establishing unit 642 is configured to introduce the normalized test value and the offset into the color gamut range formula, and establish the three-dimensional lookup table.
In the embodiment of the present invention, for more detailed functional description of each module and each unit, reference may be made to contents of corresponding parts in the foregoing embodiment, which are not described herein again.
In addition, the invention also provides a display device which can comprise a smart phone, a tablet computer, a vehicle-mounted computer, an intelligent wearable device and the like. The display device comprises a memory and a processor, wherein the memory can be used for storing a computer program, and the processor executes the computer program, so that the display device executes the functions of the method or the modules in the three-dimensional lookup table generation device.
The memory may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function (such as a sound display function, an image display function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the display device, and the like. Further, the memory may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The embodiment also provides a computer storage medium for storing a computer program used in the display device.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative and, for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, each functional module or unit in each embodiment of the present invention may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention or a part of the technical solution that contributes to the prior art in essence can be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a smart phone, a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.