Color lookup table generation method and color correction method
By dynamically adjusting the sampling step length according to the uniformity of the color change in the display color space when generating 3DLUT, the problem of color correction accuracy and poor effect caused by the fixed sampling step length in the prior art is solved, and more efficient color correction is achieved.
Patent Information
- Application Number
- CN202311419002.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-27
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2043-10-27
AI Technical Summary
When generating 3DLUTs, the sampling step is fixed, which cannot effectively reflect the uniformity of the color change in the display color space, resulting in poor color calibration accuracy and effect.
By dividing the color range of the display screen into multiple color intervals, the linearity is calculated based on the color value of the sampling point in each interval, and dynamically adjusting the sampling step size according to the linearity, a target color lookup table is generated.
The accuracy and effect of color correction are improved, and the sampling step size is adaptively adjusted, the number of sampling points and accuracy are balanced, sampling time is saved and interpolation error is reduced.
Smart Images

Figure CN117612470B_ABST
Abstract
Description
Technical Field
[0001] One or more embodiments of the present specification relate to the field of electronic display technology, and in particular, to a color lookup table generation method and a color correction method. Background Art
[0002] 3DLUT (3D Look Up Table) is a mapping table that implements direct color mapping. It is widely used in the image color correction process of electronic devices to achieve image enhancement and color calibration. In related technologies, 3DLUT is generally generated by sampling the color space of the display with a fixed step length, and the color calibration accuracy and effect are poor. Summary of the invention
[0003] In order to improve the accuracy and effect of color correction, one or more embodiments of the present specification provide a color lookup table generation method and device, a color correction method and device, an electronic device, and a storage medium.
[0004] In a first aspect of one or more embodiments of this specification, a method for generating a color lookup table is provided, comprising:
[0005] Divide the color range of the display screen into multiple color intervals;
[0006] Sampling each color interval with a preset sampling step size to obtain color values of multiple sampling points corresponding to each color interval;
[0007] Determine the linearity of each color interval based on the color values of a plurality of sampling points corresponding to each color interval, wherein the linearity is used to indicate the uniformity of color change in the color interval;
[0008] Based on the linearity of each color interval, adjusting the sampling step of the color interval, wherein the sampling step of the color interval is positively correlated with the linearity;
[0009] Each color interval is resampled based on the adjusted sampling step size, and a target color lookup table is generated based on the color values of each resampling point.
[0010] In one or more embodiments of the present specification, determining the linearity of each color interval based on the color values of a plurality of sampling points corresponding to each color interval includes:
[0011] For each color interval, obtain the color value of each sampling point in the color interval in the three-dimensional color space;
[0012] For each color direction of the three-dimensional color space, obtain a fitting straight line based on the color values of each sampling point in the color direction, and determine the linearity component of the color interval in the color direction based on the difference between each color value and the fitting straight line;
[0013] The linearity corresponding to the color interval is obtained based on the linearity component of the color interval in each color direction of the three-dimensional color space.
[0014] In one or more implementations of this specification, adjusting the sampling step size of each color interval based on the linearity of the color interval includes:
[0015] For each color interval, determining an adaptive coefficient of a sampling step size according to the linearity of the color interval, wherein the adaptive coefficient is positively correlated with the linearity;
[0016] Based on the product of the adaptive coefficient and the preset sampling step, an adjusted sampling step corresponding to the color interval is obtained.
[0017] In one or more embodiments of the present specification, resampling each color interval based on the adjusted sampling step size and generating a target color lookup table based on the color value of each resampling point includes:
[0018] Resample each color interval based on the adjusted sampling step size to obtain a plurality of resampling points corresponding to each color interval;
[0019] For each resampling point, based on the color value of the resampling point and the standard color value corresponding to the resampling point on the standard image, determine the color difference mapping relationship of the resampling point;
[0020] The target color lookup table is constructed based on the color difference mapping relationship of each resampling point.
[0021] In one or more embodiments of the present specification, determining the linearity component of the color interval in the color direction based on the difference between each color value and the fitting straight line includes:
[0022] Calculating the difference between the color value of each sampling point and the color value of the fitting straight line, and calculating the average value according to the differences of each sampling point to obtain the linearity component of the color interval in the color direction;
[0023] The obtaining the linearity corresponding to the color interval based on the linearity component of the color interval in each color direction of the three-dimensional color space includes:
[0024] An average value is calculated based on the linearity components of the color interval in each color direction of the three-dimensional color space to obtain the linearity corresponding to the color interval.
[0025] In a second aspect of one or more embodiments of this specification, a color correction method is provided, comprising:
[0026] Get the image to be processed;
[0027] The image to be processed is color corrected based on a target color lookup table to obtain a processed target image; the target color lookup table is generated according to the method described in any embodiment of the first aspect.
[0028] According to a third aspect of one or more embodiments of the present specification, a color lookup table generating device is provided, comprising:
[0029] An interval division module, configured to divide the color range of the display screen into a plurality of color intervals;
[0030] A sampling module is configured to sample each color interval with a preset sampling step size to obtain color values of multiple sampling points corresponding to each color interval;
[0031] A linearity evaluation module, configured to determine the linearity of each color interval based on the color values of a plurality of sampling points corresponding to each color interval, wherein the linearity is used to indicate the uniformity of the color change of the color interval;
[0032] A step adjustment module is configured to adjust the sampling step of each color interval based on the linearity of the color interval, wherein the sampling step of the color interval is positively correlated with the linearity;
[0033] The mapping relationship module is configured to resample each color interval based on the adjusted sampling step size, and generate a target color lookup table based on the color value of each resampling point.
[0034] In one or more embodiments of this specification, the linearity evaluation module is configured as follows:
[0035] For each color interval, obtain the color value of each sampling point in the color interval in the three-dimensional color space;
[0036] For each color direction of the three-dimensional color space, obtain a fitting straight line based on the color values of each sampling point in the color direction, and determine the linearity component of the color interval in the color direction based on the difference between each color value and the fitting straight line;
[0037] The linearity corresponding to the color interval is obtained based on the linearity component of the color interval in each color direction of the three-dimensional color space.
[0038] In one or more embodiments of this specification, the step size adjustment module is configured as follows:
[0039] For each color interval, determining an adaptive coefficient of a sampling step size according to the linearity of the color interval, wherein the adaptive coefficient is positively correlated with the linearity;
[0040] Based on the product of the adaptive coefficient and the preset sampling step, an adjusted sampling step corresponding to the color interval is obtained.
[0041] In one or more implementations of this specification, the mapping relationship module is configured as follows:
[0042] Resample each color interval based on the adjusted sampling step size to obtain a plurality of resampling points corresponding to each color interval;
[0043] For each resampling point, based on the color value of the resampling point and the standard color value corresponding to the resampling point on the standard image, determine the color difference mapping relationship of the resampling point;
[0044] The target color lookup table is constructed based on the color difference mapping relationship of each resampling point.
[0045] In one or more embodiments of this specification, the linearity evaluation module is configured as follows:
[0046] Calculating the difference between the color value of each sampling point and the color value of the fitting straight line, and calculating the average value according to the differences of each sampling point to obtain the linearity component of the color interval in the color direction;
[0047] The obtaining the linearity corresponding to the color interval based on the linearity component of the color interval in each color direction of the three-dimensional color space includes:
[0048] An average value is calculated based on the linearity components of the color interval in each color direction of the three-dimensional color space to obtain the linearity corresponding to the color interval.
[0049] In a fourth aspect of one or more embodiments of the present specification, a color correction device is provided, comprising:
[0050] An image acquisition module is configured to acquire an image to be processed;
[0051] The color correction module is configured to perform color correction on the image to be processed based on a target color lookup table to obtain a processed target image; the target color lookup table is generated according to the method described in any embodiment of the first aspect.
[0052] According to a fifth aspect of one or more embodiments of this specification, an electronic device is provided, including:
[0053] Processor; and
[0054] A memory storing computer instructions, wherein the computer instructions are used to enable a processor to execute the method described in any embodiment of the first aspect or the second aspect.
[0055] A sixth aspect of one or more embodiments of this specification provides a storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the method described in any embodiment of the first aspect or the second aspect.
[0056] The color lookup table generation method of one or more embodiments of the present specification divides the color range into multiple color intervals, and calculates the linearity of each color interval by partitioning. The sampling step size of each color interval is adaptively adjusted based on the linearity, which effectively balances the contradiction between too many sampling points being time-consuming and too few sampling points being insufficient in precision. The sampling point distribution of each color interval is adaptively allocated, so that the sampling points are sparser in areas with higher linearity, saving sampling time and improving algorithm efficiency, while the sampling points are denser in areas with lower linearity, reducing the interpolation error in the color calibration process and improving the color calibration accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Figure 1 It is a schematic diagram of an application scenario of LED virtual photography in an exemplary embodiment of this specification.
[0058] Figure 2 is a flowchart of a method for generating a color lookup table in an exemplary embodiment of this specification.
[0059] Figure 3 is a flowchart of a method for generating a color lookup table in an exemplary embodiment of this specification.
[0060] Figure 4 is a schematic diagram of a method for generating a color lookup table in an exemplary embodiment of this specification.
[0061] Figure 5 is a flowchart of a method for generating a color lookup table in an exemplary embodiment of this specification.
[0062] Figure 6 is a flowchart of a method for generating a color lookup table in an exemplary embodiment of this specification.
[0063] Figure 7 is a schematic diagram of a method for generating a color lookup table in an exemplary embodiment of this specification.
[0064] Figure 8 is a flow chart of a color correction method in an exemplary embodiment of the present specification.
[0065] Fig. 9 is a structural block diagram of a color lookup table generating device in an exemplary embodiment of this specification.
[0066] Fig.10 FIG. 1 is a structural block diagram of a color correction device in an exemplary embodiment of the present specification.
[0067] Fig.11 is a structural block diagram of an electronic device in an exemplary embodiment of this specification. DETAILED DESCRIPTION
[0068] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with one or more embodiments of this specification. Instead, they are merely examples of devices and methods consistent with some aspects of one or more embodiments of this specification as detailed in the appended claims.
[0069] It should be noted that: in other implementations, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other implementations, the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other implementations; and multiple steps described in this specification may be combined into a single step for description in other implementations.
[0070] In addition, the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this manual are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0071] LED (Light Emitting Diode) is a semiconductor light-emitting device, which is widely used in screen display, lighting and other fields. LED virtual shooting is an emerging photography technology based on LED display screens, which is mostly used in special effects shooting of TV series and movies.
[0072] In traditional video shooting, the crew needs to set up the actual scene and use a lot of props and lights to create the desired atmosphere and effects. This shooting method is costly, time-consuming, and often limited by external factors such as the location and weather. The emergence of LED virtual shooting technology has brought revolutionary changes to the shooting of movies and TV series.
[0073] The basic principle of LED virtual shooting is to use a high-definition LED screen to simulate the actual scene. By projecting a virtual image on the screen, the camera can capture realistic virtual scenes, realizing the fusion shooting of virtual scenes and real scenes. There is no need to arrange the actual scene, which greatly reduces the cost of shooting. In addition, through LED virtual shooting technology, special effects such as rotation, scaling, and movement can be easily achieved, realizing a more realistic special effect vision.
[0074] For example Figure 1 A schematic diagram of an application scenario of LED virtual photography is shown. Figure 1 As shown, the virtual shooting system includes three physical screens (021, 022, 023), the camera 01 can establish communication connections with the three physical screens (021, 022, 023) respectively, the camera 01 can establish a communication connection with the computing device 03, the camera 01 can control each physical screen to display an identification graphic array and send multiple screen images obtained by image acquisition of each physical screen to the computing device 03, and the computing device 03 can generate and display a screen model according to the multiple screen images sent by the camera 01.
[0075] The physical screen used in the virtual shooting system may be an LED display screen, a liquid crystal display screen, or other types, and may be a curved screen or a flat screen. It should be understood that those skilled in the art can customize the type, quantity, size, resolution, etc. of the physical screen in the virtual shooting system according to actual needs, and the embodiments of the present disclosure are not limited to this. It should be understood that the embodiments of the present disclosure are not limited to the communication connection method between devices.
[0076] The disadvantage of LED virtual photography is that LED screens often have some color difference. In order to achieve high-precision photography, it is necessary to calibrate the color of the LED screen to restore the shooting color to the same as the standard color. At present, the solution for screen color correction is generally to use 3DLUT (3D Look Up Table) for color mapping. 3DLUT is a mapping table that realizes direct color mapping. After the input original color is mapped by 3DLUT, the corrected color data can be obtained. It can be seen that the accuracy of 3DLUT directly affects the color correction accuracy of the display.
[0077] In the related art, the color space of the screen is generally sampled at a fixed step size, and a mapping relationship applied to display color correction is generated according to the difference between the color of the sampling point and the standard color. The mapping relationship is also the corresponding 3DLUT.
[0078] In this process, the selection of sampling points is a factor that must be considered. If the number of sampling points selected is large, for example, if 33-order dense sampling is used, a total of 35,937 points need to be collected. If the sampling interval is 1 second, it will take nearly 10 hours, which is very inefficient. On the contrary, if the number of sampling points selected is small, it is difficult to fully reflect the actual color performance of the screen. For example, if 9-order sampling is used, most colors need to be obtained through interpolation, and interpolation errors will cause a large degree of color distortion.
[0079] More importantly, the inventors discovered through research that in the entire color range (also called color gamut) displayed on the screen, the color of not every area changes linearly and uniformly. Therefore, the traditional sampling scheme based on a fixed step size does not take into account the color characteristics of the screen itself. For example, in color areas with a higher degree of color change uniformity, the number of sampling points is relatively dense, resulting in low efficiency. For color areas with a lower degree of color change uniformity, the number of sampling points is relatively sparse, resulting in large color errors and poor color calibration effects.
[0080] Based on the defects existing in the above-mentioned related technologies, the embodiments of this specification provide a color lookup table generation method and device, a color correction method and device, an electronic device, and a storage medium, which aims to calculate the linearity by partitioning the screen color range, and dynamically adjust the sampling step of each partition based on different linearities, so as to increase the sampling step in the color area with higher linearity of color change, thereby reducing the number of sampling points, and reduce the sampling step in the color area with lower linearity of color change, thereby increasing the number of sampling points. Without increasing the number of sampling points as a whole, the sampling step is reasonably densely adjusted to achieve both efficiency and color calibration accuracy.
[0081] In one or more embodiments of the present specification, a method for generating a color lookup table is provided. The color lookup table is the aforementioned 3DLUT, which is a three-dimensional color mapping table. The basis of color correction is the color lookup table.
[0082] like Figure 2 As shown, in some embodiments, the method for generating a color lookup table exemplified in this specification includes:
[0083] S110, dividing the color range of the display screen into a plurality of color intervals.
[0084] It can be understood that the color range of the screen is also called the color gamut, which refers to the sum of the colors that the screen can display. In the implementation of this specification, the color range of the screen can be divided into multiple small color intervals, so that each color interval includes a part of the color range.
[0085] In the related art, there are many colorimetric modes for representing colors, such as the common RGB color model, CMY color model, HSV color model, CIE1931-XYZ color model, CIE1931-Yxy color model, etc. These color models are all three-dimensional color spaces, that is, they have color expression components in three dimensional directions.
[0086] In the implementation mode of this specification, no matter in which color counting mode, the color range of the screen can be divided into a plurality of color intervals according to a predetermined number. For example, in some implementation modes, the color range of the screen can be evenly divided into n color intervals. For example, in one example, taking a one-dimensional (black and white) color space as an example, the screen color range is 255, which is divided into n color intervals, so that the size of each color interval is 255 / n. The three-dimensional color space is similar, and this specification will not be repeated.
[0087] S120 , sampling each color interval with a preset sampling step length to obtain color values of multiple sampling points corresponding to each color interval.
[0088] In the implementation manner of this specification, the preset sampling step size refers to the default sampling step size, that is, each color interval is sampled with a fixed step size, so that the number of sampling points collected in each color interval should be uniform and consistent.
[0089] For example, still taking the aforementioned one-dimensional color space as an example, the size of each color interval is 255 / n, assuming that the total number of sampling points in the entire color range is k, then the number of sampling points in each color space is k / n, and the preset sampling step is 255 / k. Of course, for a three-dimensional color space, the sampling points are sampled in the three-dimensional direction with a preset sampling step, which can be understood by those skilled in the art, and will not be elaborated in this specification.
[0090] For each sampling point, the point corresponds to a color value, and the representation of the color value varies according to the color mode. However, no matter which color mode is used, the color value of a sampling point can uniquely represent a certain color. For example, taking the RGB color model as an example, the color value of each sampling point can be expressed as (R, G, B), and for another example, taking the CIE1931-XYZ color model as an example, the color value of each sampling point can be expressed as (X, Y, Z). Those skilled in the art can understand this, and this specification will not repeat it.
[0091] S130 : Determine the linearity of each color interval based on the color values of the multiple sampling points corresponding to each color interval.
[0092] It can be understood that through the aforementioned S120 process, the number of sampling points in each color interval is consistent, and the intervals between the sampling points (ie, the sampling step length) are also uniform. In other words, the density of the sampling points in each color interval is consistent.
[0093] However, as described above, it can be seen that for the entire color range of the screen, the colors of not all areas change uniformly. In other words, in the implementation of this specification, the uniformity of color changes in different color intervals is different.
[0094] Based on this, the embodiment of this specification proposes an evaluation parameter - linearity, which is used to represent the uniformity of color changes within a certain color range. It can be understood that the higher the linearity, the more uniform the color changes within the color range, and vice versa, the lower the linearity, the more uneven the color changes within the color range.
[0095] It is also understandable that for areas with relatively uniform color changes, the color error obtained by the linear interpolation algorithm is small and will basically not affect the color correction effect. However, for areas with relatively uneven color changes, the color error obtained by the linear interpolation algorithm will be large, thus greatly affecting the color correction effect.
[0096] It can be further understood that for areas with relatively uniform color changes, the number of sampling points can be reduced to improve calculation efficiency, while for areas with relatively non-uniform color changes, the number of sampling points can be increased to improve color calibration accuracy.
[0097] Based on the above principle, in the implementation of this specification, it is first necessary to calculate the linearity of each color interval. The linearity calculation process needs to rely on the color value of the sampling point. The linearity corresponding to the color interval is determined by the color value difference of the sampling points in the color interval. The process of calculating the linearity of each color interval is described in the implementation below of this specification and will not be described in detail here.
[0098] S140: Based on the linearity of each color interval, adjust the sampling step size of the color interval.
[0099] It can be understood that, given the size of a color interval, increasing the sampling step size within the color interval is equivalent to reducing the number of sampling points within the color interval, so that the sampling points within the color interval are more sparse. Conversely, if the sampling step size within the color interval is reduced, it is equivalent to increasing the number of sampling points within the color interval, so that the sampling points within the color interval are more dense.
[0100] In the implementation mode of this specification, after determining the linearity of each color interval, the sampling step length in the color interval can be adaptively adjusted according to the linearity, thereby adjusting the number of sampling points in the color interval. According to the above, the adjustment rule for the number of sampling points in the color interval should meet the following requirements: the higher the linearity, the fewer the number of sampling points, and thus the larger the sampling step length; the lower the linearity, the more the number of sampling points, and thus the smaller the sampling step length. Therefore, in the implementation mode of this specification, the sampling step length of the color interval is positively correlated with the linearity.
[0101] In the implementation manner of this specification, a functional relationship between linearity and adaptive coefficient can be preset, and the corresponding adaptive coefficient can be calculated based on the functional relationship when the linearity value is given, and then the sampling step of the color interval is dynamically adjusted based on the adaptive coefficient. This is explained below in this specification and will not be described in detail here.
[0102] S150 , resample each color interval based on the adjusted sampling step size, and generate a target color lookup table based on the color value of each resampling point.
[0103] In the implementation manner of this specification, after the sampling step size of each color interval is adjusted, resampling can be performed according to the adjusted sampling step size to obtain new sampling points, and the new sampling points are also the resampling points described in this specification.
[0104] It is understandable that in the implementation of this specification, by adjusting the sampling step size of each color interval, the number of sampling points in different areas of the entire color range is different, that is, the sampling points in areas with lower linearity are denser, while the sampling points in areas with higher linearity are sparser. Without increasing the number of sampling points overall, by adjusting the dense distribution of sampling points, the color calibration accuracy is effectively improved while ensuring the efficiency of the algorithm.
[0105] After obtaining each resampling point, a target color lookup table can be generated based on the color value of the resampled resampling point. For example, in some implementations, the mapping relationship between the display color and the standard color can be determined based on the color value of the resampling point and the standard color value on the standard image. The mapping relationship is also the target color lookup table 3DLUT. This is described in the following implementations of this specification.
[0106] From the above, it can be seen that in the implementation mode of this specification, the linearity is calculated by partitioning the screen color range, and the sampling step size of each color interval is adaptively adjusted based on the linearity, which effectively balances the contradiction between too many sampling points being time-consuming and too few sampling points being insufficiently accurate. The sampling point distribution of each color interval is adaptively allocated, so that the sampling points are more sparse in areas with higher linearity, saving sampling time and improving algorithm efficiency, while the sampling points are denser in areas with lower linearity, reducing the interpolation error in the color calibration process and improving the color calibration accuracy.
[0107] In addition, in the implementation manner of this specification, by detecting the linearity of each color interval, it can also be used to detect and evaluate the screen characteristics, thereby combining the screen characteristic evaluation process with the 3DLUT generation stage, making full use of the linearity results, and improving the detection efficiency.
[0108] like Figure 3 As shown, in some embodiments, in the color lookup table generation method exemplified in this specification, the process of determining linearity based on the color value of the sampling point corresponding to each color interval includes:
[0109] S210 . For each color interval, obtain the color value of each sampling point in the color interval in the three-dimensional color space.
[0110] In the implementation manner of this specification, a color interval is taken as an example to illustrate the process of calculating the linearity corresponding to the color interval.
[0111] Through the aforementioned S120 process, k / n sampling points in the color interval can be collected, each sampling point corresponds to a color value, and the representation method of the color value may vary depending on the color mode. In the following examples of this specification, the color mode will take the CIE1931-XYZ color model as an example, that is, each sampling point has a color value in the three color directions of X, Y, and Z, and the color value of each sampling point is expressed as (X i , Y i , Z i ), i represents the index value of the sampling point, i = 1, 2, 3, ..., k / n.
[0112] S220 , for each color direction in the three-dimensional color space, obtain a fitting straight line based on the color values of each sampling point in the color direction, and determine the linearity component of the color interval in the color direction based on the difference between each color value and the fitting straight line.
[0113] In combination with the above, it can be understood that for a three-dimensional color space, the color directions in three dimensions are considered. For example, taking the CIE1931-XYZ color model as an example, any point in the space has color values in the three color directions of X, Y, and Z. In the implementation manner of this specification, the calculation process in the three color directions is the same, and the following description will only take the color direction X as an example.
[0114] For the color direction X, each sampling point in the color interval has a color value in the X direction. Therefore, the coordinate value corresponding to each sampling point can be obtained based on the index value i of the sampling point and its color value in the X direction, which is expressed as (i, X i ).
[0115] For example Figure 4 As shown in the figure, the horizontal axis represents the index value i of the sampling point, and the vertical axis represents the color value X of each sampling point in the X direction. i For ease of explanation, Figure 4 Only 6 sampling points are shown in FIG. 1 , and those skilled in the art will appreciate that the number of sampling points is not limited thereto.
[0116] exist Figure 4 In the example, each sampling point is a discrete coordinate point in the coordinate system of the figure, so in the implementation of this specification, a one-dimensional curve fitting can be performed according to these discrete coordinate points to obtain a fitting straight line, for example Figure 4 In this example, the fitted straight line is shown as the dotted line in the figure.
[0117] It should be noted that there are many algorithms for one-dimensional curve fitting based on discrete points. Those skilled in the art can undoubtedly understand and fully implement them by referring to relevant technologies, and this specification will not elaborate on them.
[0118] After fitting the straight line, the distance between each sampling point and the straight line represents the discreteness of the sampling point, which reflects the linearity of the color in the X direction. Figure 4 , the difference between the color value of each sampling point in the X direction and the fitting line can be calculated, and then the differences of all sampling points are averaged to obtain the linear component D of the color interval in the X direction. x .
[0119] The above description is based on the X direction in the CIE1931-XYZ color space as an example. The calculation principle for the color directions Y and Z is exactly the same as above. Those skilled in the art can understand and fully implement it by referring to the above. Through the above process, the linearity component D in the X direction can be calculated respectively. x , linear component D in the Y direction y and the linear component D in the X direction z .
[0120] S230 , obtaining a linearity corresponding to the color interval based on a linearity component of the color interval in each color direction of the three-dimensional color space.
[0121] In the implementation mode of this specification, it can be known from the above that the linearity component in each color direction represents the linearity of the color change in that color direction. Therefore, after obtaining the linearity component in each color direction of XYZ, the linearity D obtained by integrating the linearity components in the three directions can represent the linearity of the color change in the entire color range.
[0122] In some implementations, the average value of the linearity component in each color direction may be calculated, and the average value may be used as the linearity corresponding to the color interval, expressed as:
[0123] D=(D x +D y +D z ) / 3 (1)
[0124] The above only takes one color interval as an example to illustrate the process of calculating the linearity D of the color interval. For the n color intervals included in the entire color range, the linearity of each color interval can be obtained by repeating the above method process in sequence, which will not be repeated in this manual.
[0125] After the linearity D of each color interval is calculated, the sampling step of the color interval can be adjusted based on the linearity. Figure 5 Provide explanation.
[0126] like Figure 5 As shown, in some embodiments, in the color lookup table generation method exemplified in this specification, the process of adjusting the sampling step size based on the linearity of the color interval includes:
[0127] S410 : For each color interval, determine an adaptive coefficient of a sampling step size according to the linearity of the color interval.
[0128] S420: Obtain an adjusted sampling step corresponding to the color range based on the product of the adaptive coefficient and the preset sampling step.
[0129] In some implementations of the present specification, the sampling step size may be adjusted by superimposing an adaptive coefficient based on the linearity of each color interval and on the basis of a default preset sampling step size.
[0130] For example, in some implementations, a functional relationship between the linearity and the adaptive coefficient may be preset, in which the adaptive coefficient is positively correlated with the linearity, so that the adjusted sampling step size may be expressed as:
[0131] STEP adapt =f(D)* STEP origi (2)
[0132] In formula (2), STEP adapt represents the adjusted sampling step size, f(D) represents the adaptive coefficient, STEP origi For each color interval, after the linearity D is calculated, it is substituted into the above formula (2) to calculate the adjusted sampling step corresponding to the color interval.
[0133] After completing the adaptive adjustment of the sampling step size of each color interval, the 3DLUT can be generated according to the color value of the resampling point obtained by the adjustment. Figure 6 Provide explanation.
[0134] like Figure 6 As shown, in some implementations, in the color lookup table generation method exemplified in this specification, the process of generating a target color lookup table includes:
[0135] S510 , resample each color interval based on the adjusted sampling step size to obtain a plurality of resampling points corresponding to each color interval.
[0136] In the implementation manner of this specification, after the sampling step size of each color interval is adjusted, new sampling points can be obtained by resampling according to the adjusted sampling step size, that is, the resampling points described in this specification, and each resampling point corresponds to a color value of three dimensions.
[0137] S520: For each resampling point, determine a color mapping relationship of the resampling point based on a color value of the resampling point and a standard color value corresponding to the resampling point on a standard image.
[0138] It can be understood that the standard image refers to a color calibration reference image, and the colors on it are standard colors. In the implementation manner of this specification, the goal of color calibration is to correct the original colors to standard colors, so that the standard color values on the standard image are the target values for color calibration, and the color values of the resampling points are the initial values. Given the initial values and target values, the mapping relationship from the initial values to the target values is the color difference mapping relationship described in this specification, and based on the color difference mapping relationship of each resampling point, a target color lookup table can be constructed, and the target color lookup table is the 3DLUT used for screen color correction.
[0139] As for the specific algorithm process of constructing the target color lookup table, those skilled in the art can understand and fully implement it by referring to the relevant technology, and this specification will not elaborate on it.
[0140] From the above, it can be seen that in the implementation mode of this specification, the linearity is calculated by partitioning the screen color range, and the sampling step size of each color interval is adaptively adjusted based on the linearity, which effectively balances the contradiction between too many sampling points being time-consuming and too few sampling points being insufficiently accurate. The sampling point distribution of each color interval is adaptively allocated, so that the sampling points are more sparse in areas with higher linearity, saving sampling time and improving algorithm efficiency, while the sampling points are denser in areas with lower linearity, reducing the interpolation error in the color calibration process and improving the color calibration accuracy.
[0141] In addition, in the implementation manner of this specification, by detecting the linearity of each color interval, it can also be used to detect and evaluate the screen characteristics, thereby combining the screen characteristic evaluation process with the 3DLUT generation stage, making full use of the linearity results, and improving the detection efficiency.
[0142] Figure 7 The flowchart of the color calibration process in some embodiments of this specification is shown below. Figure 7 The principles of the implementation method of this specification are briefly described.
[0143] See also Figure 7 For example, in the interval division stage, the color range of the screen can be divided into n color intervals, namely color interval 1 to color interval n. In the linearity evaluation stage, the linearity D corresponding to each color interval can be calculated according to the above method process.
[0144] In the step adjustment stage, the sampling step can be adaptively adjusted according to the linearity D of each color interval according to the aforementioned method process. For example, if the linearity of color interval 1 is high, the sampling step can be increased; if the linearity of color interval 2 is low, the sampling step can be reduced; if the linearity of color interval n is moderate, the sampling step can be kept unchanged, etc. Figure 7Only a quantitative explanation of the principle is given in the following. For the specific step size adjustment process, please refer to the aforementioned method steps.
[0145] After adjusting the sampling step size, the target color lookup table, i.e., the target 3DLUT, can be constructed based on the color values of the resampling points obtained by resampling. The target color lookup table can then be stored in the device memory for subsequent color calibration. During the color calibration process, the electronic device can call the target color lookup table to calibrate the image to be displayed. Figure 8 Provide explanation.
[0146] like Figure 8 As shown, in one or more implementations of this specification, a color correction method is provided, including:
[0147] S710: Obtain an image to be processed.
[0148] S720 , performing color correction on the image to be processed based on the target color lookup table to obtain a processed target image.
[0149] In the implementation manner of this specification, combined with the foregoing, it can be understood that the target color lookup table is the color mapping relationship used for color calibration. Therefore, in the color calibration process, after obtaining the image to be processed, the image to be processed can be color corrected according to the target color lookup table to obtain a processed target image.
[0150] The process of color calibration using the target color lookup table is based on the original color value of the image to be processed. By looking up the target color lookup table to obtain the corresponding output color value, the color conversion can be completed, the color calibration process can be realized, and the target image can be obtained.
[0151] It is worth noting that, in theory, for RGB images, each color can have 256 values from 0 to 255, so a total of 256*256*256 data is included. Theoretically, in order to ensure that each color has a corresponding mapping value, the target color lookup table should also include 256*256*256 data, but such a large amount of LUT files is difficult to run on conventional electronic devices, so the aforementioned constructed target color lookup table generally only includes the mapping relationship of some colors. When calibrating the image to be processed, the three-dimensional linear interpolation method can be used so that each color on the image to be processed can find the corresponding output value. Those skilled in the art can undoubtedly understand and fully implement it in combination with relevant technologies, and this specification will not go into details.
[0152] From the above, it can be seen that in the implementation mode of this specification, the linearity is calculated by partitioning the screen color range, and the sampling step size of each color interval is adaptively adjusted based on the linearity, which effectively balances the contradiction between too many sampling points being time-consuming and too few sampling points being insufficiently accurate. The sampling point distribution of each color interval is adaptively allocated, so that the sampling points are more sparse in areas with higher linearity, saving sampling time and improving algorithm efficiency, while the sampling points are denser in areas with lower linearity, reducing the interpolation error in the color calibration process and improving the color calibration accuracy.
[0153] In addition, in the implementation manner of this specification, by detecting the linearity of each color interval, it can also be used to detect and evaluate the screen characteristics, thereby combining the screen characteristic evaluation process with the 3DLUT generation stage, making full use of the linearity results, and improving the detection efficiency.
[0154] In one or more embodiments of this specification, a color lookup table generating device is proposed, such as Fig. 9 As shown, the color lookup table generating device includes:
[0155] The interval division module 10 is configured to divide the color range of the display screen into a plurality of color intervals;
[0156] The sampling module 20 is configured to sample each color interval with a preset sampling step length to obtain color values of multiple sampling points corresponding to each color interval;
[0157] A linearity evaluation module 30 is configured to determine the linearity of each color interval based on the color values of a plurality of sampling points corresponding to each color interval, wherein the linearity is used to indicate the uniformity of the color change of the color interval;
[0158] The step length adjustment module 40 is configured to adjust the sampling step length of each color interval based on the linearity of the color interval, wherein the sampling step length of the color interval is positively correlated with the linearity;
[0159] The mapping relationship module 50 is configured to resample each color interval based on the adjusted sampling step size, and generate a target color lookup table based on the color value of each resampling point.
[0160] In one or more embodiments of the present specification, the linearity evaluation module 30 is configured as follows:
[0161] For each color interval, obtain the color value of each sampling point in the color interval in the three-dimensional color space;
[0162] For each color direction of the three-dimensional color space, obtain a fitting straight line based on the color values of each sampling point in the color direction, and determine the linearity component of the color interval in the color direction based on the difference between each color value and the fitting straight line;
[0163] The linearity corresponding to the color interval is obtained based on the linearity component of the color interval in each color direction of the three-dimensional color space.
[0164] In one or more embodiments of this specification, the step size adjustment module 40 is configured as follows:
[0165] For each color interval, determining an adaptive coefficient of a sampling step size according to the linearity of the color interval, wherein the adaptive coefficient is positively correlated with the linearity;
[0166] Based on the product of the adaptive coefficient and the preset sampling step, an adjusted sampling step corresponding to the color interval is obtained.
[0167] In one or more implementations of this specification, the mapping relationship module 50 is configured as follows:
[0168] Resample each color interval based on the adjusted sampling step size to obtain a plurality of resampling points corresponding to each color interval;
[0169] For each resampling point, based on the color value of the resampling point and the standard color value corresponding to the resampling point on the standard image, determine the color difference mapping relationship of the resampling point;
[0170] The target color lookup table is constructed based on the color difference mapping relationship of each resampling point.
[0171] In one or more embodiments of the present specification, the linearity evaluation module 30 is configured as follows:
[0172] Calculating the difference between the color value of each sampling point and the color value of the fitting straight line, and calculating the average value according to the differences of each sampling point to obtain the linearity component of the color interval in the color direction;
[0173] The obtaining the linearity corresponding to the color interval based on the linearity component of the color interval in each color direction of the three-dimensional color space includes:
[0174] An average value is calculated based on the linearity components of the color interval in each color direction of the three-dimensional color space to obtain the linearity corresponding to the color interval.
[0175] From the above, it can be seen that in the implementation mode of this specification, the linearity is calculated by partitioning the screen color range, and the sampling step size of each color interval is adaptively adjusted based on the linearity, which effectively balances the contradiction between too many sampling points being time-consuming and too few sampling points being insufficiently accurate. The sampling point distribution of each color interval is adaptively allocated, so that the sampling points are more sparse in areas with higher linearity, saving sampling time and improving algorithm efficiency, while the sampling points are denser in areas with lower linearity, reducing the interpolation error in the color calibration process and improving the color calibration accuracy.
[0176] In addition, in the implementation manner of this specification, by detecting the linearity of each color interval, it can also be used to detect and evaluate the screen characteristics, thereby combining the screen characteristic evaluation process with the 3DLUT generation stage, making full use of the linearity results, and improving the detection efficiency.
[0177] In one or more embodiments of this specification, a color correction device is proposed, such as Fig.10 As shown, the color correction device comprises:
[0178] An image acquisition module 60 is configured to acquire an image to be processed;
[0179] The color correction module 70 is configured to perform color correction on the image to be processed based on a target color lookup table to obtain a processed target image; the target color lookup table is generated according to the method described in any embodiment of the first aspect.
[0180] From the above, it can be seen that in the implementation mode of this specification, the linearity is calculated by partitioning the screen color range, and the sampling step size of each color interval is adaptively adjusted based on the linearity, which effectively balances the contradiction between too many sampling points being time-consuming and too few sampling points being insufficiently accurate. The sampling point distribution of each color interval is adaptively allocated, so that the sampling points are more sparse in areas with higher linearity, saving sampling time and improving algorithm efficiency, while the sampling points are denser in areas with lower linearity, reducing the interpolation error in the color calibration process and improving the color calibration accuracy.
[0181] In addition, in the implementation manner of this specification, by detecting the linearity of each color interval, it can also be used to detect and evaluate the screen characteristics, thereby combining the screen characteristic evaluation process with the 3DLUT generation stage, making full use of the linearity results, and improving the detection efficiency.
[0182] In one or more embodiments of this specification, an electronic device is provided, including:
[0183] Processor; and
[0184] A memory stores computer instructions, wherein the computer instructions are used to enable a processor to execute the method described in any of the above embodiments.
[0185] In one or more embodiments of the present specification, a storage medium is proposed, which stores computer instructions, and the computer instructions are used to enable a computer to execute the method described in the above embodiment.
[0186] Fig.11 is a schematic structural diagram of a device provided by an exemplary embodiment. Fig.11 At the hardware level, the device includes a processor 702, an internal bus 704, a network interface 706, a memory 708, and a non-volatile memory 710, and may also include hardware required for other scenarios. One or more embodiments of this specification may be implemented based on software, such as the processor 702 reading the corresponding computer program from the non-volatile memory 710 into the memory 708 and then running it. Of course, in addition to the software implementation, one or more embodiments of this specification do not exclude other implementations, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0187] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver, a game console, a tablet computer, a wearable device or a combination of any of these devices.
[0188] In a typical configuration, a computer includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0189] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0190] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0191] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0192] The above is a description of a specific embodiment of the present specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0193] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "one", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0194] It should be understood that although the terms first, second, third, etc. may be used to describe various information in one or more embodiments of this specification, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0195] The above description is merely a preferred embodiment of one or more embodiments of this specification and is not intended to limit one or more embodiments of this specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of this specification shall be included in the scope of protection of one or more embodiments of this specification.
Claims
1. A method for generating a color lookup table, comprising: Divide the color range of the display screen into multiple color intervals; Sampling each color interval with a preset sampling step size to obtain color values of multiple sampling points corresponding to each color interval; Determine the linearity of each color interval based on the color values of a plurality of sampling points corresponding to each color interval, wherein the linearity is used to indicate the uniformity of color change in the color interval; Based on the linearity of each color interval, adjusting the sampling step of the color interval, wherein the sampling step of the color interval is positively correlated with the linearity; Resample each color interval based on the adjusted sampling step size to obtain a plurality of resampling points corresponding to each color interval; For each resampling point, the color difference mapping relationship of the resampling point is determined based on the color value of the resampling point and the standard color value corresponding to the resampling point on the standard image, and a target color lookup table is constructed based on the color difference mapping relationship of each resampling point.
2. The method according to claim 1, wherein determining the linearity of each color interval based on the color values of a plurality of sampling points corresponding to each color interval comprises: For each color interval, obtain the color value of each sampling point in the color interval in the three-dimensional color space; For each color direction of the three-dimensional color space, obtain a fitting straight line based on the color values of each sampling point in the color direction, and determine the linearity component of the color interval in the color direction based on the difference between each color value and the fitting straight line; The linearity corresponding to the color interval is obtained based on the linearity component of the color interval in each color direction of the three-dimensional color space.
3. The method according to claim 1, wherein adjusting the sampling step of each color interval based on the linearity of the color interval comprises: For each color interval, determining an adaptive coefficient of a sampling step size according to the linearity of the color interval, wherein the adaptive coefficient is positively correlated with the linearity; Based on the product of the adaptive coefficient and the preset sampling step, an adjusted sampling step corresponding to the color interval is obtained.
4. The method according to claim 2, wherein determining the linearity component of the color interval in the color direction based on the difference between each color value and the fitting straight line comprises: Calculating the difference between the color value of each sampling point and the color value of the fitting straight line, and calculating the average value according to the differences of each sampling point to obtain the linearity component of the color interval in the color direction; The obtaining the linearity corresponding to the color interval based on the linearity component of the color interval in each color direction of the three-dimensional color space includes: An average value is calculated based on the linearity components of the color interval in each color direction of the three-dimensional color space to obtain the linearity corresponding to the color interval.
5. A color correction method, comprising: Get the image to be processed; Performing color correction on the image to be processed based on a target color lookup table to obtain a processed target image; The target color lookup table is generated according to the method according to any one of claims 1 to 4.
6. A color lookup table generating device, comprising: An interval division module, configured to divide the color range of the display screen into a plurality of color intervals; A sampling module is configured to sample each color interval with a preset sampling step size to obtain color values of multiple sampling points corresponding to each color interval; A linearity evaluation module, configured to determine the linearity of each color interval based on the color values of a plurality of sampling points corresponding to each color interval, wherein the linearity is used to indicate the uniformity of the color change of the color interval; A step adjustment module is configured to adjust the sampling step of each color interval based on the linearity of the color interval, wherein the sampling step of the color interval is positively correlated with the linearity; The mapping relationship module is configured to resample each color interval based on the adjusted sampling step size to obtain multiple resampling points corresponding to each color interval; for each resampling point, based on the color value of the resampling point and the standard color value corresponding to the resampling point on the standard image, determine the color difference mapping relationship of the resampling point, and construct a target color lookup table based on the color difference mapping relationship of each resampling point.
7. A color correction device, comprising: An image acquisition module is configured to acquire an image to be processed; The color correction module is configured to perform color correction on the image to be processed based on a target color lookup table to obtain a processed target image; the target color lookup table is generated according to the method according to any one of claims 1 to 4.
8. An electronic device comprising: processor; and A memory storing computer instructions, wherein the computer instructions are used to enable a processor to execute the method according to any one of claims 1 to 4, or to execute the method according to claim 5.
9. A storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the method according to any one of claims 1 to 4, or to execute the method according to claim 5.
Citation Information
Patent Citations
Color transformation using non-uniformly sampled multi-dimensional lookup table
US20170061926A1