Color adjusting method and device, equipment and medium
By adjusting the tone and saturation in the LAB color space, the poor imaging effect and debugging difficulties caused by the coupling of tone and saturation in the prior art are solved, and a higher quality color adjustment and a more efficient debugging process are achieved.
Patent Information
- Application Number
- CN202410796408.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-19
- Publication Date
- 2025-07-25
AI Technical Summary
In the prior art, a color adjustment algorithm based on perceived color space is difficult to adjust the hue and saturation individually while keeping the brightness unchanged, resulting in poor imaging effects and increasing debugging difficulties.
The LAB color space is used to obtain grid data, calculate color attributes, adjust the tone and saturation through the preset hue and saturation adjustment lookup table, and correct the three-dimensional lookup table to update.
Decoupling of tone and saturation is achieved, the quality of color adjustment and imaging effect is improved, debugging difficulties are reduced, and debugging efficiency is improved.
Smart Images

Figure CN120378755A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of electronic technologies, and in particular, to a color adjustment method, apparatus, device, and medium. Background Art
[0002] In related technologies, color adjustment algorithms are usually implemented based on a three-dimensional lookup table, and the adjustment process usually includes an offline calibration process and an online interpolation process. At present, the offline calibration process usually adjusts the hue and saturation of different colors based on a perceptual color space. However, since the color and brightness in the perceptual color space are not separated, it is difficult to adjust only the color while keeping the brightness unchanged when adjusting the color, which may lead to poor quality of the adjustment result and thus affect the imaging effect. Summary of the Invention
[0003] The present disclosure provides a color adjustment method, apparatus, device, and medium to at least solve the problem of poor imaging effect in related technologies. The technical solution of the present disclosure is as follows:
[0004] According to a first aspect of an embodiment of the present disclosure, there is provided a color adjustment method, including:
[0005] Obtaining first grid point data of each grid point in the LAB color space;
[0006] Based on the first grid point data of each grid point, calculating a first color attribute of each grid point in the LAB color space; the first color attribute includes at least an original saturation and an original hue;
[0007] Adjusting the original saturation of each grid point based on a preset hue and saturation adjustment lookup table to obtain a first saturation;
[0008] Performing correction processing on the original hue of each grid point to obtain a first hue of each grid point;
[0009] Adjusting the first hue of each grid point based on the preset hue and saturation adjustment lookup table to obtain a second hue;
[0010] Based on the first saturation and the second hue of each grid point, calculating second grid point data of each grid point in the LAB color space;
[0011] Updating an initial three-dimensional lookup table based on the second grid point data of each grid point in the LAB color space.
[0012] In a possible implementation manner, the obtaining first grid point data of each grid point in the LAB color space includes:
[0013] Obtaining grid point data of each grid point in the RGB color space;
[0014] Convert the lattice point data of each of the said lattice points in the RGB color space to obtain the first lattice point data of each of the said lattice points in the LAB color space.
[0015] In a possible implementation manner, calculating the first color attribute of each of the said lattice points in the LAB color space based on the first lattice point data of each of the said lattice points includes:
[0016] For the i-th lattice point, calculate the original hue and original saturation of the i-th lattice point in the LAB color space based on the a component and the b component in the first lattice point data of the i-th lattice point; where i ∈ [1, n], and n is the number of lattice points.
[0017] In a possible implementation manner, the correcting process for the original hue of each of the said lattice points to obtain the first hue of each of the said lattice points includes:
[0018] Determine the hue correction value corresponding to each of the said lattice points based on a preset perceptual color look-up table; where the preset perceptual color look-up table is a two-dimensional table constructed in advance by brightness levels and is used to record the perceptual hue values at different positions on the ab plane;
[0019] Perform a correction process on the original hue of each of the said lattice points based on the hue correction value corresponding to each of the said lattice points to obtain the first hue of each of the said lattice points.
[0020] In a possible implementation manner, calculating the second lattice point data of each of the said lattice points in the LAB color space based on the first saturation and the second hue of each of the said lattice points includes:
[0021] Calculate the a component and the b component of each of the said lattice points in the LAB color space based on the first saturation and the second hue of each of the said lattice points.
[0022] In a possible implementation manner, updating the initial three-dimensional look-up table based on the second lattice point data of each of the said lattice points in the LAB color space includes:
[0023] For the i-th lattice point, convert the second lattice point data of the i-th lattice point and the second lattice point data of a preset number of lattice points adjacent to the i-th lattice point to obtain the third lattice point data of the i-th lattice point and a preset number of lattice points adjacent to the i-th lattice point in the RGB color space;
[0024] Perform Gaussian smoothing processing based on the third lattice point data of the i-th lattice point and the third lattice point data of a preset number of lattice points adjacent to the i-th lattice point; where i ∈ [1, n], and n is the number of lattice points;
[0025] Update the initial three-dimensional lookup table based on the third grid point data of each of the grid points after Gaussian smoothing processing.
[0026] According to the second aspect of the embodiments of the present disclosure, there is provided a color adjustment device based on a three-dimensional lookup table, including:
[0027] A data acquisition module, configured to acquire first grid point data of each grid point in the LAB color space;
[0028] An attribute calculation module, configured to calculate a first color attribute of each grid point in the LAB color space based on the first grid point data of each grid point; the first color attribute includes at least an original saturation and an original hue;
[0029] A first adjustment module, configured to adjust the original saturation of each grid point based on a preset hue and saturation adjustment lookup table to obtain a first saturation;
[0030] A correction processing module, configured to perform correction processing on the original tone of each grid point to obtain a first tone of each grid point;
[0031] A second adjustment module, configured to adjust the first tone of each grid point based on the preset hue and saturation adjustment lookup table to obtain a second tone;
[0032] A data calculation module, configured to calculate second grid point data of each grid point in the LAB color space based on the first saturation and the second tone of each grid point;
[0033] A color adjustment module, configured to update the initial three-dimensional lookup table based on the second grid point data of each grid point in the LAB color space.
[0034] According to the third aspect of the embodiments of the present disclosure, there is provided an electronic device, including:
[0035] A processor;
[0036] A memory for storing executable instructions of the processor;
[0037] Wherein, the processor is configured to execute the instructions to implement the color adjustment method as described in any one of the first aspect.
[0038] According to the fourth aspect of the embodiments of the present disclosure, there is provided a storage medium, when the instructions in the storage medium are executed by a processor of an electronic device, enabling the electronic device to execute the color adjustment method as described in any one of the first aspect.
[0039] According to a fifth aspect of the embodiments of the present disclosure, there is provided a computer program product including a computer program which, when executed by a processor, implements the color adjustment method as described in any one of the first aspect.
[0040] The technical solutions provided by the embodiments of the present disclosure at least bring the following beneficial effects:
[0041] In the embodiments of the present disclosure, first lattice point data of each lattice point in the LAB color space is obtained; based on the first lattice point data of each lattice point, first color attributes of each lattice point in the LAB color space are calculated; the first color attributes at least include an original saturation and an original hue; the original saturation of each lattice point is adjusted based on a preset hue and saturation adjustment look-up table to obtain a first saturation; the original hue of each lattice point is corrected to obtain a first hue of each lattice point; the first hue of each lattice point is adjusted based on the preset hue and saturation adjustment look-up table to obtain a second hue; second lattice point data of each lattice point in the LAB color space is calculated based on the first saturation and the second hue of each lattice point; and an initial three-dimensional look-up table is updated based on the second lattice point data of each lattice point in the LAB color space. In this way, when adjusting colors, the hue after saturation adjustment can be corrected and adjusted respectively, and then the initial three-dimensional look-up table can be updated. In this way, the hue and saturation can be decoupled, and color adjustment can be more conveniently and better realized, thereby improving the adjustment quality and the imaging effect; at the same time, the debugging difficulty can be reduced and the debugging efficiency can be improved.
[0042] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present disclosure, and are used together with the specification to explain the principles of the present disclosure and do not constitute an improper limitation to the present disclosure.
[0044] Figure 1 is a schematic diagram of a color adjustment system based on a three-dimensional look-up table shown in the related art.
[0045] Figure 2 is a flowchart of a color adjustment method shown in an embodiment of the present disclosure.
[0046] Figure 3 is a schematic diagram of a two-dimensional table by brightness shown in an embodiment of the present disclosure.
[0047] Figure 4 is a schematic diagram of a preset perceptual colorimetric look-up table shown in an embodiment of the present disclosure.
[0048] Figure 5 It is a flowchart of a color adjustment method shown in an embodiment of the present disclosure.
[0049] Figure 6 It is a flowchart of a color adjustment method shown in an embodiment of the present disclosure.
[0050] Figure 7 It is a schematic diagram of an equal-luminance cross-section of Rec.709 in the LAB color space shown in an embodiment of the present disclosure.
[0051] Figure 8 It is a block diagram of a color adjustment device shown in an embodiment of the present disclosure.
[0052] Figure 9 It is a block diagram of an electronic device shown in an embodiment of the present disclosure. Detailed implementation manners
[0053] In order to enable those of ordinary skill in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
[0054] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily need to describe a specific order or sequence. It should be understood that such used data may be interchanged under appropriate circumstances so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The implementation manners described in the following exemplary embodiments do not represent all implementation manners consistent with the present disclosure. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0055] As can be seen from the background art, in the related art, in the camera pipeline, the quality of color reproduction is a very critical factor determining the imaging effect. Generally, the color system in the pipeline includes related functions as Figure 1 shown. Among them, the specific functions of each function can be as follows:
[0056] White balance: It can be used to eliminate the influence of the light source color and achieve color constancy.
[0057] Color characterization: It means that since there are differences between the camera response characteristics and the human eye response characteristics, it is necessary to convert the RGB (RGB color mode) values of the camera to the standard display-related RGB values.
[0058] Gamma curve: It can be used for non-linear transformation to compress data to a lower bit width for convenient data transmission.
[0059] Preferred color adjustment: That is, color adjustment, which can be performed according to specific requirements or a certain preference of a group of people. For example, many people prefer a higher saturation effect compared to true color reproduction.
[0060] Color enhancement: This function has an obvious division of labor with the previous preferred color adjustment. Here, color enhancement only specifically processes memory colors such as skin tones, green plants, and blue skies. There needs to be a corresponding detection function inside this functional module, or receive AI (Artificial Intelligence) segmentation results from the outside.
[0061] At present, the preferred color adjustment algorithm (that is, the color adjustment algorithm) is usually implemented based on a three-dimensional lookup table. The color adjustment algorithm based on a three-dimensional lookup table includes two major processes: offline calibration and online interpolation. Online interpolation in hardware generally adopts geometric interpolation methods such as trilinear interpolation or tetrahedral interpolation. Offline calibration generally realizes the adjustment of different color hues and saturations based on a perceptual color space. The color space can be, for example, HSV (HSV color model), HSL (Hue, Saturation, Lightness). Since there is a brightness processing module in the camera pipeline, the preferred color adjustment here only adjusts the color and tries to keep the brightness unchanged. However, because the color and brightness in the perceptual color space are not separated, it is very difficult to only adjust the color and keep the brightness unchanged when adjusting the color, which will lead to poor quality of the adjustment results and thus affect the imaging effect; moreover, since the perceptual color space is not a uniform color space, that is, the hue and saturation are coupled and the hue or saturation cannot be adjusted separately, this will increase the difficulty of debugging and often lead to the inability to achieve the final debugging goal.
[0062] Based on this, the embodiments of the present disclosure provide a color adjustment method, device, equipment, and medium. The color adjustment method can adjust and correct the hue and saturation separately when adjusting the color, and update the three-dimensional lookup table based on the corrected hue and saturation. In this way, the hue and saturation can be decoupled to more conveniently and better achieve color adjustment, thereby improving the adjustment quality and imaging effect; at the same time, it can also reduce the difficulty of debugging and improve the debugging efficiency.
[0063] The following will describe in detail the color adjustment method, device, equipment, and medium provided by the embodiments of the present disclosure with reference to the accompanying drawings.
[0064] Figure 2 It is a flowchart of a color adjustment method shown in the embodiments of the present disclosure. As Figure 2 shown, the color adjustment method may include the following steps.
[0065] In step S201, obtain the first grid point data of each grid point in the LAB color space.
[0066] In the embodiments of the present disclosure, the grid point data of each grid point in the LAB color space can be obtained. Among them, the LAB color space is a color-opponent space, with the dimension L representing brightness, and a and b representing color opponent dimensions, based on the non-linearly compressed CIE XYZ color space coordinates. Exemplarily, the grid point can be a pixel point in the current image frame, and the first grid point data can be the grid point data corresponding to the grid point in the LAB color space, such as data including the L value, a value, b value, etc. of the grid point. As a specific example, obtaining the first grid point data of each grid point in the LAB color space can be obtaining the grid point data such as the L value, a value, b value corresponding to each pixel point in the image frame in the LAB color space.
[0067] In step S202, based on the first grid point data of each grid point, calculate the first color attribute of each grid point in the LAB color space.
[0068] Among them, the first color attribute at least includes the original saturation, or may further include the original hue.
[0069] In the embodiments of the present disclosure, after obtaining the first grid point data of each grid point in the LAB color space, the color attribute of each grid point in the LAB color space, that is, the first color attribute, can be calculated based on the first grid point data of each grid point. The first color attribute can at least include the original saturation and may also include the original hue. Exemplarily, for the grid point x, the hue (i.e., the original hue) and saturation (i.e., the original saturation) of the grid point x in the LAB color space can be calculated based on the L value, a value, b value of the grid point x. It can be understood that the foregoing process can be performed separately for each grid point, so that the original hue and original saturation of each grid point in the LAB color space can be obtained.
[0070] In step S203, adjust the original saturation of each grid point based on a preset hue and saturation adjustment look-up table to obtain the first saturation.
[0071] In an embodiment of the present disclosure, after obtaining the first color attributes of each lattice point in the LAB color space, a preset hue and saturation adjustment lookup table can be obtained. The preset hue and saturation adjustment lookup table can be a three-dimensional lookup table, for example, it can be a two-dimensional lookup table by brightness. The preset hue and saturation adjustment lookup table can store preset hue and saturation adjustment amounts. Then, by looking up the preset hue and saturation adjustment lookup table, the adjustment amount of the original saturation of each lattice point can be determined. Based on the adjustment amount of the original saturation of each lattice point, the original saturation of each lattice point is adjusted to obtain the adjusted saturation of each lattice point, that is, the first saturation.
[0072] Exemplarily, the preset hue and saturation adjustment lookup table can be a pre-constructed two-dimensional table by brightness. As a specific example, the two-dimensional table by brightness can be as Figure 3 shown. The hue range of the abscissa of the table can be [0, 360], the saturation range of the ordinate can be [0, 1], the division method can use a uniform grid, and the number of grids is selected according to the accuracy requirements.
[0073] In step S204, the original hue of each lattice point is corrected to obtain the first hue of each lattice point.
[0074] In an embodiment of the present disclosure, considering that when adjusting the original saturation of a certain lattice point, the original hue of this lattice point will also be affected and thus change. Therefore, after adjusting the original saturation of each lattice point to obtain the first saturation of each lattice point, the original hue of each lattice point needs to be corrected. Exemplarily, the original hue of each lattice point can be obtained. Then, the original hue of each lattice point can be corrected to obtain the corrected hue of each lattice point, that is, the first hue.
[0075] In step S205, based on the preset hue and saturation adjustment lookup table, the first hue of each lattice point is adjusted to obtain the second hue.
[0076] In an embodiment of the present disclosure, after correcting the original hue of each lattice point to obtain the first hue, the first hue of each lattice point can also be adjusted. Exemplarily, a preset hue and saturation adjustment lookup table can be obtained. Then, by looking up the preset hue and saturation adjustment lookup table, the adjustment amount of the first hue of each lattice point can be determined. Based on the adjustment amount of the first hue of each lattice point, the first hue of each lattice point is adjusted to obtain the adjusted hue of each lattice point, that is, the second hue. In this way, through the separate adjustment and separate correction of saturation and hue, the hue and saturation are decoupled.
[0077] In step S206, based on the first saturation and the second hue of each grid point, calculate the second grid point data of each grid point in the LAB color space.
[0078] In the embodiments of the present disclosure, after obtaining the first saturation and the second hue of each grid point, new grid point data corresponding to each grid point in the LAB color space, that is, the second grid point data, can be calculated. Exemplarily, the second grid point data corresponding to each grid point in the LAB color space can be calculated by inverse calculation based on the first saturation and the second hue of each grid point. Exemplarily, for grid point x, based on the corrected first saturation and the second hue of this grid point x, calculate the L value, a value, and b value of this grid point in the LAB color space. It can be understood that the foregoing processing can be performed on each grid point separately. In this way, the L value, a value, and b value of each grid point in the LAB color space can be obtained.
[0079] In step S207, update the initial three-dimensional lookup table based on the second grid point data of each grid point in the LAB color space.
[0080] In the embodiments of the present disclosure, after calculating the second grid point data of each grid point in the LAB color space, the initial three-dimensional lookup table can be updated based on the second grid point data to obtain a new initial three-dimensional lookup table. Exemplarily, based on the calculated new second grid point data of each grid point in the LAB color space, calculate the new hue and saturation corresponding to each grid point, and update the initial three-dimensional lookup table based on the new hue and saturation.
[0081] In the embodiments of the present disclosure, by obtaining the first grid point data of each grid point in the LAB color space; based on the first grid point data of each grid point, calculate the first color attribute of each grid point in the LAB color space; the first color attribute at least includes the original saturation and the original hue; adjust the original saturation of each grid point based on a preset hue and saturation adjustment lookup table to obtain the first saturation; perform correction processing on the original hue of each grid point to obtain the first hue of each grid point; adjust the first hue of each grid point based on the preset hue and saturation adjustment lookup table to obtain the second hue; based on the first saturation and the second hue of each grid point, calculate the second grid point data of each grid point in the LAB color space; update the initial three-dimensional lookup table based on the second grid point data of each grid point in the LAB color space. In this way, when adjusting the color, the hue after saturation adjustment can be corrected and adjusted respectively, and then the initial three-dimensional lookup table can be updated. In this way, the hue and saturation can be decoupled, and color adjustment can be more conveniently and better realized, thereby improving the adjustment quality and the imaging effect; at the same time, the debugging difficulty can be reduced and the debugging efficiency can be improved.
[0082] In a possible implementation manner, the above step of obtaining the first grid point data of each grid point in the LAB color space includes:
[0083] Obtain the grid point data of each grid point in the RGB color space;
[0084] Convert the grid point data of each grid point in the RGB color space to obtain the first grid point data of each grid point in the LAB color space.
[0085] In the embodiments of the present disclosure, when obtaining the first grid point data of each grid point in the LAB color space, the data of each grid point can be obtained first, and the electro-optical data conversion is performed on the data of each grid point through the electro-optical transfer function (EOTF) to obtain the grid point data of each grid point data in the RGB color space. Then, the grid point data of each grid point in the RGB color space can be subjected to conversion processing. For example, with the help of the XYZ color system, the RGB color space can be converted to the XYZ color system, and then the XYZ color system can be converted to the Lab color space. In this way, the first grid point data of each grid point in the LAB color space can be obtained. It can be understood that the RGB color space will provide a corresponding conversion function to implement the conversion from the RGB color space to the LAB color space. In this way, it can provide a data basis for subsequent processing.
[0086] In a possible implementation manner, the above step of calculating the first color attribute of each grid point in the LAB color space based on the first grid point data of each grid point includes:
[0087] For the i-th grid point, calculate the original hue and original saturation of the i-th grid point in the LAB color space based on the a component and the b component in the first grid point data of the i-th grid point; where i ∈ [1, n], and n is the number of grid points.
[0088] In the embodiments of the present disclosure, the first color attribute of each grid point in the LAB color space can be calculated in parallel or serially. Exemplarily, when calculating the first color attribute of each grid point in the LAB color space, the original hue and original saturation of the grid point in the LAB color space can be calculated by combining the a component and the b component in the first grid point data of the grid point. As a specific example, for the i-th grid point, the a component and the b component in the first grid point data of the i-th grid point can be obtained, and the original hue of the i-th grid point in the LAB color space can be calculated by formula (1) based on the a component and the b component, and the original saturation of the i-th grid point in the LAB color space can be calculated by formula (2). Where i ∈ [1, n], and n is the number of grid points. In this way, the accurate calculation of the original hue and the original saturation can be realized.
[0089]
[0090] Among them, hue represents the original hue, a represents the a component in the first grid point data of the i-th grid point, and b represents the b component in the first grid point data of the i-th grid point.
[0091]
[0092]
[0093] Among them, chroma represents chromaticity, a represents the a component in the first grid point data of the i-th grid point, and b represents the b component in the first grid point data of the i-th grid point; chroma-max represents the maximum chromaticity, a max represents the maximum value of the a component in the equal-luminance section in the LAB color space, b max represents the maximum value of the b component in the equal-luminance section in the LAB color space, and saturation represents the original saturation.
[0094] In one possible implementation, the above steps correct the original hue of each grid point to obtain the first hue of each grid point, including:
[0095] Determine the hue correction value corresponding to each grid point based on a preset perceptual color look-up table; among them, the preset perceptual color look-up table is a two-dimensional table constructed in advance by luminance, and is used to record the perceptual hue values at different positions on the ab plane;
[0096] Correct the first hue of each grid point based on the hue correction value corresponding to each grid point to obtain the second hue of each grid point.
[0097] In the embodiments of the present disclosure, the original hue of each grid point can be corrected to achieve the decoupling of hue and saturation. Exemplarily, a preset perceptual color look-up table can be obtained. The preset perceptual color look-up table can be a two-dimensional table constructed in advance by luminance, and is used to record the perceptual hue values at different positions on the ab plane. As a specific example, each two-dimensional table can be as Figure 4 shown, that is, the ab plane is evenly divided, the number of grids is set according to the accuracy requirements, and the range represented by the horizontal and vertical coordinates of the table needs to cover the color gamut of the RGB color space used. The calculation formula for the hue correction value after saturation adjustment of each grid point (i.e., color point) can be seen in formula (3).
[0098]
[0099] Among them, L down represents the luminance value in the lower luminance interval; L upRepresents the brightness value of the upper brightness interval; Δhue1 represents the hue correction value calculated for the lower brightness interval; Δhue2 represents the hue correction value calculated for the upper brightness interval; hue1 饱和度调整前 / hue1 饱和度调整后 / hue2 饱和度调整前 / hue2 饱和度调整后 Represents the perceptual hue value calculated by looking up the table for the corresponding brightness layer, and Δhue represents the hue correction value.
[0100] After that, based on the hue correction value corresponding to each grid point, the original hue of each grid point can be corrected to obtain the first hue of each grid point. Exemplarily, to correct the original hue of each grid point based on the hue correction value corresponding to each grid point, it can be in the form of an offset, directly adding the hue correction value to the original hue to obtain the corrected hue, that is, the first hue. The corresponding hue correction formula can be seen in formula (4).
[0101] hue‘=hue+Δhue (4)
[0102] Wherein, hue‘ represents the corrected first hue, hue represents the original hue before correction, and Δhue represents the hue correction value.
[0103] In a possible implementation manner, the above steps calculate the second grid point data of each grid point in the LAB color space based on the first saturation and the second hue of each grid point, including:
[0104] Based on the first saturation and the second hue of each grid point, calculate the a component and the b component of each grid point in the LAB color space.
[0105] In the embodiments of the present disclosure, when calculating the second grid point data of each grid point in the LAB color space based on the first saturation and the second hue of each grid point, the first saturation and the second hue of each grid point can be obtained first, and the a component and the b component of each grid point in the LAB color space are calculated based on the first saturation and the second hue of each grid point. Exemplarily, for grid point x, the first saturation and the second hue of grid point x can be obtained, and the a component and the b component of grid point x in the LAB color space are calculated through formula (5). It can be understood that the calculation shown in formula (5) can be performed on each grid point in parallel or serially to obtain the a component and the b component of each grid point in the LAB color space.
[0106]
[0107] Wherein, chroma represents the corrected chroma of grid point x, saturation represents the first saturation of grid point x, chroma_max represents the maximum chroma value, and hue represents the second hue.
[0108] In a possible implementation, the above steps update the initial three-dimensional lookup table based on the second lattice point data of each lattice point in the LAB color space, including:
[0109] For the i-th lattice point, convert the second lattice point data of the i-th lattice point and the second lattice point data of a preset number of lattice points adjacent to the i-th lattice point to obtain the third lattice point data of the i-th lattice point and a preset number of lattice points adjacent to the i-th lattice point in the RGB color space;
[0110] Perform Gaussian smoothing based on the third lattice point data of the i-th lattice point and the third lattice point data of a preset number of lattice points adjacent to the i-th lattice point; where i ∈ [1, n], and n is the number of lattice points;
[0111] Update the initial three-dimensional lookup table based on the third lattice point data of each lattice point after Gaussian smoothing.
[0112] In the embodiments of the present disclosure, in order to prevent color jumps from occurring after adjustment, a lattice point smoothing operation can also be performed to ensure the smoothness of the adjustment result, improve the color adjustment quality, and improve the imaging quality; at the same time, considering that the preset hue and saturation adjustment lookup table usually stores RGB values, a color space conversion is also required. Exemplarily, for the i-th lattice point, a preset number of lattice points adjacent to the i-th lattice point can be determined. For example, the preset number can be 6, that is, the six lattice points in the front, back, left, right, up, and down adjacent to the i-th lattice point. Obtain the second lattice point data of the i-th lattice point and the second lattice point data of a preset number of lattice points adjacent to the i-th lattice point, and convert the second lattice point data of the i-th lattice point and the second lattice point data of a preset number of lattice points adjacent to the i-th lattice point to respectively obtain the lattice point data of the i-th lattice point and a preset number of lattice points adjacent to the i-th lattice point in the RGB color space, that is, the third lattice point data. Then, Gaussian smoothing can be performed on the third lattice point data of the i-th lattice point after color space conversion and the third lattice point data of a preset number of lattice points adjacent to the i-th lattice point. For example, Gaussian smoothing can be performed with reference to the third lattice point data of the current i-th lattice point and a total of seven lattice points in the front, back, left, right, up, and down in the three-dimensional space. After that, the initial three-dimensional lookup table can be updated based on the third lattice point data of each lattice point after Gaussian smoothing, so as to perform color adjustment based on the updated preset hue and saturation adjustment lookup table. In this way, the color adjustment quality, imaging quality, and user satisfaction can be further improved.
[0113] To make the color adjustment method provided by the embodiments of the present disclosure clearer, the following will be described with examples. Considering that the LAB color space is an approximately uniform color space, and the L value in it is relatively close to the human eye perception, so it belongs to a color space with separated color and brightness. However, the linearity of the LAB color space is not very good, especially in the blue region, which will cause the hue to change when adjusting the saturation. Therefore, the method provided by the embodiments of the present disclosure can improve the defect of poor linearity of the LAB space, so as to be better applied to the calibration process of the three-dimensional lookup table. Combining Figure 5 , specifically as follows:
[0114] Among them, EOTF (electro-optical transfer function): electro-optical transfer function; OETF (opto-electronic transfer function): opto-electronic transfer function. The preferred color adjustment module (i.e., the color adjustment module) is located in the non-linear region after the gamma function. Therefore, it is necessary to first act on the standard EOTF to transfer to the linear region, and then transfer back to the non-linear region after adjustment. The specific forms of EOTF and OETF are related to the standard RGB color space used, and each standard RGB color space (such as sRGB, BT.709, etc.) will provide the corresponding conversion function.
[0115] Figure 6 is a flowchart of a color adjustment method provided by the embodiments of the present disclosure. Among them, the new hue = the original hue + the hue correction value after saturation adjustment + the hue adjustment amount obtained from the previous look-up table. As Figure 6 shown, it includes the following processing:
[0116] 1. The calculation methods of saturation and hue in the LAB color space, referring to Figure 7 , Figure 7 is a schematic diagram of an equal-brightness cross-section of Rec.709 in the Lab space (L = 10). It can be combined with Figure 7 , where the gamut boundary needs to be calculated in advance, and generally the GBD and other gamut boundary description algorithms are used. Then, the original hue and the original saturation can be calculated.
[0117] 2. Adjust the original saturation of each grid point based on a preset hue and saturation adjustment lookup table, and perform hue correction after adjustment. Since the linearity of the LAB color space is not very good, especially in the blue region, the Rec.709, Rec.2020, and Munsell data points at L = 30.7546 are shown simultaneously. Each curve represents colors with equal perceived hue, but the curve is not a straight line, representing the hue shift of the LAB color space in this region. Therefore, a step of hue correction is required after saturation adjustment to ensure that the hue is consistent before and after saturation adjustment. For example, a two-dimensional table of different luminances can be constructed in advance with the Munsell data set to record the perceived hue values at different positions on the ab plane. Each two-dimensional table can be as Figure 4 shown. The ab plane is evenly divided, and the number of grids is set according to the accuracy requirements. The horizontal and vertical coordinates of the table need to cover the gamut of the RGB space used. The formula for calculating the hue correction value after saturation adjustment for each color point (i.e., grid point) can be as shown in Formula (3), and the hue correction formula can be as shown in Formula (4).
[0118] 3. Adjustment method for the adjusted hue. The adjustment amounts of saturation and hue can be recorded in a two-dimensional table of different luminances to facilitate more flexible color adjustment. The horizontal and vertical coordinates of the two-dimensional table are hue and saturation respectively, as Figure 3 shown. Among them, the hue range of the table's horizontal coordinate is [0, 360], the saturation range of the vertical coordinate is [0, 1], and the division method uses a uniform grid, and the number of grids is selected according to the accuracy requirements. The adjusted saturation is obtained by multiplying the saturation scaling factor by the original saturation. The hue adjustment amount takes the form of an offset and can be directly added to the original hue. Using a method similar to the above embodiment, calculate the hue adjustment amount and saturation scaling factor corresponding to any color.
[0119] 4. Calculate the LAB value inversely. Exemplarily, calculate chroma_max corresponding to the gamut boundary from luminance and hue, and the calculation formulas for a and b can be seen in Formula (5).
[0120] 5. Grid point smoothing operation. To prevent color jumps after adjustment, a grid point smoothing operation can be added. Perform Gaussian smoothing with reference to the current grid point and a total of seven points, namely the front, back, left, right, up, and down of the current grid point in the three-dimensional space.
[0121] In this way, when adjusting colors, the luminance can be ensured to remain unchanged, and at the same time, the hue and saturation are decoupled, which can more conveniently realize the adjustment of color preferences, thereby improving the adjustment quality and imaging effect. At the same time, it reduces the difficulty of debugging and improves the debugging efficiency.
[0122] Based on the same inventive concept, the embodiments of the present disclosure also provide a color adjustment device, as Figure 8 shown, Figure 8is a block diagram of a color adjustment device shown according to an exemplary embodiment. Referring to Figure 8 , the color adjustment device 800 may include:
[0123] A data acquisition module 810, configured to acquire first grid point data of each grid point in the LAB color space;
[0124] An attribute calculation module 820, configured to calculate a first color attribute of each grid point in the LAB color space based on the first grid point data of each grid point; the first color attribute at least includes an original saturation and an original hue;
[0125] A first adjustment module 830, configured to adjust the original saturation of each grid point based on a preset hue and saturation adjustment look-up table to obtain a first saturation;
[0126] A correction processing module 840, configured to perform correction processing on the original hue of each grid point to obtain a first hue of each grid point;
[0127] A second adjustment module 850, configured to adjust the first hue of each grid point based on the preset hue and saturation adjustment look-up table to obtain a second hue;
[0128] A data calculation module 860, configured to calculate second grid point data of each grid point in the LAB color space based on the first saturation and the second hue of each grid point;
[0129] A color adjustment module 870, configured to update an initial three-dimensional look-up table based on the second grid point data of each grid point in the LAB color space.
[0130] In a possible implementation manner, the data acquisition module 810 is configured to:
[0131] Acquire grid point data of each grid point in the RGB color space;
[0132] Convert the grid point data of each grid point in the RGB color space to obtain first grid point data of each grid point in the LAB color space.
[0133] In a possible implementation manner, the attribute calculation module 820 is configured to:
[0134] For the i-th grid point, calculate the original hue and original saturation of the i-th grid point in the LAB color space based on the a component and the b component in the first grid point data of the i-th grid point; where i ∈ [1, n], and n is the number of grid points.
[0135] In a possible implementation manner, the correction processing module 840 is configured to:
[0136] Determine the hue correction value corresponding to each of the grid points based on a preset perceptual color lookup table; wherein, the preset perceptual color lookup table is a two-dimensional table divided by brightness constructed in advance for recording the perceptual hue values at different positions of the ab plane.
[0137] Perform correction processing on the original hue of each of the grid points based on the hue correction value corresponding to each of the grid points to obtain the first hue of each of the grid points.
[0138] In a possible implementation manner, the data calculation module 860 is configured to:
[0139] Calculate the a component and the b component of each of the grid points in the LAB color space based on the first saturation and the second hue of each of the grid points.
[0140] In a possible implementation manner, the color adjustment module 870 is configured to:
[0141] For the i-th grid point, convert the second grid point data of the i-th grid point and the second grid point data of a preset number of grid points adjacent to the i-th grid point to obtain the third grid point data of the i-th grid point and a preset number of grid points adjacent to the i-th grid point in the RGB color space;
[0142] Perform Gaussian smoothing processing based on the third grid point data of the i-th grid point and the third grid point data of a preset number of grid points adjacent to the i-th grid point; wherein, i ∈ [1, n], and n is the number of grid points.
[0143] Update the initial three-dimensional lookup table based on the third grid point data of each of the grid points after Gaussian smoothing processing.
[0144] Regarding the device in the above embodiments, the specific manners in which each module performs operations have been described in detail in the embodiments related to the method, and will not be elaborated here.
[0145] According to the embodiments of the present disclosure, the present disclosure also provides an electronic device, a storage medium, and a computer program product.
[0146] Figure 9FIG. 0 is a schematic block diagram of an exemplary electronic device 900 that may be used to implement embodiments of the present disclosure. The electronic device 900 is intended to represent various forms of digital computers, such as, for example, laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as, for example, personal digital processors, cellular telephones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely exemplary and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0147] As Figure 9 shown, the electronic device 900 includes a computing unit 901 that may perform various appropriate actions and processes in accordance with a computer program stored in a read only memory (ROM) 902 or a computer program loaded from a storage unit 908 into a random access memory (RAM) 903. In the RAM 903, various programs and data required for operation of the device 900 may also be stored. The computing unit 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0148] A plurality of components in the electronic device 900 are connected to the I / O interface 905, including: an input unit 906, such as, for example, a keyboard, a mouse, etc.; an output unit 907, such as, for example, various types of displays, speakers, etc.; a storage unit 908, such as, for example, a magnetic disk, an optical disk, etc.; and a communication unit 909, such as, for example, a network card, a modem, a wireless communication transceiver, etc. The communication unit 909 allows the electronic device 900 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0149] The computing unit 901 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 901 executes the various methods and processes described above, such as the color adjustment method. For example, in some embodiments, the color adjustment method can be implemented as a computer software program that is tangibly embodied in a machine-readable medium, such as the storage unit 908. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 900 via the ROM 902 and / or the communication unit 909. When the computer program is loaded into the RAM 903 and executed by the computing unit 901, one or more steps of the color adjustment method described above can be executed. Alternatively, in other embodiments, the computing unit 901 can be configured to execute the color adjustment method in any other suitable manner (e.g., by means of firmware).
[0150] The various embodiments of the systems and techniques described above in this document can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special or general-purpose programmable processor, receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting the data and instructions to the storage system, the at least one input device, and the at least one output device.
[0151] The program code of the computer program product for implementing the methods of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to the processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the program codes are executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The program codes can be executed entirely on the machine, partially on the machine, as an independent software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0152] In the context of this disclosure, a storage medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. The storage medium can be a machine-readable signal medium or a machine-readable storage medium. The storage medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of the storage medium would include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0153] In order to provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0154] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer having a graphical user interface or a web browser through which the user can interact with an implementation of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected to each other by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), the Internet, and a blockchain network.
[0155] A computer system may include a client and a server. The client and the server are generally far from each other and usually interact via a communication network. The relationship between the client and the server is created by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system, solving the defects of high management difficulty and weak business scalability existing in traditional physical hosts and VPS services ("Virtual Private Server", or simply "VPS"). The server may also be a server of a distributed system or a server combined with a blockchain.
[0156] It should be understood that various forms of the processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution disclosed in this disclosure can be achieved, and no limitation is imposed herein.
[0157] The above specific embodiments do not constitute a limitation on the protection scope of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the protection scope of this disclosure.
Claims
1. A color adjustment method, characterized in that, Including: Obtain the first grid point data of each grid point in the LAB color space; Based on the first grid point data of each of the grid points, calculate the first color attributes of each of the grid points in the LAB color space; The first color attributes include at least the original saturation and the original hue; Adjust the original saturation of each of the grid points based on a preset hue and saturation adjustment lookup table to obtain the first saturation; Perform a correction process on the original hue of each of the grid points to obtain the first hue of each of the grid points; Adjust the first hue of each of the grid points based on the preset hue and saturation adjustment lookup table to obtain the second hue; Based on the first saturation and the second hue of each of the grid points, calculate the second grid point data of each of the grid points in the LAB color space; Update the initial three-dimensional lookup table based on the second grid point data of each of the grid points in the LAB color space.
2. The color adjustment method according to claim 1, wherein The obtaining the first grid point data of each grid point in the LAB color space includes: Obtain the grid point data of each grid point in the RGB color space; Convert the grid point data of each of the grid points in the RGB color space to obtain the first grid point data of each of the grid points in the LAB color space.
3. The color adjustment method according to claim 1, characterized in that, The calculating the first color attributes of each of the grid points in the LAB color space based on the first grid point data of each of the grid points includes: For the i-th grid point, calculate the original hue and the original saturation of the i-th grid point in the LAB color space based on the a component and the b component in the first grid point data of the i-th grid point; where i ∈ [1, n], and n is the number of grid points.
4. The color adjustment method according to claim 1, wherein The performing a correction process on the original hue of each of the grid points to obtain the first hue of each of the grid points includes: Determine the hue correction value corresponding to each of the grid points based on a preset perceptual colorimetric lookup table; where the preset perceptual colorimetric lookup table is a two-dimensional table constructed in advance by luminance, and is used to record the perceptual hue values at different positions on the ab plane; Perform a correction process on the original hue of each of the grid points based on the hue correction value corresponding to each of the grid points to obtain the first hue of each of the grid points.
5. The color adjustment method according to claim 4, characterized in that, The calculating the second grid point data of each of the grid points in the LAB color space based on the first saturation and the second hue of each of the grid points includes: Calculate the a component and the b component of each of the grid points in the LAB color space based on the first saturation and the second hue of each of the grid points.
6. The color adjustment method according to claim 1, wherein The updating the initial three-dimensional lookup table based on the second grid point data of each of the grid points in the LAB color space includes: For the i-th grid point, convert the second grid point data of the i-th grid point and the second grid point data of a preset number of grid points adjacent to the i-th grid point to obtain the third grid point data of the i-th grid point and a preset number of grid points adjacent to the i-th grid point in the RGB color space; Perform Gaussian smoothing processing based on the third grid point data of the i-th grid point and the third grid point data of a preset number of grid points adjacent to the i-th grid point; where i ∈ [1, n], and n is the number of grid points; Update the initial three-dimensional lookup table based on the third grid point data of each of the grid points after Gaussian smoothing processing.
7. A color adjustment device based on a three-dimensional look-up table, characterized in that, Comprising: A data acquisition module, configured to acquire first grid point data of each grid point in the LAB color space; An attribute calculation module, configured to calculate first color attributes of each of the grid points in the LAB color space based on the first grid point data of each of the grid points; The first color attribute at least includes an original saturation; A first adjustment module, configured to adjust the original saturation of each of the grid points based on a preset hue and saturation adjustment lookup table to obtain a first saturation; A correction processing module, configured to perform correction processing on the original hue of each of the grid points to obtain a first hue of each of the grid points; A second adjustment module, configured to adjust the first hue of each of the grid points based on the preset hue and saturation adjustment lookup table to obtain a second hue; A data calculation module, configured to calculate second grid point data of each of the grid points in the LAB color space based on the first saturation and the second hue of each of the grid points; A color adjustment module, configured to update the initial three-dimensional lookup table based on the second grid point data of each of the grid points in the LAB color space.
8. An electronic device, characterized in that, Comprising: A processor; A memory for storing instructions executable by the processor; Wherein, the processor is configured to execute the instructions to implement the color adjustment method according to any one of claims 1 to 6.
9. A storage medium, when the instructions in the storage medium are executed by a processor of an electronic device, enabling the electronic device to execute the color adjustment method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, which when executed by a processor implements the color adjustment method according to any one of claims 1 to 6.
Citation Information
Cited By
Image processing method and device, electronic equipment, chip and medium
CN120747434A