Three-dimensional lookup table construction method, image processing method, device, and storage medium

By interval sampling and setting differential adjustment amplitudes under the target color space, the problem of color correction in the existing technology is solved, and a more refined color correction effect is achieved, and a color fault is reduced.

WO2025179574A1PCT designated stage Publication Date: 2025-09-04WUHAN HAOYIYUAN TECHNOLOGY CO LTD +1
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/079543
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2024-03-01
Publication Date
2025-09-04

AI Technical Summary

Technical Problem

The existing three-dimensional lookup table has the problem of color correction in image color correction, which is prone to color faults.

Method used

Sampling is performed in the target color space, the target sampling points are determined, and differentiated adjustment amplitudes are set for different target sampling points in each channel, and a three-dimensional lookup table is constructed to achieve refined color correction.

Benefits of technology

The color tomography phenomenon in the image after color correction is reduced, and the degree of refinement of color correction and image display effect is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024079543_04092025_PF_FP_ABST
    Figure CN2024079543_04092025_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the embodiments of the present application are a three-dimensional lookup table construction method, an image processing method, a computer program product, a device, and a storage medium. During construction of a three-dimensional lookup table for correcting an initial color in an image into a target color, with respect to different target sampling points needing color correction amongst a plurality of sampling points, adjustment values of the target sampling points in a certain channel can be obtained by adjusting the difference value between a channel value of the target color and a channel value of the initial color in the channel by using different adjustment amplitudes, wherein the adjustment amplitudes of the different target sampling points in a certain channel can be determined on the basis of the proximity between the channel values of the target sampling points and the channel value of the target color in the channel, and / or determined on the basis of the channel values of the target sampling points in the channel. In this way, more accurate and refined three-dimensional lookup tables can be constructed, so as to perform more precise color correction on target images, thereby reducing color banding in corrected images.
Need to check novelty before this filing date? Find Prior Art

Description

Three-dimensional lookup table construction method, image processing method, device and storage medium Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a method for constructing a three-dimensional lookup table, an image processing method, a computer program product, a device, and a storage medium. Background Art

[0002] During the image capture process, various factors, such as lighting conditions and the external environment, may cause color differences in the captured image. Therefore, color correction is required to meet the user's color requirements. Currently, when performing color correction on images, a three-dimensional lookup table (3D-LUT) is usually constructed for image color correction. Based on this 3D lookup table, color correction can be performed on one or more frames of images.

[0003] Currently, when constructing a three-dimensional lookup table, sampling is usually performed at intervals within a certain color space to obtain multiple sampling points. Then, based on the initial color to be corrected and the user's desired target color, the sampling points that require color correction are determined from these multiple sampling points. For all sampling points that require color correction, a uniform adjustment amplitude is currently used to adjust the channel values ​​of these sampling points in each channel to obtain the adjusted channel values ​​of these sampling points in each channel. When using a three-dimensional lookup table constructed in this way to perform color correction on an image, the color correction is not refined enough and is relatively rough, and the corrected image is prone to color discontinuity. Therefore, it is necessary to provide a more refined color correction solution to improve the display effect of the color-corrected image.

[0004] Summary of the Invention

[0005] In view of this, the present application provides a method for constructing a three-dimensional lookup table, an image processing method, a computer program product, a device, and a storage medium.

[0006] According to a first aspect of the present application, a method for constructing a three-dimensional lookup table is provided, the method comprising:

[0007] Obtaining the initial color to be corrected and the target color after correction desired by the user;

[0008] Sampling at intervals within a channel value range of each channel in the target color space to obtain a plurality of sampling points, and determining a target sampling point to be color corrected from the plurality of sampling points;

[0009] Determining, for each channel of the target sampling point in the target color space, an adjustment value for the channel, the adjustment value being obtained by adjusting a difference between the channel values ​​of the target color and the initial color in the channel using an adjustment amplitude for the channel, the adjustment amplitude being determined based on a difference between the channel value of the target sampling point in the channel and the channel value of the target color in the channel and / or the channel value of the target sampling point in the channel;

[0010] A three-dimensional lookup table is constructed based on the original channel values ​​of each channel of the target sampling point in the target color space and the adjustment value, wherein the three-dimensional lookup table is used to perform color correction on the image.

[0011] According to a second aspect of the present application, there is provided an image processing method, the method comprising:

[0012] Acquire a target image to be color corrected;

[0013] Color correction processing is performed on the target image based on a pre-constructed three-dimensional lookup table, wherein the pre-constructed three-dimensional lookup table is constructed based on the method mentioned in the first aspect.

[0014] According to a third aspect of the present application, a computer program product is provided, which includes a computer program. When the computer program is executed by a processor, it can implement the method mentioned in the first aspect and / or the second aspect.

[0015] According to the fourth aspect of the present application, an electronic device is provided, which includes a processor, a memory, and a computer program stored in the memory for execution by the processor. When the processor executes the computer program, it can implement the method mentioned in the first aspect and / or the second aspect above.

[0016] According to a fifth aspect of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method of the first aspect and / or the second aspect can be implemented.

[0017] Using the solution provided by this application, when constructing a three-dimensional lookup table for correcting the initial color in an image to the target color desired by the user, sampling can be performed at intervals in the target color space to obtain multiple sampling points. Then, based on the original channel values ​​of each sampling point in each channel and the adjusted values ​​of each sampling point in each channel, a three-dimensional lookup table for color correction of the image is constructed. In order to achieve refined color correction, for the target sampling points that need to be color corrected among the multiple sampling points, when determining the adjusted values ​​of these target sampling points in each channel, these target sampling points can be differentiated. The adjusted values ​​of different target sampling points in a certain channel can be obtained by adjusting the difference between the channel values ​​of the target color and the initial color in the channel using different adjustment amplitudes. The adjustment amplitude of different target sampling points in a certain channel can be determined based on the proximity of the channel values ​​of the target sampling point and the target color in the channel, and / or based on the channel value of the target sampling point in the channel. In this way, a more refined and accurate three-dimensional lookup table can be constructed, thereby enabling more refined color correction of the target image and reducing color discontinuity in the corrected image.

[0018] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0020] FIG1 is a schematic diagram of a method for constructing a three-dimensional lookup table according to an embodiment of the present application.

[0021] FIG2 is a schematic diagram of an interactive interface for inputting an initial color and a target color according to an embodiment of the present application.

[0022] FIG3 is a schematic diagram of obtaining multiple sampling points by interval sampling according to an embodiment of the present application.

[0023] FIG4 is a schematic diagram of a three-dimensional lookup table according to an embodiment of the present application.

[0024] FIG5 is a schematic diagram of a logical structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0025] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0026] During the image capture process, various factors, such as lighting conditions and the external environment, may cause color differences in the captured image. Therefore, color correction is required to meet the user's color requirements. Currently, when performing color correction on images, a three-dimensional lookup table (3D-LUT) is usually constructed for image color correction. Based on this 3D lookup table, color correction can be performed on one or more frames of images.

[0027] Currently, when constructing a three-dimensional lookup table, sampling is typically performed at intervals within a color space to obtain multiple sampling points. The sampling points that require color correction are then determined from these multiple sampling points based on the initial color to be corrected and the user's desired target color. Currently, for all sampling points requiring color correction, a uniform adjustment amplitude is used to adjust the channel values ​​of these sampling points in each channel, resulting in the adjusted channel values ​​for these sampling points in each channel. Using this method to construct a three-dimensional lookup table for image color correction results in a less refined and coarse color correction, and the corrected image is prone to color discontinuities.

[0028] For example, taking the HSL color space as an example, suppose the user wants to correct the initial color in the image (H = 20°, L = 0.1, S = 0.1) to the target color (H = 30°, L = 0.2, S = 0.2). An easy way to handle this is to sample at intervals in the HSL space to obtain multiple sampling points. Then, from the multiple sampling points, the sampling points that need color correction and the sampling points that do not need color correction can be determined. The sampling points that need color correction can be selected based on actual needs. For example, for each color channel, the sampling points that need color correction can be consistent. For example, the channel values ​​of the three channels H, L, and S meet the following conditions: the sampling points with H∈(20°~30°), L∈(0.1~0.2), and S∈(0.1~0.2) are the sampling points that need color correction, and the remaining sampling points are the sampling points that do not need color correction. For sampling points that do not require color correction, their adjustment values ​​in the H, L, and S channels are set to 0. For sampling points that require color correction, their adjustment values ​​in the H channel are the same, i.e., uniformly increased by 30°-20°=10°. Their adjustment values ​​in the L channel are also the same, i.e., uniformly increased by 0.2-0.1=0.1. Their adjustment values ​​in the S channel are also the same, i.e., uniformly increased by 0.2-0.1=0.1. A three-dimensional lookup table can then be constructed based on the original channel values ​​of each sampling point in the H, L, and S channels, as well as the adjusted channel values ​​of each sampling point in the H, L, and S channels. For each pixel in the image to be color corrected, the channel values ​​of each channel after color correction can be determined by searching the three-dimensional lookup table, thereby completing color correction of the image.

[0029] Obviously, when constructing a three-dimensional lookup table, the color adjustment amplitude is consistent for all sampling points that require color correction, that is, a uniform adjustment value is used. Therefore, when using the above three-dimensional lookup table to color correct an image, it is equivalent to using the same adjustment amplitude to adjust the color of all pixels in the image that require color correction. However, the degree of proximity between the colors of different pixels and the target color is actually different. Using a uniform adjustment amplitude to adjust the color of pixels is relatively rough. Moreover, if a larger adjustment amplitude is used for pixels that are close to the target color, there will be a problem of a color gap between the color-adjusted pixels and the surrounding pixels with similar colors. In addition, if a uniform adjustment amplitude is used to adjust sampling points with different saturation and brightness, it is also easy to cause the image to be overexposed or oversaturated, making the color of the color-corrected image unnatural and resulting in poor color correction effect.

[0030] Based on this, first, the embodiment of the present application provides a method for constructing a three-dimensional lookup table to construct a more accurate and refined three-dimensional lookup table for performing more refined color correction on an image. For example, if the three-dimensional lookup table to be constructed is used to correct the initial color in the image to the target color desired by the user, sampling can be performed at intervals in the target color space to obtain multiple sampling points, and then a three-dimensional lookup table for color correction of the image is constructed based on the original channel value of each sampling point in each channel and the adjustment value of each sampling point in each channel. In order to achieve refined color correction, for the target sampling points that need to be color corrected among the multiple sampling points, when determining the adjustment values ​​of these target sampling points in each channel, these target sampling points can be differentiated. The adjustment values ​​of different target sampling points in a certain channel can be obtained by adjusting the difference between the channel values ​​of the target color and the initial color in the channel using different adjustment amplitudes. The adjustment amplitudes of different target sampling points in a certain channel can be determined based on the closeness of the channel values ​​of the target sampling point and the target color in the channel, and / or based on the channel value of the target sampling point in the channel. For example, if the degree of proximity is large, the adjustment range can be appropriately reduced, or if the channel value of the channel itself is large, the adjustment range can be appropriately reduced, etc. Among them, for different channels, the adjustment range can be flexibly set based on the characteristics of the channel.

[0031] For different target sampling points, the adjustment amplitude can be set differently to construct a three-dimensional lookup table, so that more refined color correction can be performed on the target image and color discontinuity in the corrected image can be reduced.

[0032] The method for constructing a three-dimensional lookup table in the embodiment of the present application can be executed by various electronic devices such as mobile phones, cameras, computers, and cloud servers. For example, in some scenarios, this method can be used in a device with an image acquisition function (such as a camera). After the device acquires the target image, the user can input the initial color to be corrected and the target color after correction desired by the user through the interactive interface of the device, so that the device can automatically construct a three-dimensional lookup table based on the information set by the user, and then use the constructed three-dimensional lookup table to perform color correction on one or more frames of the acquired image. Of course, in some scenarios, the three-dimensional lookup table can also be constructed by devices such as computers and cloud servers. After the device with an image acquisition function (such as a camera) acquires the image, it sends the image to these devices, and these devices perform color correction processing on the image based on the pre-constructed three-dimensional lookup table.

[0033] As shown in FIG1 , the method for constructing the three-dimensional lookup table may include the following steps:

[0034] S102, obtaining an initial color to be corrected and a target color after correction desired by the user;

[0035] In step S102, an initial color to be corrected and a target color after color correction of the initial color desired by the user can be obtained. The initial color can be the color corresponding to a single pixel, that is, a specific color represented by a certain color coordinate, for example, the initial color is (H=20°, L=0.1, S=0.1), or the initial color can be a specified color range, for example, the initial color is a whole color range such as red and green, or the initial color is a color between two color coordinates, for example, (H=20°, L=0.1, S=0.1) to (H=60°, L=0.1, S=0.1), and the target color can be a specific color represented by a certain color coordinate, for example, the target color is (H=60°, L=0.5, S=0.5).

[0036] There are many ways to obtain the initial color and target color. For example, an interactive interface can be provided through which the user can directly input the color coordinates or color coordinate range corresponding to the initial color and the target color. Alternatively, the image to be color corrected can be displayed in the interactive interface, and the user can select an image area or a pixel from the image. The initial color or target color can then be determined based on the color of the image area or pixel selected by the user. Alternatively, a color setting control can be displayed in the interactive interface, and the user can use the color setting control to set the channel value of the initial color or target color in each channel. At the same time, when the user uses the color setting control to set the channel value of each channel, the color currently set by the user can be displayed in a preview window. As shown in Figure 2, for example, a color setting control can be displayed in the interactive interface. For the three channels H, L, and S, the user can adjust the channel value of the three channels H, L, and S by adjusting the adjustment slider in the color setting control. At the same time, the color currently set by the user can be displayed in the preview window so that the user can determine whether the color is the color they want.

[0037] S104, sampling at intervals within the channel value range of each channel in the target color space to obtain a plurality of sampling points, and determining a target sampling point to be color corrected from the plurality of sampling points;

[0038] In step S104, since the three-dimensional lookup table finally constructed needs to cover the pixel points of the entire color space, sampling can be performed at intervals within the channel value range of each channel of the target color space to obtain multiple sampling points. The target color space can be an RGB color space, an HSL color space, an HSV color space, etc. For example, taking the target color space as the HSL color space as an example, for the three channels of H, S, and L, sampling can be performed at intervals within the channel value range of the three channels to obtain multiple sampling points. For example, as shown in Figure 3, for the H channel, its value is 0 to 360°, then a sampling value can be collected every 10° or 5°. For the S and L channels, their values ​​are 0 to 1, then a sampling value can be collected every 0.1 or 0.2. Then, the sampling values ​​collected from the three channels can be combined to obtain multiple sampling points. For example, (H=0°, L=0, S=0) (H=5°, L=0, S=0), (H=10°, L=0, S=0), (H=5°, L=0.1, S=0), (H=5°, L=0, S=0.1), etc. The sampling interval can be flexibly set based on the size of the three-dimensional lookup table to be constructed. For example, if a more precise three-dimensional lookup table is to be constructed, the sampling interval can be set to a smaller size; otherwise, the sampling interval can be set to a larger size.

[0039] Since not all sampling points require color correction, after obtaining multiple sampling points, a target sampling point requiring color correction can be determined from the multiple sampling points. The target sampling point can be determined based on the initial color and the target color set by the user. For example, the target sampling point can be a sampling point whose color is the same as the initial color, or a sampling point whose color is within the color range of the initial color, or a sampling point whose color is closer to the initial color than a preset proximity threshold. The target sampling point can be set based on actual needs.

[0040] S106. Determine, for each channel of the target sampling point in the target color space, an adjustment value of the channel, wherein the adjustment value is obtained by adjusting the difference between the channel values ​​of the target color and the initial color in the channel by using an adjustment amplitude of the channel, wherein the adjustment amplitude is determined based on the difference between the channel values ​​of the target sampling point and the target color in the channel and / or the channel value of the target sampling point in the channel;

[0041] In step S106, after obtaining the target sampling point, an adjustment value for each channel of the target color space can be determined for each target sampling point. For example, if the target color space is an HSL space, an adjustment value for each of the H, S, and L channels of the target sampling point can be determined. The adjusted channel values ​​of the target sampling point in the three channels after color correction can be obtained by adding or subtracting the adjustment value from the original values ​​of the target sampling point in the three channels.

[0042] In the related art, for any channel, the adjustment value for different sampling points is the same, that is, the difference between the target color and the initial color in that channel. This approach cannot achieve precise control and is prone to color discontinuity. In the embodiments of the present application, different adjustment amplitudes can be set for different target sampling points in any channel. The difference between the channel values ​​of the target color and the initial color in that channel is adjusted using this adjustment amplitude to obtain the final adjustment value. For certain channels (e.g., the hue channel in the HSL color space), considering that the channel values ​​of different target sampling points and the target color in that channel vary, if the two are close, the adjustment amplitude can be appropriately reduced; otherwise, it can be increased. Therefore, when determining the adjustment amplitude for different target sampling points in that channel, the difference between the channel values ​​of the target sampling point and the target color in that channel can be combined. For certain channels (e.g., the brightness channel in the HSL space), considering that the brightness of the target sampling point itself is relatively high, using a large adjustment amplitude can easily lead to overexposure. Therefore, the adjustment amplitude can also be set in combination with the channel value of the point in that channel. For example, if the channel value is relatively large, the adjustment amplitude can be set smaller. Of course, for other types of color spaces, such as HSV color space, YUV color space or RGB color space, the adjustment amplitude of each channel can be flexibly set based on the characteristics of the channel. For example, it can be set based on the difference between the channel values ​​of the target sampling point and the target color in the channel, or it can be set based on the channel value of the target sampling point in the channel, or a combination of both.

[0043] In addition, considering that different channels may affect each other, for example, when adjusting the brightness of a target sampling point, if the saturation of the target sampling point is low, a large adjustment range may easily cause overexposure. For another example, saturation and hue may affect each other. Therefore, when determining the adjustment range of the hue (H channel) of the target sampling point, the saturation of the target sampling point can also be considered. Alternatively, saturation also affects brightness to a certain extent. Therefore, when determining the adjustment range of the brightness (L channel) of the target sampling point, the saturation of the target sampling point can also be considered.

[0044] In summary, for any channel, when determining the adjustment amplitude of different target sampling points in the channel, it can be determined in combination with the difference in channel values ​​of the target sampling point and the target color in the channel. Of course, it can also be determined in combination with the channel values ​​of the target sampling point in other channels, or the difference in channel values ​​of the target sampling point and the target color in other channels.

[0045] S108 : Construct a three-dimensional lookup table based on the channel values ​​of each channel of the target sampling point in the target color space and the adjustment value, wherein the three-dimensional lookup table is used to perform color correction on the image.

[0046] In step S108, after determining the adjustment value of each channel of each target sampling point in the target color space, the adjusted channel value of the target sampling point in each channel can be determined based on the original channel value of the target sampling point in each channel and the adjustment value, so that a mapping relationship between the original channel value and the adjusted channel value of the target sampling point can be established, and then a three-dimensional lookup table can be constructed.

[0047] Among them, after obtaining the three-dimensional lookup table, the three-dimensional lookup table can be used to perform color correction on the image. For example, for any image, if you want to correct the above-mentioned initial color in the image to the above-mentioned target color, you can use the three-dimensional lookup table to perform color correction on the image. For example, for any pixel in the image, you can find a sampling point from the three-dimensional lookup table where the original channel value of each channel is the same as the channel value of each channel of the pixel, and then use the adjusted channel value of the sampling point in each channel as the channel value of the pixel after color correction. Of course, if a sampling point is not found from the three-dimensional lookup table where the original channel value of each channel is the same as the channel value of each channel of the pixel, the channel value of the pixel after color correction can be determined by interpolation.

[0048] When the user sets the initial color to be adjusted, the initial color can be the color of a single pixel (i.e., the color represented by a single color coordinate), for example, the initial color is (H=20°, L=0.1, S=0.1). In this case, if color correction is only performed on the pixel points whose color is the initial color, some relatively abrupt pixel areas may appear in the corrected image, affecting the display effect of the image. Therefore, in some embodiments, if the initial color is the color of a single pixel, then when performing color correction, color correction can be performed on all pixel points whose colors are within the interval between the initial color and the target color, that is, the target sampling points are all sampling points whose colors are within the interval between the initial color and the target color.

[0049] In some scenarios, the sampling points that require color correction for each color channel can be the same. For example, if the initial color is (H=20°, L=0.1, S=0.1) and the target color is (H=30°, L=0.2, S=0.2), then for the H, L, and S channels, the sampling points at H∈(20°~30°), S∈(0.1~0.2), and L∈(0.1~0.2) can be used as the sampling points that require color correction for these three channels.

[0050] In some scenarios, in order to achieve fine-grained control, for each channel, the target sampling point where the channel value of the channel needs to be corrected can be set differently based on the characteristics of the channel, that is, the target sampling points of different channels can be inconsistent. For example, taking the HLS color space as an example, since the H channel and the S channel are related to color presentation, the target sampling points for these two channels that need color correction (that is, the channel value of the channel needs to be corrected) can be the sampling points where the channel values ​​of the above two channels are within the range interval formed by the channel values ​​of the initial color and the target color in the corresponding channels. For the L channel, the target sampling points that need color correction can be the sampling points where the channel value of the H channel is within the range interval formed by the channel value of the initial color and the target color in the H channel, and the channel value of the S channel is greater than the first preset threshold and the channel value of the L channel is greater than the second preset threshold. Among them, the first preset threshold and the second preset threshold can be the same or different. The purpose is to ensure that the saturation and brightness of the sampling points that need brightness correction are not too low.

[0051] For example, the initial color is (H = 20°, L = 0.1, S = 0.1), and the target color is (H = 30°, L = 0.2, S = 0.2). For the H and S channels, the sampling points of H∈(20°~30°) and S∈(0.1~0.2) are the sampling points that need to be corrected, and the remaining sampling points are the sampling points that do not need color correction. For the L channel, the sampling points of H∈(20°~30°), S∈(0.065~1), and L∈(0.065~1) are the sampling points that need color correction, and the remaining sampling points are the sampling points that do not need color correction.

[0052] In some embodiments, in order to make the color transition between the image area and the surrounding area that have undergone color correction more natural, for the two channels, H channel and S channel, the target sampling point that needs to be color corrected (i.e., the channel value of the channel needs to be corrected) can be a sampling point where the channel value of the H channel is within the first range interval and the channel value of the S channel is within the second range interval. For the L channel, the target sampling point that needs to be color corrected can be a sampling point where the channel value of the H channel is within the first range interval, the channel value of the S channel is greater than the first preset threshold, and the channel value of the L channel is greater than the second preset threshold. The first range interval includes the range interval formed by the channel values ​​of the initial color and the target color in the H channel. The second range interval is the range interval formed by the channel values ​​of the initial color and the target color in the S channel.

[0053] For example, the initial color is (H=20°, L=0.1, S=0.1), and the target color is (H=30°, L=0.2, S=0.2). For the H channel, the range interval formed by the channel values ​​of the initial color and the target color in the H channel is H∈(20°~30°). In order to make the transition between the correction area and the adjacent area of ​​the corrected image more natural, the first target range interval can be slightly larger than the range interval, that is, the boundary of the interval is expanded outward. For example, it can be H∈(25°~35°). For the S channel, the range interval formed by the channel values ​​of the initial color and the target color in the S channel is S∈(0.1~0.2), so the second target range interval is S∈(0.1~0.2). That is, for the H channel and S channel, the target sampling points that need to be color corrected are the sampling points of H∈(25°~35°) and S∈(0.1~0.2); for the L channel, the target sampling points that need to be color corrected are the sampling points of H∈(25°~35°), S∈(0.065~1) and L∈(0.065~1).

[0054] Of course, in some embodiments, the initial color may also be a specified color range. For example, the initial color is a color in the color range of (H=20°, L=0.1, S=0.1) to (H=60°, L=0.2, S=0.2). When performing color correction, color correction may be performed on the sampling points whose colors are within this color range.

[0055] In some scenarios, the sampling points that require color correction for each color channel can be the same. For example, if the initial color is (H=20°, L=0.1, S=0.1) to (H=60°, L=0.2, S=0.2), then for the H, L, and S channels, the sampling points at H∈(20°~60°), S∈(0.1~0.2), and L∈(0.1~0.2) can be used as the sampling points that require color correction for these three channels.

[0056] In some scenarios, in order to achieve fine-grained control, for each channel, the target sampling points that need to be color corrected (i.e., the channel value of the channel needs to be corrected) can be set differently based on the characteristics of the channel, that is, the target sampling points of different channels can be inconsistent. For example, taking the HLS color space as an example, since the H channel and the S channel are related to color presentation, the target sampling points that need to be color corrected (i.e., the channel value of the channel needs to be corrected) for these two channels can be sampling points where the channel values ​​of the above two channels are located at the color boundaries of the specified color range and are within the range interval formed by the channel values ​​of the corresponding channels. For the L channel, the target sampling points that need to be color corrected can be sampling points where the channel value of the H channel is located at the color boundaries of the specified color range and are within the range interval formed by the channel values ​​of the H channel, and the channel value of the S channel is greater than the first preset threshold and the channel value of the L channel is greater than the second preset threshold. Among them, the first preset threshold and the second preset threshold can be the same or different. The purpose is to ensure that the saturation and brightness of the sampling points that need brightness correction are not too low.

[0057] For example, if the initial color is in the color range of (H=20°, L=0.1, S=0.1) to (H=60°, L=0.2, S=0.2), for the H and S channels, the sampling points with H∈(20°~60°) and S∈(0.1~0.2) are the sampling points that need color correction, and the remaining sampling points are the sampling points that do not need color correction. For the L channel, the sampling points with H∈(20°~60°), S∈(0.065~1), and L∈(0.065~1) are the sampling points that need color correction, and the remaining sampling points are the sampling points that do not need color correction.

[0058] In some embodiments, in order to make the color transition between the image area that has undergone color correction and the surrounding area more natural, for the H channel and the S channel, the target sampling points that need to be color corrected (i.e., the channel values ​​of the channels need to be corrected) can be sampling points where the channel value of the H channel is within a first range interval and the channel value of the S channel is within a second range interval. For the L channel, the target sampling points that need to be color corrected can be sampling points where the channel value of the H channel is within a first range interval, the channel value of the S channel is greater than a first preset threshold, and the channel value of the L channel is greater than a second preset threshold. The first range interval includes the range interval formed by the channel values ​​of the H channel at the color boundaries of the specified color range. The second range interval is the range interval formed by the channel values ​​of the S channel at the color boundaries of the specified color range.

[0059] For example, if the initial color is in the range of (H=30°, L=0.1, S=0.1) to (H=60°, L=0.2, S=0.2), for the H channel, the range of the specified color range formed by the channel values ​​in the H channel is H∈(30°-60°). To ensure a more natural transition between the corrected area and the adjacent area of ​​the corrected image, the first range can be slightly larger than this range, with the boundaries of the range extended slightly. For example, it can be H∈(30°-70°). For the S channel, the range of the channel values ​​of the initial and target colors in the S channel is S∈(0.1-0.2), so the second range is S∈(0.1-0.2). That is, for both the H and S channels, the sampling points with H∈(30°-70°) and S∈(0.1-0.2) require color correction, while the remaining sampling points do not. The channel values ​​of the L channel meet the following conditions: the sampling points of H∈(30°~70°), S∈(0.065~1), and L∈(0.065~1) are the sampling points that need color correction, and the remaining sampling points are the sampling points that do not need color correction.

[0060] In some embodiments, if the initial color is the color of a single pixel, the difference between the channel values ​​of the target color and the initial color in a certain channel is the difference between the channel values ​​of the two color coordinates in the corresponding channel.

[0061] In some embodiments, if the initial color is within a specified color range, the difference between the channel values ​​of the target color and the initial color in a certain channel is the larger of the differences between the channel values ​​of the two boundary colors of the specified color range and the channel value of the target color in the channel. For example, if the specified color range is (H=20°, L=0.1, S=0.1) to (H=40°, L=0.2, S=0.2), and the target color is (H=60°, L=0.2, S=0.2), then for the H channel, the channel values ​​of the two boundary colors in the H channel are 20° and 40°, respectively, and the differences between the two and the channel value of the target color in the H channel are: 60°-20°=40° and 60°-40°=20°, respectively. Therefore, the larger of the two (i.e., 40°) can be selected as the difference between the target color and the initial color in the H channel, and the difference can be adjusted using the adjustment amplitude to obtain the adjusted value of the target sampling point in the H channel. A similar approach is adopted for other channels.

[0062] In some embodiments, when the initial color is the color of a single pixel, if the target color space is an HSL / HSV color space, considering the close relationship between hue and saturation, i.e., the saturation will affect the final color rendering to a certain extent, the adjustment range of each target sampling point in the H channel or S channel in the above color space can be determined by combining the difference between the channel value of the target sampling point in the H channel and the channel value of the target color in the H channel, as well as the channel value of the target sampling point in the S channel.

[0063] In some embodiments, when determining the adjustment range of the H or S channel of the target sampling point based on the difference between the channel value of the target sampling point in the H channel and the channel value of the target color in the H channel, and the channel value of the target sampling point in the S channel, if the difference between the channel value of the target sampling point in the S channel and the channel value of the target color in the S channel is fixed, the adjustment range increases as the difference between the channel value of the target sampling point in the H channel and the channel value of the target color in the H channel increases. That is, the closer the hue of the target sampling point is to the hue of the target color, the smaller the adjustment range, and vice versa.

[0064] In some embodiments, when the adjustment amplitude of the target sampling point H or S channel is determined based on the difference between the channel value of the target sampling point in the H channel and the channel value of the target color in the H channel, and the channel value of the target sampling point in the S channel, when the difference between the channel value of the target sampling point in the H channel and the channel value of the target color in the H channel is fixed, within the value range of the S channel, as the channel value of the target sampling point in the S channel increases, the adjustment amplitude first increases and then decreases.

[0065] Consider that the human eye's color perception is nonlinear—that is, its sensitivity to color changes varies across different saturation ranges. In lower saturation ranges, the human eye is more sensitive to subtle color changes, so smaller adjustments are sufficient to produce noticeable effects. However, as saturation increases, the human eye's sensitivity to color changes gradually decreases. In this case, a larger adjustment is required to produce a noticeable change. However, this adjustment cannot be increased continuously. As the saturation reaches a certain level, excessive adjustments can easily lead to oversaturation, affecting the image's presentation. Therefore, a smaller adjustment is necessary.

[0066] Therefore, increasing the adjustment amplitude first and then decreasing it can better adapt to human color perception characteristics of color changes. Furthermore, increasing the adjustment amplitude first and then decreasing it can also avoid excessively increasing the saturation, which can lead to oversaturated images. Excessive saturation can cause color distortion and unnatural effects, so moderately adjusting the amplitude can maintain the naturalness and balance of the image. For example, taking the saturation (S) value range of 0 to 1 as an example, within the range of 0 to 0.6, as the saturation (i.e., the S channel value) increases, the adjustment amplitude gradually increases. However, within the range of 0.6 to 1, as the saturation increases, the adjustment amplitude gradually decreases.

[0067] In some embodiments, the adjustment amplitude of the target sampling point in the H channel may be equal to the adjustment amplitude of the target sampling point in the S channel.

[0068] In some embodiments, for the case where the initial color is within a specified color range, if the target color space is an HSL / HSV color space, then for the H channel under the above color space, the adjustment value of the target sampling point in the channel can directly be taken as the difference between the channel value of the target color in the H channel and the channel value of the initial color in the H channel, that is, the adjustment value of each target sampling point in the H channel is consistent.

[0069] For the S channel in the aforementioned color space, the adjustment value of the target sampling point in this channel can be set differently, that is, by adjusting the difference between the channel value of the target color in the S channel and the channel value of the initial color in the S channel using an adjustment amplitude. The adjustment amplitude can be determined based on the channel value of the target sampling point in the S channel.

[0070] In some embodiments, as the difference between the channel value of the target sampling point in the S channel and the channel value of the target color in the S channel increases, the adjustment amplitude first increases and then decreases. The specific reasons can be referred to the above explanation. For example, taking the saturation (S) value range of 0 to 1 as an example, in the range of 0 to 0.6, as the saturation (i.e., the S channel value) increases, the adjustment amplitude gradually increases. However, in the range of 0.6 to 1, as the saturation increases, the adjustment amplitude gradually decreases.

[0071] In some embodiments, if the target color space is an HSL color space, for the L channel under the HSL color space, the adjustment amplitude of the target sampling point in the channel can be determined based on the channel value of the target sampling point in the L channel and the channel value of the target sampling point in the S channel.

[0072] In some embodiments, if the target color space is the HSV color space, for the V channel in the HSV color space, the adjustment amplitude of the target sampling point in the channel can be determined based on the channel value of the target sampling point in the V channel and the channel value of the target sampling point in the S channel.

[0073] To better preserve image detail and color information and achieve a more natural and balanced visual experience, the brightness adjustment amplitude can be determined based on both the L or V channel value and the saturation of the target sampling point. Considering the nonlinear nature of the human visual system's perception of brightness, in low-brightness areas, the eye is more sensitive to brightness changes, so a smaller brightness adjustment amplitude is sufficient to produce a noticeable change. In high-brightness areas, however, the eye is less sensitive to brightness changes, so a larger brightness adjustment amplitude is required to produce a noticeable change. In low-saturation areas, where color information is relatively limited and grayscale is predominant, excessive brightness adjustments can result in image distortion or overexposure. Therefore, to preserve color information and detail, a smaller brightness adjustment amplitude can be used in these areas. In high-saturation areas, where colors are rich and saturated, a larger brightness adjustment amplitude can enhance color vividness and contrast. Therefore, a larger brightness adjustment amplitude can be used in these areas.

[0074] Similarly, for areas with higher brightness, if the brightness adjustment range is too large, overexposure problems are likely to occur. Therefore, when the brightness increases to a certain level, the adjustment range can be appropriately reduced. For areas with lower brightness, the adjustment range can be set larger to increase the brightness of the image.

[0075] Therefore, in some embodiments, the higher the saturation of the target sampling point, the larger the adjustment amplitude of the L or V channel. The higher the brightness of the target sampling point, the larger the adjustment amplitude of the L or V channel will be. Generally, in a lower brightness range, the human eye is more sensitive to subtle brightness changes. Therefore, a smaller adjustment amplitude is sufficient to produce a noticeable brightness change. As brightness increases, our sensitivity to brightness changes gradually decreases, requiring a larger adjustment amplitude to produce a noticeable change. However, if the adjustment amplitude is still relatively large after the brightness reaches a certain level, overexposure is likely to occur. Therefore, the brightness can be appropriately reduced.

[0076] This means that the adjustment amplitude of the L or V channel is first increased and then decreased. This adapts to the characteristics of the human eye and avoids over-adjusting the brightness, which can cause the image to appear overexposed or dark. Excessive brightness increases can cause image distortion, while excessive brightness reduction can lead to loss of detail. By first increasing the adjustment amplitude and then decreasing it, you can achieve moderate brightness adjustment while maintaining a natural and balanced image.

[0077] In some embodiments, for sampling points other than the target sampling point among the plurality of sampling points, since these sampling points do not require color correction, the adjusted values ​​for each channel of these sampling points in the target color space are set to 0. A three-dimensional lookup table can then be constructed based on the original channel values ​​and adjusted values ​​for each channel of the target sampling point, and the original channel values ​​and adjusted values ​​for each channel of the other sampling points. As shown in FIG4 , the three-dimensional lookup table can be used to indicate the mapping relationship between the original channel values ​​and the adjusted channel values ​​for each channel of these sampling points.

[0078] Furthermore, the embodiment of the present application also provides an image processing method, which can be executed by various electronic devices such as mobile phones, cameras, computers, cloud servers, etc. The image processing method may include the following steps:

[0079] Acquire a target image to be color corrected;

[0080] Color correction processing is performed on the target image based on a pre-constructed three-dimensional lookup table, wherein the pre-constructed three-dimensional lookup table is constructed based on the method mentioned in any of the above embodiments.

[0081] The specific details of constructing the three-dimensional lookup table can be referred to the description in the above embodiment and will not be repeated here.

[0082] In some embodiments, considering that the HSL / HSV color space better meets the visual needs of the human eye, users typically set both the initial and target colors in this color space. When constructing a three-dimensional lookup table, this is also done in this color space. This means that the constructed three-dimensional lookup table is typically an HSL / HSV lookup table. When using this three-dimensional lookup table to color correct an image in RGB format, if the image is in RGB format, the RGB image can first be converted to HSL / HSV format, then color corrected using the HSL / HSV lookup table, and then the corrected image can be converted back to RGB format. Considering that color correction using a sampling approach requires two format conversions for all pixels in the image, the data processing volume is large and processing efficiency is slow. Considering that scenarios such as live broadcasts require high-speed processing, which requires real-time image color correction, after constructing the three-dimensional lookup table, the HSL / HSV lookup table can be converted to an RGB lookup table, and then color correction can be performed on the RGB image based on this RGB lookup table, improving processing efficiency.

[0083] Among them, the solutions of the above embodiments can be freely combined to obtain new solutions when there is no conflict. Due to space constraints, they will not be listed one by one here.

[0084] In addition, an embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it can implement the method mentioned in any of the above embodiments.

[0085] An embodiment of the present application also provides an electronic device, as shown in Figure 5, which includes a processor 51, a memory 52, and a computer program stored in the memory 52 for execution by the processor 51. When the processor 51 executes the computer program, it can implement the method mentioned in any of the above embodiments.

[0086] Accordingly, an embodiment of the present application further provides a computer storage medium, in which a computer program is stored. When the computer program is executed by a processor, the method in any of the above embodiments is implemented.

[0087] The embodiments of the present application may take the form of a computer program product implemented on one or more storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing program code. Computer-usable storage media include permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, 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, read-only compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, disks 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.

[0088] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to the partial description of the method embodiments. The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. A person of ordinary skill in the art can understand and implement it without expending creative work.

[0089] 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 application 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.

[0090] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. The terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device that includes a series of elements includes not only those elements, but also other elements that are not explicitly listed, or also includes elements that are inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a..." does not exclude the presence of other identical elements in the process, method, article or device that includes the element.

[0091] The above is a detailed introduction to the methods and devices provided in the embodiments of the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the methods and core ideas of the present application. At the same time, for those skilled in the art, based on the ideas of the present application, there may be changes in the specific implementation methods and application scope. In summary, the content of the present application should not be understood as a limitation on the present application.

Claims

1. A method for constructing a three-dimensional lookup table, characterized in that: The method comprises: Obtaining the initial color to be corrected and the target color after correction desired by the user; Sampling at intervals within a channel value range of each channel in the target color space to obtain a plurality of sampling points, and determining a target sampling point to be color corrected from the plurality of sampling points; Determining, for each channel of the target sampling point in the target color space, an adjustment value for the channel, the adjustment value being obtained by adjusting a difference between the channel values ​​of the target color and the initial color in the channel using an adjustment amplitude for the channel, the adjustment amplitude being determined based on a difference between the channel value of the target sampling point in the channel and the channel value of the target color in the channel and / or the channel value of the target sampling point in the channel; A three-dimensional lookup table is constructed based on the original channel values ​​of each channel of the target sampling point in the target color space and the adjustment value, wherein the three-dimensional lookup table is used to perform color correction on the image.

2. The method according to claim 1, characterized in that If the initial color is the color of a single pixel, the color of the target sampling point is within the interval between the initial color and the target color; if the initial color is a specified color range, the color of the target sampling point is within the specified color range; and / or If the initial color is within a specified color range, the difference between the channel values ​​of the target color and the initial color in the channel is the larger of the differences between the channel values ​​of the two boundary colors of the specified color range and the channel value of the target color in the channel.

3. The method according to claim 1, characterized in that If the initial color is the color of a single pixel, and the channel is the H channel or S channel in the HSL / HSV color space, the adjustment amplitude is determined based on the difference between the channel value of the target sampling point in the H channel and the channel value of the target color in the H channel, and the channel value of the target sampling point in the S channel.

4. The method according to claim 3, characterized in that The adjustment amplitude of the target sampling point in the H channel is equal to the adjustment amplitude of the target sampling point in the S channel; and / or When the channel value of the target sampling point in the S channel is fixed, as the difference between the channel value of the target sampling point in the H channel and the channel value of the target color in the H channel increases, the adjustment amplitude increases; When the difference between the channel value of the target sampling point in the H channel and the channel value of the target color in the H channel is fixed, within the channel value range of the S channel, as the channel value of the target sampling point in the S channel increases, the adjustment amplitude first increases and then decreases.

5. The method according to claim 1, wherein If the initial color is within a specified color range and the channel is the H channel in the HSL / HSV color space, the adjustment value is the difference between the channel value of the target color in the H channel and the channel value of the initial color in the H channel; If the initial color is in a specified color range and the channel is the S channel in the HSL / HSV color space, the adjustment amplitude is determined based on the channel value of the target sampling point in the S channel.

6. The method according to claim 5, characterized in that Within the channel value range of the S channel, as the channel value of the target sampling point in the S channel increases, the adjustment amplitude first increases and then decreases.

7. The method according to claim 1, characterized in that If the channel is the L channel in the HSL color space, the adjustment amplitude is determined based on the channel value of the target sampling point in the L channel and the channel value of the target sampling point in the S channel; If the channel is the V channel in the HSV color space, the adjustment amplitude is determined based on the channel value of the target sampling point in the V channel and the channel value of the target sampling point in the S channel.

8. The method according to claim 7, characterized in that in, The higher the channel value of the target sampling point in the S channel, the greater the adjustment amplitude; and / or As the brightness of the target sampling point increases, the adjustment amplitude first increases and then decreases.

9. The method according to claim 1, characterized in that Constructing a three-dimensional lookup table based on the channel values ​​of each channel of the target sampling point in the target color space and the adjustment value, including: A three-dimensional lookup table is constructed based on the channel values ​​of each channel of the target sampling point in the target color space and the adjustment value, and the channel values ​​of each channel of the target color space of other sampling points other than the target sampling point among the multiple sampling points and the adjustment value; wherein the adjustment value of the other sampling points is 0.

10. The method according to claim 1, characterized in that If the initial color is the color of a single pixel, and the channel is the H channel or S channel in the HSL / HSV color space, then the target sampling point is a sampling point where the channel value of the H channel is within a first range, and the channel value of the S channel is within a second range; if the channel is the L / V channel in the HSL / HSV color space, the target sampling point is a sampling point where the channel value of the H channel is within a first range, the channel value of the S channel is greater than a first preset threshold, and the channel value of the L channel is greater than a second preset threshold; wherein the first range includes a range consisting of the channel values ​​of the initial color and the target color in the H channel, and the second range includes a range consisting of the channel values ​​of the initial color and the target color in the S channel; and / or If the initial color is a specified color range, and the channel is the H channel or S channel in the HSL / HSV color space, then the target sampling point is a sampling point where the channel value of the H channel is within the first range interval, and the channel value of the S channel is within the second range interval; if the channel is the L / V channel in the HSL / HSV color space, the target sampling point is a sampling point where the channel value of the H channel is within the first range interval, the channel value of the S channel is greater than the first preset threshold, and the channel value of the L channel is greater than the second preset threshold; wherein, the first range interval includes a range interval formed by the channel values ​​of the H channel at the two color boundaries of the specified color range, and the second range interval is a range interval formed by the channel values ​​of the S channel at the two color boundaries of the specified color range.

11. An image processing method, characterized in that: The method comprises: Acquire a target image to be color corrected; Color correction processing is performed on the target image based on a pre-constructed three-dimensional lookup table, wherein the pre-constructed three-dimensional lookup table is constructed based on the method according to any one of claims 1-10.

12. The method according to claim 11, characterized in that The target image is an image in RGB format, the three-dimensional lookup table is an HSL / HSV lookup table, and the method further includes: The HSL / HSV lookup table is converted into an RGB lookup table, and color correction is performed on the target image based on the RGB lookup table.

13. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 12 can be implemented.

14. An electronic device, characterized in that: The electronic device includes a processor, a memory, and a computer program stored in the memory and executable by the processor. When the processor executes the computer program, the method according to any one of claims 1 to 12 can be implemented.

15. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 12 can be implemented.

Citation Information

Patent Citations

  • Self-adaptation color balance correction method for color image

    CN102129674A

  • Color displaying adjusting method and device of displaying terminal

    CN103559870A

  • Image saturation adjusting method and device, storage medium and terminal

    CN109741279A

  • Color lookup table generation method and color correction method

    CN117612470A

  • Graphic-interface, anti-clipping, color-image correction

    US20040075853A1