Image adjustment method and apparatus therefor
By determining global and local brightness and darkness adjustment amounts in the Lab color space, and then adjusting the L component of the image in combination with these adjustment amounts, the problem of unsatisfactory image adjustment effects in existing technologies is solved, and better image display effects are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- VIVO MOBILE COMM CO LTD
- Filing Date
- 2024-07-08
- Publication Date
- 2026-06-23
AI Technical Summary
Existing image adjustment algorithms can only perform uniform adjustments on the entire image, resulting in unsatisfactory adjustment effects.
Convert the image to the Lab color space, determine the global and local brightness and darkness adjustment amounts, combine these adjustment amounts to determine the target brightness and darkness adjustment amounts, adjust the L component of the image, and convert it back to the RGB color space.
By considering both global and local features of the image, the image adjustment effect is improved, resulting in a better display effect.
Smart Images

Figure CN118864335B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of image processing technology, specifically relating to an image adjustment method and apparatus. Background Technology
[0002] In related technologies, most color level adjustment algorithms are based on histogram analysis of images. By counting the number of values of each pixel in the image, the brightness range and contrast information of the image are determined. However, such algorithms can only make uniform adjustments to the entire image, resulting in unsatisfactory adjustment effects. Summary of the Invention
[0003] The purpose of this application is to provide an image adjustment method and apparatus that can effectively solve the technical problem that when adjusting an image, only the entire image can be adjusted uniformly, resulting in unsatisfactory image adjustment effects.
[0004] In a first aspect, embodiments of this application provide an image adjustment method, including:
[0005] Convert the first image to the Lab color space;
[0006] Determine the first brightness level adjustment amount and the first darkness level adjustment amount of the first image globally, and determine the second brightness level adjustment amount and the second darkness level adjustment amount of the first image locally;
[0007] The target brightness adjustment is determined based on the first brightness adjustment and the second brightness adjustment, and the target darkness adjustment is determined based on the first darkness adjustment and the second darkness adjustment.
[0008] Based on the target brightness adjustment amount and the target darkness adjustment amount, adjust the L component of the first image to obtain the second image;
[0009] Convert the second image from the Lab color space to the RGB color space.
[0010] Secondly, embodiments of this application provide an image adjustment device, including:
[0011] The first conversion module is used to convert the first image to the Lab color space;
[0012] The first determining module is used to determine the first brightness adjustment amount and the first darkness adjustment amount of the first image globally, and to determine the second brightness adjustment amount and the second darkness adjustment amount of the first image locally.
[0013] The second determining module is used to determine the target brightness adjustment amount based on the first brightness adjustment amount and the second brightness adjustment amount, and to determine the target darkness adjustment amount based on the first darkness adjustment amount and the second darkness adjustment amount.
[0014] The adjustment module is used to adjust the L component of the first image according to the target brightness adjustment amount and the target darkness adjustment amount to obtain the second image;
[0015] The second conversion module is used to convert the second image from the Lab color space to the RGB color space.
[0016] Thirdly, embodiments of this application provide an electronic device including a processor and a memory, the memory storing a program or instructions that can run on the processor, the program or instructions being executed by the processor to implement the steps of the image adjustment method provided in the first aspect.
[0017] Fourthly, embodiments of this application provide a readable storage medium storing a program or instructions that, when executed by a processor, implement the steps of the image adjustment method provided in the first aspect.
[0018] Fifthly, embodiments of this application provide a chip including a processor and a communication interface coupled to the processor, the processor being used to run programs or instructions to implement the steps of the image adjustment method provided in the first aspect.
[0019] In a sixth aspect, embodiments of this application provide a computer program product stored in a storage medium, which is executed by at least one processor to implement the steps of the image adjustment method provided in the first aspect.
[0020] In this embodiment, when adjusting the image, the first image to be adjusted is first determined, and the first image is converted to the Lab color space. Based on the global values of the first image, the first brightness adjustment amount and the first darkness adjustment amount are determined. Based on the local values of the first image, the second brightness adjustment amount and the second darkness adjustment amount are determined. Based on the first brightness adjustment amount and the second brightness adjustment amount, the target brightness adjustment amount is determined. Based on the first darkness adjustment amount and the second darkness adjustment amount, the target darkness adjustment amount is determined. That is, by combining the brightness adjustment amount and darkness adjustment amount of the first image globally and locally, the final target brightness adjustment amount and target darkness adjustment amount are determined. Then, based on the target brightness adjustment amount and target darkness adjustment amount, the L component of the first image is adjusted to achieve the effect of adjusting the color levels of the first image, thereby obtaining the second image. After that, the second image is converted from the Lab color space back to the RGB color space to complete the automatic image adjustment.
[0021] As described above, the embodiments of this application take into account both the global and local aspects of the image when making image adjustments, thereby improving the effect of image adjustments.
[0022] Among them, the RGB color space is a color space based on red (R), green (G), and blue (B), while the Lab color space is a color-opposite color space with L component, a component, and b component. The L component represents brightness, the a component represents the range from red to green, and the b component represents the range from blue to yellow. Attached Figure Description
[0023] Figure 1 One of the flowcharts of an image adjustment method according to an embodiment of this application is shown;
[0024] Figure 2 A second flowchart of an image adjustment method according to an embodiment of this application is shown;
[0025] Figure 3 A structural block diagram of an image adjustment apparatus according to an embodiment of this application is shown;
[0026] Figure 4 A structural block diagram of an electronic device according to an embodiment of this application is shown;
[0027] Figure 5 A schematic diagram of the hardware structure of an electronic device implementing an embodiment of this application is shown. Detailed Implementation
[0028] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.
[0029] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such terms can be used interchangeably where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0030] The following describes, with reference to the accompanying drawings, a method and apparatus for image adjustment provided in this application through specific embodiments and application scenarios.
[0031] Figure 1 A flowchart of one of the image adjustment methods according to an embodiment of this application is shown. Figure 1 As shown, the method includes:
[0032] Step 102: Convert the first image to the Lab color space.
[0033] Specifically, the first image to be adjusted is determined. This first image can be input by the user or automatically selected by the system. The first image is then converted to the Lab color space. In the Lab color space, the L component represents brightness. Therefore, adjusting the L component of the first image will adjust the color levels. The first image can be converted from the RGB color space to the Lab color space.
[0034] Step 104: Determine the first brightness adjustment amount and the first darkness adjustment amount for the first image globally, and determine the second brightness adjustment amount and the second darkness adjustment amount for the first image locally.
[0035] Specifically, the first brightness adjustment amount and the first darkness adjustment amount of the first image are determined globally, that is, the first brightness adjustment amount and the first darkness adjustment amount are determined based on all the data of the first image, and the second brightness adjustment amount and the second darkness adjustment amount of the first image are determined locally, that is, the second brightness adjustment amount and the second darkness adjustment amount are determined based on some data of the first image.
[0036] Step 106: Determine the target brightness adjustment amount based on the first brightness adjustment amount and the second brightness adjustment amount, and determine the target darkness adjustment amount based on the first darkness adjustment amount and the second darkness adjustment amount.
[0037] Specifically, the first brightness adjustment amount and the second brightness adjustment amount are combined to obtain the target brightness adjustment amount for a local part of the first image, and the first darkness adjustment amount and the second darkness adjustment amount are combined to obtain the target darkness adjustment amount for a local part of the first image. In other words, the global adjustment amount of the first image and the local adjustment amount of the first image are combined to determine the final adjustment amount of a local part of the first image, and the color level adjustment of the entire first image is completed by local stitching.
[0038] Step 108: Adjust the L component of the first image according to the target brightness adjustment amount and the target darkness adjustment amount to obtain the second image.
[0039] Specifically, in the Lab color space, the L component represents brightness, or color level. Therefore, by adjusting the L component of the first image according to the target brightness adjustment amount and the target darkness adjustment amount, the color level of the first image is adjusted, thereby obtaining the second image.
[0040] Step 110: Convert the second image from Lab color space to RGB color space.
[0041] Specifically, the second image obtained after adjusting the brightness is converted from the Lab color space to the RGB color space, thereby completing the output of the second image.
[0042] In this embodiment, when adjusting the image, the first image to be adjusted is first determined, and the first image is converted to the Lab color space. Based on the global values of the first image, the first brightness adjustment amount and the first darkness adjustment amount are determined. Based on the local values of the first image, the second brightness adjustment amount and the second darkness adjustment amount are determined. Based on the first brightness adjustment amount and the second brightness adjustment amount, the target brightness adjustment amount is determined. Based on the first darkness adjustment amount and the second darkness adjustment amount, the target darkness adjustment amount is determined. That is, by combining the brightness adjustment amount and darkness adjustment amount of the first image globally and locally, the final target brightness adjustment amount and target darkness adjustment amount are determined. Then, based on the target brightness adjustment amount and target darkness adjustment amount, the L component of the first image is adjusted to achieve the effect of adjusting the color levels of the first image, thereby obtaining the second image. After that, the second image is converted from the Lab color space back to the RGB color space to complete the automatic image adjustment.
[0043] As described above, the embodiments of this application take into account both the global and local aspects of the image when making image adjustments, thereby improving the effect of image adjustments.
[0044] Among them, the RGB color space is a color space based on red (R), green (G), and blue (B), while the Lab color space is a color-opposite color space with L component, a component, and b component. The L component represents brightness, the a component represents the range from red to green, and the b component represents the range from blue to yellow.
[0045] The first image can be converted from the RGB color space to the Lab color space. The conversion process is as follows:
[0046] First, the first image in the RGB color space of the linear domain is converted to the XYZ color space. The XYZ color space is based on the RGB color space, and X, Y and Z are used to replace the three primary colors of red, green and blue using mathematical methods, as shown in the following formulas (1) to (3).
[0047] X=0.4866×R+0.2657×G+0.1982×B(1);
[0048] Y=0.2290×R+0.6917×G+0.0793×B(2);
[0049] Z=0.0000×R+0.0451×G+1.0439×B(3);
[0050] Where X, Y, and Z represent the tristimulus values in the XYZ color space, and R, G, and B represent the values of the three primary colors in the RGB color space.
[0051] Next, the values of X, Y, and Z are converted to the Lab color space, as shown in formulas (4) to (12) below:
[0052]
[0053] L=CLIP(116×Y-16,0,100) (10);
[0054] a = 500 × (X – Y) (11);
[0055] b = 200 × (Y – Z) (12);
[0056] Where X, Y, and Z represent the tristimulus values in the XYZ space, X w Y w and Z w Represents the tristimulus values of the reference light source in the XYZ space, X w =0.9505, Y w =1.0000, Z w =1.0890, pow() is the power function, CLIP() is the cutoff function, L, a and b are the L component, a component and b component of the Lab color space, respectively, which are the coordinate values of the Lab color space, and if indicates a condition.
[0057] As one possible implementation, determining a target brightness adjustment amount based on a first brightness adjustment amount and a second brightness adjustment amount, and determining a target darkness adjustment amount based on a first darkness adjustment amount and a second darkness adjustment amount, includes: weighting the first brightness adjustment amount to obtain a first weighted brightness adjustment amount; weighting the second brightness adjustment amount to obtain a second weighted brightness adjustment amount; adding the first weighted brightness adjustment amount and the second weighted brightness adjustment amount to obtain a third brightness adjustment amount; weighting the first darkness adjustment amount to obtain a first weighted darkness adjustment amount; and weighting the second darkness adjustment amount to obtain a second weighted darkness adjustment amount. Adjustment amount; add the first weighted dark level adjustment amount and the second weighted dark level adjustment amount to obtain the third dark level adjustment amount; if the third bright level adjustment amount is greater than the bright level adjustment amount threshold, determine the bright level adjustment amount threshold as the target bright level adjustment amount; if the third bright level adjustment amount is less than or equal to the bright level adjustment amount threshold, determine the third bright level adjustment amount as the target bright level adjustment amount; if the third dark level adjustment amount is greater than the dark level adjustment amount threshold, determine the dark level adjustment amount threshold as the target dark level adjustment amount; if the third dark level adjustment amount is less than or equal to the dark level adjustment amount threshold, determine the third dark level adjustment amount as the target dark level adjustment amount.
[0058] Specifically, the target brightness adjustment amount is determined based on the first brightness adjustment amount and the second brightness adjustment amount, and the target darkness adjustment amount is determined based on the first darkness adjustment amount and the second darkness adjustment amount. This includes: when determining the target brightness adjustment amount, the first brightness adjustment amount is weighted to obtain a first weighted brightness adjustment amount, and the second brightness adjustment amount is weighted to obtain a second weighted brightness adjustment amount. The weighting parameters can be set by user input or automatically matched by the system. Then, the first weighted brightness adjustment amount and the second weighted brightness adjustment amount are summed to calculate a third brightness adjustment amount. The third brightness adjustment amount is then compared with the brightness adjustment amount threshold. If the third brightness adjustment amount is greater than the brightness adjustment amount threshold, the brightness adjustment amount threshold is used as the target brightness adjustment amount. If the third brightness adjustment amount is less than or equal to the brightness adjustment amount threshold, the third brightness adjustment amount is used as the target brightness adjustment amount. This reduces the possibility of poor display effect of the first image after adjustment due to excessive adjustment amount.
[0059] Similarly, when determining the target shadow adjustment amount, the first shadow adjustment amount is weighted to obtain the first weighted shadow adjustment amount, and the second shadow adjustment amount is weighted to obtain the second weighted shadow adjustment amount. The weighting parameters can be set by user input or automatically matched by the system. Then, the first weighted shadow adjustment amount and the second weighted shadow adjustment amount are summed to calculate the third shadow adjustment amount. Then, the third shadow adjustment amount is compared with the shadow adjustment amount threshold. If the third shadow adjustment amount is greater than the shadow adjustment amount threshold, the shadow adjustment amount threshold is used as the target shadow adjustment amount. If the third shadow adjustment amount is less than or equal to the shadow adjustment amount threshold, the third shadow adjustment amount is used as the target shadow adjustment amount. This reduces the possibility of poor display effect of the first image after adjustment due to excessive adjustment amount.
[0060] The algorithms for the third bright level adjustment and the third dark level adjustment are as follows: (13) and (14):
[0061] Dn=w×Dn_p+(1-w)×Dn_g(13);
[0062] Dl=w×Dl_p+(1-w)×Dl_g(14);
[0063] Where w represents the weighting parameter, which is a hyperparameter. The range of w is from 0 to 1. When w is 0, it is a complete global color level algorithm. When w is 1, it is a complete local color level algorithm. Optionally, w can take the value of 0.3, 0.4, 0.5, 0.6 or 0.7.
[0064] Dn_g represents the first bright level adjustment amount, Dn_p represents the second bright level adjustment amount, Dl_g represents the first dark level adjustment amount, and Dl_p represents the second dark level adjustment amount.
[0065] As one possible implementation, determining a first brightness adjustment and a first darkness adjustment for the entire first image, and determining a second brightness adjustment and a second darkness adjustment for a local portion of the first image, includes: determining the value of the starting point of a bright region containing a first number of pixels in the first image as the first brightness adjustment based on the L component of the first image; determining the value of the ending point of a bright region containing a second number of pixels in the first image as the first darkness adjustment based on the L component of the first image; dividing the first image into partitions according to a target number, and calculating a fourth brightness adjustment and a fourth darkness adjustment for each partition; and determining the second brightness adjustment and the second darkness adjustment for each partition based on the fourth brightness adjustment and the fourth darkness adjustment for each partition.
[0066] Specifically, determining the first brightness adjustment amount and the first darkness adjustment amount globally in the first image, and determining the second brightness adjustment amount and the second darkness adjustment amount locally in the first image, includes: for the global adjustment amount of the first image, based on the L component of the first image, statistically analyzing the histogram information of the L component of the first image, using the values of the starting points of the bright areas where a first number of pixels are located as the first brightness adjustment amount, and using the values of the ending points of the bright areas where a second number of pixels are located as the first darkness adjustment amount. Here, the first number is a hyperparameter that can be adjusted as needed; the smaller its value, the stronger the color level adjustment. The second number is also a hyperparameter that can be adjusted as needed; the smaller its value, the stronger the color level adjustment.
[0067] Optionally, the first quantity can be 95% to 100% of all pixels in the first image. For example, the first quantity can be 95%, 96%, 97%, 98%, 99%, or 100% of all pixels in the first image. Of course, in other embodiments of this application, the first quantity can also be any value from 0% to 100% of all pixels in the first image. The second quantity can be 95% to 100% of all pixels in the first image. For example, the second quantity can be 95%, 96%, 97%, 98%, 99%, or 100% of all pixels in the first image. Of course, in other embodiments of this application, the second quantity can also be any value from 0% to 100% of all pixels in the first image. The first quantity and the second quantity can be the same or different, and the number of pixels in the first quantity and the number of pixels in the second quantity can be the same or different.
[0068] The adjustment amount for a local part of the first image can be achieved by dividing the first image into partitions according to the target number. These partitions can be equal, that is, dividing the first image into the target number of partitions. Then, the fourth brightness level adjustment amount and the fourth darkness level adjustment amount of each partition are calculated. Based on the fourth brightness level adjustment amount and the fourth darkness level adjustment amount of each partition, the second brightness level adjustment amount and the second darkness level adjustment amount of each partition are determined.
[0069] The determination of the fourth brightness adjustment amount and the fourth darkness adjustment amount can be achieved by, based on the L component of the first image, statistically analyzing the histogram information of the L component of each partition in the first image, and taking the starting point of the bright area containing the third number of pixels in any partition as the fourth brightness adjustment amount for that partition, and the ending point of the bright area containing the fourth number of pixels as the fourth darkness adjustment amount for that partition. Here, the third number is a hyperparameter that can be adjusted as needed; the smaller its value, the stronger the color level adjustment. Similarly, the fourth number is a hyperparameter that can be adjusted as needed; the smaller its value, the stronger the color level adjustment.
[0070] The third quantity can be 95% to 100% of all pixels in each partition. For example, the third quantity can be 95%, 96%, 97%, 98%, 99%, or 100% of all pixels in each partition. Of course, in other embodiments of this application, the third quantity can also be any value from 0% to 100% of all pixels in each partition. The fourth quantity can be 95% to 100% of all pixels in each partition of the first image. For example, the fourth quantity can be 95%, 96%, 97%, 98%, 99%, or 100% of all pixels in each partition of the first image. Of course, in other embodiments of this application, the fourth quantity can also be any value from 0% to 100% of all pixels in each partition. The third quantity and the fourth quantity can be the same or different, and the number of pixels in the third quantity and the number of pixels in the fourth quantity can be the same or different.
[0071] As shown above, by dividing the first image into sections, the adjustment amount of the local part of the first image can be determined. Furthermore, each section corresponds to a set of second brightness adjustment amount and second darkness adjustment amount. In this way, targeted adjustments can be made based on the different light and dark effects of each section in the first image, so that the adjusted first image has a better display effect globally.
[0072] As one possible implementation, determining the second brightness adjustment and the second darkness adjustment for each partition based on the fourth brightness adjustment and the fourth darkness adjustment for each partition includes: when the partition is located at an edge position, using the fourth brightness adjustment as the second brightness adjustment and the fourth darkness adjustment as the second darkness adjustment; when the partition is located at a non-edge position, calculating the second brightness adjustment and the second darkness adjustment based on the target pixel point of the partition and the center point of the target partition using a bilinear interpolation algorithm, based on the fourth brightness adjustment and the fourth darkness adjustment.
[0073] Specifically, the first image has two types of partitions: one is a partition located at the edge, which has no other partitions on at least one side; the other is a partition located in the middle, which has other partitions on all four sides.
[0074] Based on the fourth bright level adjustment and the fourth dark level adjustment of each partition, determine the second bright level adjustment and the second dark level adjustment of each partition. This includes: when the partition is located at the edge, use the fourth bright level adjustment as the second bright level adjustment and the fourth dark level adjustment as the second dark level adjustment. Partitions located at the edge can be regarded as starting partitions. Therefore, such partitions do not need to consider the separation from other partitions. They only need to adjust the color levels based on their own adjustment, thereby reducing the amount of calculation and improving the processing speed.
[0075] When a partition is located at a non-edge position, based on the target pixel of the partition and the center point of the target partition, a bilinear interpolation algorithm is used to calculate the second brightness adjustment and the second darkness adjustment based on the fourth brightness adjustment and the fourth darkness adjustment. In other words, the fourth brightness adjustment and the fourth darkness adjustment of the partition located in the middle position are calculated based on the partition and the partitions adjacent to it. Therefore, the whole picture is more unified and the possibility of fragmentation between the partitions is reduced.
[0076] The above method uses partitioning and bilinear interpolation to adjust the local color levels of the first image, effectively improving the image display while maintaining good computational efficiency.
[0077] The target pixel can be any point within the partition, and the target partition can be a partition adjacent to the partition. Taking a quadrilateral structure as an example, the target partition is the four partitions adjacent to the four sides of the partition.
[0078] As one possible implementation, converting the first image to the Lab color space includes: performing inverse gamma correction on the third image after gamma correction to obtain the first image; and converting the first image to the Lab color space.
[0079] Specifically, converting the first image to the Lab color space includes: determining whether the third image has undergone gamma correction; if the third image has undergone gamma correction, performing inverse gamma correction on the third image to restore the third image and obtain the first image, thereby improving the adjustment effect on the image.
[0080] Specifically, the formula for inverse gamma correction is as follows: Formula (15):
[0081]
[0082] Where C represents a placeholder for R, G, and B in the RGB color space, C in Indicates the input value, C out This represents the output value, and gamma represents the correction value.
[0083] Figure 2 A second flowchart of an image adjustment method according to an embodiment of this application is shown. Figure 2 As shown, the method includes:
[0084] Step 202: Receive the image input by the user.
[0085] Specifically, it receives an image whose color levels need to be adjusted, which can be input by the user.
[0086] Step 204: Set the size of the partition, the brightness adjustment threshold, and the darkness adjustment threshold.
[0087] Specifically, the size of the image partition, the brightness adjustment threshold, and the darkness adjustment threshold are set. The partition size, brightness adjustment threshold, and darkness adjustment threshold can be set by the user or automatically matched by the system. The brightness adjustment threshold is denoted as Dn_lim, and the darkness adjustment threshold is denoted as Dl_lim.
[0088] Step 206: Convert the image to the Lab color space.
[0089] Specifically, the input image is converted to the Lab color space, where in subsequent operations, the a and b components retain their original values, while the L component is adjusted.
[0090] If the input image has already undergone gamma correction, then inverse gamma correction is performed first.
[0091] Step 208: Determine the first brightness adjustment and the first darkness adjustment of the image globally. Divide the image into partitions according to the size of the partitions, and determine the fourth brightness adjustment and the fourth darkness adjustment of each partition.
[0092] Specifically, the first brightness level adjustment and the first darkness level adjustment of the first image are statistically analyzed globally. The first brightness level adjustment is denoted as Dn_g and the first darkness level adjustment is denoted as Dl_g. The first image is then divided into N×N small partitions according to the size of the partitions. The fourth brightness level adjustment and the fourth darkness level adjustment of each partition are statistically analyzed. The fourth brightness level adjustment is denoted as Dn_x and the fourth darkness level adjustment is denoted as Dl_x.
[0093] The statistical methods for Dn_g and Dl_g are as follows: First, the histogram information of the L component of the image is calculated. The starting point of the bright area where 99% of the pixels are located is recorded as Dn_g, and the ending point of the bright area where 99% of the pixels are located is recorded as Dl_g. Among them, 99% is a hyperparameter that can be adjusted according to the intensity requirements. The smaller its value, the stronger the color level adjustment.
[0094] Step 210: When the partition is located in a non-edge position, calculate the second brightness adjustment amount and the second darkness adjustment amount using a bilinear interpolation algorithm based on the target pixel point of the partition and the center point of the target partition.
[0095] Specifically, when the partition is located in a non-edge position, bilinear interpolation is performed based on the distance between the partition containing the pixel and the center points of the four surrounding adjacent partitions to obtain the second brightness adjustment and the second darkness adjustment of the pixel. The second brightness adjustment is denoted as Dn_p and the second darkness adjustment is denoted as Dl_p. Then, this value is weighted with the globally statistically obtained Dn_g and Dl_g values to obtain the third brightness adjustment and the third darkness adjustment. The third brightness adjustment is denoted as Dn and the third darkness adjustment is denoted as Dl.
[0096] Step 212: Determine whether the adjustment amounts for the third bright level and the third dark level are greater than the adjustment threshold. If the result is yes, proceed to step 214; if the result is no, proceed to step 216.
[0097] Specifically, determine whether Dn exceeds the set threshold Dn_lim and whether Dl exceeds the set threshold Dl_lim. If the determination result is yes, execute step 214; if the determination result is no, execute step 216.
[0098] Step 214: Use the brightness adjustment threshold as the target brightness adjustment amount and the darkness adjustment threshold as the target darkness adjustment amount.
[0099] Specifically, the target brightness adjustment amount is set as the brightness adjustment amount, or the target darkness adjustment amount is set as the darkness adjustment amount. The target brightness adjustment amount is denoted as Dn_m, and the target darkness adjustment amount is denoted as Dl_m. When Dn is greater than Dn_lim, Dn_m = Dn_lim. When Dl is greater than Dl_lim, Dl_m = Dl_lim.
[0100] Step 216: Use the third brightness adjustment amount as the target brightness adjustment amount, and use the third darkness adjustment amount as the target darkness adjustment amount.
[0101] Specifically, the third brightness level adjustment is used as the target brightness level adjustment, and the third darkness level adjustment is used as the target darkness level adjustment. The target brightness level adjustment is denoted as Dn_m, and the target darkness level adjustment is denoted as Dl_m. When Dn is less than or equal to Dn_lim, Dn_m = Dn. When Dl is less than or equal to Dl_lim, Dl_m = Dl.
[0102] Step 218: Adjust the L component of the image based on the target brightness adjustment amount and the target darkness adjustment amount.
[0103] Specifically, the image is adjusted in color levels according to the values of Dn_m and Dl_m, as shown in the following formula (16):
[0104] L'=L÷255.0×(Dl_m-Dn_m)+Dn_m(16);
[0105] Where L' represents the value of the L component of the first image after target partition adjustment, L represents the value of the L component of the first image before target partition adjustment, Dn_m represents the target brightness adjustment amount of the target partition, and Dl_m represents the target darkness adjustment amount of the target partition.
[0106] Step 220: Convert the image from Lab color space to RGB color space.
[0107] Specifically, the values of L' and the reserved values of a and b are converted back to the RGB color space.
[0108] Step 222: Output the image.
[0109] Specifically, the output image has undergone adaptive color level adjustments for each partition.
[0110] This application embodiment presents a local adaptive color level adjustment algorithm. It divides the image into partitions, statistically analyzes the histogram information of the L-component in each partition, and combines this with the global L-component histogram information to adjust the image's color levels. Furthermore, this application embodiment utilizes bilinear interpolation to calculate the color level adjustment parameters for each pixel individually, maintaining flexibility in local adjustments while keeping computational costs low.
[0111] The embodiments of this application achieve intelligent and adaptive adjustment of image color levels, improving the efficiency and quality of image processing. Furthermore, the embodiments of this application can be applied to various image processing devices and systems, such as digital image processing software, camera equipment, and smartphones.
[0112] The image adjustment method provided in this application can be executed by an image adjustment device. This application uses an image adjustment device executing the image adjustment method as an example to illustrate the apparatus of the image adjustment method provided in this application.
[0113] like Figure 3As shown, this application provides an image adjustment device 300, including: a first conversion module 302, used to convert a first image to the Lab color space; a first determination module 304, used to determine a global first brightness adjustment amount and a first darkness adjustment amount of the first image, and to determine a local second brightness adjustment amount and a second darkness adjustment amount of the first image; a second determination module 306, used to determine a target brightness adjustment amount based on the first brightness adjustment amount and the second brightness adjustment amount, and to determine a target darkness adjustment amount based on the first darkness adjustment amount and the second darkness adjustment amount; an adjustment module 308, used to adjust the L component of the first image based on the target brightness adjustment amount and the target darkness adjustment amount to obtain a second image; and a second conversion module 310, used to convert the second image from the Lab color space to the RGB color space.
[0114] In this embodiment, when adjusting the image, the first image to be adjusted is first determined, and the first image is converted to the Lab color space. Based on the global values of the first image, the first brightness adjustment amount and the first darkness adjustment amount are determined. Based on the local values of the first image, the second brightness adjustment amount and the second darkness adjustment amount are determined. Based on the first brightness adjustment amount and the second brightness adjustment amount, the target brightness adjustment amount is determined. Based on the first darkness adjustment amount and the second darkness adjustment amount, the target darkness adjustment amount is determined. That is, by combining the brightness adjustment amount and darkness adjustment amount of the first image globally and locally, the final target brightness adjustment amount and target darkness adjustment amount are determined. Then, based on the target brightness adjustment amount and target darkness adjustment amount, the L component of the first image is adjusted to achieve the effect of adjusting the color levels of the first image, thereby obtaining the second image. After that, the second image is converted from the Lab color space back to the RGB color space to complete the automatic image adjustment.
[0115] As described above, the embodiments of this application take into account both the global and local aspects of the image when making image adjustments, thereby improving the effect of image adjustments.
[0116] Among them, the RGB color space is a color space based on red (R), green (G), and blue (B), while the Lab color space is a color-opposite color space with L component, a component, and b component. The L component represents brightness, the a component represents the range from red to green, and the b component represents the range from blue to yellow.
[0117] In one possible implementation, the second determining module includes: a first calculation submodule, used to weight the first brightness adjustment amount to obtain a first weighted brightness adjustment amount, and to weight the second brightness adjustment amount to obtain a second weighted brightness adjustment amount; a second calculation submodule, used to add the first weighted brightness adjustment amount and the second weighted brightness adjustment amount to obtain a third brightness adjustment amount; a first determining submodule, used to determine the brightness adjustment amount threshold as the target brightness adjustment amount when the third brightness adjustment amount is greater than the brightness adjustment amount threshold; and a second determining submodule, used to determine the third brightness adjustment amount when the third brightness adjustment amount is less than or equal to the brightness adjustment amount threshold. The first submodule is the target brightness adjustment amount; the second submodule is the first weighted brightness adjustment amount; the third submodule is the second weighted brightness adjustment amount; the fourth submodule is the third weighted brightness adjustment amount; the third submodule is the fourth determination submodule, which is the fifth determination submodule, which is the sixth determination submodule, which is the seventh determination submodule, which is the sixth determination submodule, which is the seventh determination submodule, which is the yoke adjustment threshold, if the third brightness adjustment amount is greater than the brightness adjustment threshold; the fourth determination submodule is the seventh determination submodule, which is the yoke adjustment threshold, if the third brightness adjustment amount is less than or equal to the brightness adjustment threshold.
[0118] In one possible implementation, the first determining module includes: a fifth determining submodule, configured to determine, based on the L component of the first image, the value of the starting point of the bright area where a first number of pixels in the first image are located as a first brightness adjustment amount; a sixth determining submodule, configured to determine, based on the L component of the first image, the value of the ending point of the bright area where a second number of pixels in the first image are located as a first darkness adjustment amount; a fifth calculating submodule, configured to divide the first image into partitions according to the target number, and calculate the fourth brightness adjustment amount and the fourth darkness adjustment amount for each partition; and a seventh determining submodule, configured to determine the second brightness adjustment amount and the second darkness adjustment amount for each partition based on the fourth brightness adjustment amount and the fourth darkness adjustment amount for each partition.
[0119] As one possible implementation, the seventh determining submodule includes: a determining unit, configured to use a fourth brightness adjustment amount as a second brightness adjustment amount and a fourth darkness adjustment amount as a second darkness adjustment amount when the partition is located at an edge position; and a calculating unit, configured to calculate the second brightness adjustment amount and the second darkness adjustment amount based on the target pixel point of the partition and the center point of the target partition using a bilinear interpolation algorithm, based on the fourth brightness adjustment amount and the fourth darkness adjustment amount, when the partition is located at a non-edge position.
[0120] As one possible implementation, the first conversion module includes: a correction submodule, used to perform inverse gamma correction on the third image after the third image has undergone gamma correction, to obtain the first image; and a conversion submodule, used to convert the first image to the Lab color space.
[0121] The image adjustment device in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or chip. The electronic device can be a terminal or other devices besides electronic devices. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, private network communication terminal equipment (such as a walkie-talkie), mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the device.
[0122] The image adjustment device in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system used.
[0123] The image adjustment device provided in this application embodiment can implement all the processes implemented in the above method embodiments and achieve the same technical effect. To avoid repetition, it will not be described again here.
[0124] This application also provides an electronic device. Figure 4 The present application provides a structural block diagram of an electronic device according to an embodiment of the present application, such as... Figure 4 As shown, the electronic device 400 includes a processor 402 and a memory 404. The memory 404 stores a program or instructions that can run on the processor 402. When the program or instructions are executed by the processor 402, they implement the various steps of the above method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0125] It should be noted that the electronic devices in the embodiments of this application include the aforementioned mobile electronic devices and non-mobile electronic devices.
[0126] Figure 5 A schematic diagram of the hardware structure of an electronic device implementing an embodiment of this application.
[0127] The electronic device 500 includes, but is not limited to, components such as: radio frequency unit 501, network module 502, audio output unit 503, input unit 504, sensor 505, display unit 506, user input unit 507, interface unit 508, memory 509, and processor 510.
[0128] Those skilled in the art will understand that the electronic device 500 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 510 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 5 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.
[0129] The processor 510 is used to convert the first image to the Lab color space;
[0130] The processor 510 is used to determine a first brightness adjustment amount and a first darkness adjustment amount globally of the first image, and to determine a second brightness adjustment amount and a second darkness adjustment amount locally of the first image.
[0131] The processor 510 is used to determine a target brightness adjustment amount based on a first brightness adjustment amount and a second brightness adjustment amount, and to determine a target darkness adjustment amount based on a first darkness adjustment amount and a second darkness adjustment amount.
[0132] The processor 510 is used to adjust the L component of the first image according to the target brightness adjustment amount and the target darkness adjustment amount to obtain the second image;
[0133] Processor 510 is used to convert the second image from Lab color space to RGB color space.
[0134] In some embodiments, optionally, the processor 510 is configured to determine a target brightness adjustment amount based on a first brightness adjustment amount and a second brightness adjustment amount, and to determine a target darkness adjustment amount based on a first darkness adjustment amount and a second darkness adjustment amount, including:
[0135] The processor 510 is used to weight the first brightness adjustment amount to obtain a first weighted brightness adjustment amount, and to weight the second brightness adjustment amount to obtain a second weighted brightness adjustment amount.
[0136] The processor 510 is used to add the first weighted brightness adjustment amount and the second weighted brightness adjustment amount to obtain the third brightness adjustment amount;
[0137] The processor 510 is used to weight the first dark level adjustment amount to obtain a first weighted dark level adjustment amount, and to weight the second dark level adjustment amount to obtain a second weighted dark level adjustment amount.
[0138] The processor 510 is used to add the first weighted dark level adjustment amount and the second weighted dark level adjustment amount to obtain the third dark level adjustment amount;
[0139] The processor 510 is used to determine the brightness adjustment threshold as the target brightness adjustment amount when the third brightness adjustment amount is greater than the brightness adjustment amount threshold, and to determine the third brightness adjustment amount as the target brightness adjustment amount when the third brightness adjustment amount is less than or equal to the brightness adjustment amount threshold.
[0140] The processor 510 is used to determine the dark level adjustment threshold as the target dark level adjustment when the third dark level adjustment is greater than the dark level adjustment threshold, and to determine the third dark level adjustment as the target dark level adjustment when the third dark level adjustment is less than or equal to the dark level adjustment threshold.
[0141] In some embodiments, optionally, the processor 510 is configured to determine a first brightness adjustment amount and a first darkness adjustment amount globally of the first image, and to determine a second brightness adjustment amount and a second darkness adjustment amount locally of the first image, including:
[0142] The processor 510 is used to determine, based on the L component of the first image, the value of the starting point of the bright area where a first number of pixels in the first image are located as the first brightness level adjustment amount;
[0143] The processor 510 is used to determine the value of the end point of the bright area where the second number of pixels in the first image are located as the first dark level adjustment amount based on the L component of the first image.
[0144] The processor 510 is used to partition the first image according to the target number, and calculate the fourth brightness adjustment and the fourth darkness adjustment for each partition;
[0145] The processor 510 is used to determine the second bright level adjustment and the second dark level adjustment for each partition based on the fourth bright level adjustment and the fourth dark level adjustment for each partition.
[0146] In some embodiments, optionally, the processor 510 is configured to determine a second brightness adjustment amount and a second darkness adjustment amount for each partition based on a fourth brightness adjustment amount and a fourth darkness adjustment amount for each partition, including:
[0147] The processor 510 is used to use the fourth brightness adjustment amount as the second brightness adjustment amount and the fourth darkness adjustment amount as the second darkness adjustment amount when the partition is located at the edge position.
[0148] The processor 510 is used to calculate the second brightness adjustment and the second darkness adjustment based on the target pixel of the partition and the center point of the target partition using a bilinear interpolation algorithm, based on the fourth brightness adjustment and the fourth darkness adjustment, when the partition is located at a non-edge position.
[0149] In some embodiments, optionally, the processor 510 is configured to convert the first image to the Lab color space, including:
[0150] The processor 510 is used to perform inverse gamma correction on the third image after the third image has been gamma corrected, so as to obtain the first image;
[0151] Processor 510 is used to convert the first image to the Lab color space.
[0152] In this embodiment, when adjusting the image, the first image to be adjusted is first determined, and the first image is converted to the Lab color space. Based on the global values of the first image, the first brightness adjustment amount and the first darkness adjustment amount are determined. Based on the local values of the first image, the second brightness adjustment amount and the second darkness adjustment amount are determined. Based on the first brightness adjustment amount and the second brightness adjustment amount, the target brightness adjustment amount is determined. Based on the first darkness adjustment amount and the second darkness adjustment amount, the target darkness adjustment amount is determined. That is, by combining the brightness adjustment amount and darkness adjustment amount of the first image globally and locally, the final target brightness adjustment amount and target darkness adjustment amount are determined. Then, based on the target brightness adjustment amount and target darkness adjustment amount, the L component of the first image is adjusted to achieve the effect of adjusting the color levels of the first image, thereby obtaining the second image. After that, the second image is converted from the Lab color space back to the RGB color space to complete the automatic image adjustment.
[0153] As described above, the embodiments of this application take into account both the global and local aspects of the image when making image adjustments, thereby improving the effect of image adjustments.
[0154] Among them, the RGB color space is a color space based on red (R), green (G), and blue (B), while the Lab color space is a color-opposite color space with L component, a component, and b component. The L component represents brightness, the a component represents the range from red to green, and the b component represents the range from blue to yellow.
[0155] It should be understood that, in this embodiment, the input unit 504 may include a graphics processing unit (GPU) 5041 and a microphone 5042. The GPU 5041 processes image files of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 506 may include a display panel 5061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 507 includes at least one of a touch panel 5071 and other input devices 5072. The touch panel 5071 is also called a touch screen. The touch panel 5071 may include a touch detection device and a touch controller. Other input devices 5072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be described in detail here.
[0156] The memory 509 can be used to store software programs and various files. The memory 509 may primarily include a first storage area for storing programs or instructions and a second storage area for storing files. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 509 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (Synchlink DRAM, SLDRAM), and direct memory bus RAM (DRRAM). The memory 509 in this embodiment includes, but is not limited to, these and any other suitable types of memory.
[0157] Processor 510 may include one or more processing units; optionally, processor 510 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 510.
[0158] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described image adjustment method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0159] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0160] This application also provides a chip, which includes a processor and a communication interface. The communication interface and the processor are coupled. The processor is used to run programs or instructions to implement the various processes of the above-described image adjustment method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0161] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.
[0162] This application provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the above-described image adjustment method embodiments, and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0163] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0164] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause an electronic device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of this application.
[0165] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. An image adjustment method, characterized in that, include: Convert the first image to the Lab color space; Determine the first brightness level adjustment amount and the first darkness level adjustment amount globally for the first image, and determine the second brightness level adjustment amount and the second darkness level adjustment amount locally for the first image; The target brightness adjustment amount is determined based on the first brightness adjustment amount and the second brightness adjustment amount, and the target darkness adjustment amount is determined based on the first darkness adjustment amount and the second darkness adjustment amount. Based on the target brightness adjustment amount and the target darkness adjustment amount, adjust the L component of the first image to obtain the second image; The second image is converted from the Lab color space to the RGB color space; Determining a target brightness adjustment based on the first brightness adjustment amount and the second brightness adjustment amount, and determining a target darkness adjustment amount based on the first darkness adjustment amount and the second darkness adjustment amount, including: The first brightness adjustment amount is weighted to obtain the first weighted brightness adjustment amount, and the second brightness adjustment amount is weighted to obtain the second weighted brightness adjustment amount. Add the first weighted brightness adjustment amount and the second weighted brightness adjustment amount to obtain the third brightness adjustment amount; The first dark level adjustment amount is weighted to obtain the first weighted dark level adjustment amount, and the second dark level adjustment amount is weighted to obtain the second weighted dark level adjustment amount. Add the first weighted dark level adjustment amount and the second weighted dark level adjustment amount to obtain the third dark level adjustment amount; If the third brightness adjustment amount is greater than the brightness adjustment amount threshold, the brightness adjustment amount threshold is determined as the target brightness adjustment amount; if the third brightness adjustment amount is less than or equal to the brightness adjustment amount threshold, the third brightness adjustment amount is determined as the target brightness adjustment amount. If the third dark level adjustment amount is greater than the dark level adjustment amount threshold, the dark level adjustment amount threshold is determined as the target dark level adjustment amount; if the third dark level adjustment amount is less than or equal to the dark level adjustment amount threshold, the third dark level adjustment amount is determined as the target dark level adjustment amount.
2. The image adjustment method according to claim 1, characterized in that, Determining the first brightness adjustment amount and the first darkness adjustment amount globally of the first image, and determining the second brightness adjustment amount and the second darkness adjustment amount locally of the first image, includes: Based on the L component of the first image, the value of the starting point of the bright area where a first number of pixels in the first image are located is determined as the first brightness adjustment amount. Based on the L component of the first image, the value of the termination point of the bright area where the second number of pixels in the first image are located is determined as the first dark level adjustment amount. The first image is divided into partitions according to the target number, and the fourth brightness level adjustment and the fourth darkness level adjustment of each partition are calculated. Based on the fourth brightness adjustment amount and the fourth darkness adjustment amount of each partition, determine the second brightness adjustment amount and the second darkness adjustment amount of each partition.
3. The image adjustment method according to claim 2, characterized in that, Determining the second brightness adjustment and the second darkness adjustment for each of the partitions based on the fourth brightness adjustment and the fourth darkness adjustment for each partition includes: When the partition is located at the edge, the fourth brightness adjustment amount is used as the second brightness adjustment amount, and the fourth darkness adjustment amount is used as the second darkness adjustment amount; When the partition is located at a non-edge position, the second brightness adjustment and the second darkness adjustment are calculated using a bilinear interpolation algorithm based on the target pixel of the partition and the center point of the target partition, according to the fourth brightness adjustment and the fourth darkness adjustment.
4. The image adjustment method according to any one of claims 1 to 3, characterized in that, Convert the first image to the Lab color space, including: With the third image having undergone gamma correction, inverse gamma correction is performed on the third image to obtain the first image; Convert the first image to the Lab color space.
5. An image adjustment device, characterized in that, include: The first conversion module is used to convert the first image to the Lab color space; The first determining module is used to determine the first brightness adjustment amount and the first darkness adjustment amount of the first image globally, and to determine the second brightness adjustment amount and the second darkness adjustment amount of the first image locally. The second determining module is used to determine a target brightness adjustment amount based on the first brightness adjustment amount and the second brightness adjustment amount, and to determine a target darkness adjustment amount based on the first darkness adjustment amount and the second darkness adjustment amount. An adjustment module is used to adjust the L component of the first image according to the target brightness adjustment amount and the target darkness adjustment amount to obtain a second image; The second conversion module is used to convert the second image from the Lab color space to the RGB color space; The second determining module includes: The first calculation submodule is used to weight the first brightness adjustment amount to obtain a first weighted brightness adjustment amount, and to weight the second brightness adjustment amount to obtain a second weighted brightness adjustment amount. The second calculation submodule is used to add the first weighted brightness adjustment amount and the second weighted brightness adjustment amount to obtain the third brightness adjustment amount; The first determining submodule is used to determine the brightness adjustment threshold as the target brightness adjustment amount when the third brightness adjustment amount is greater than the brightness adjustment amount threshold. The second determining submodule is used to determine the third brightness adjustment amount as the target brightness adjustment amount when the third brightness adjustment amount is less than or equal to the brightness adjustment amount threshold. The third calculation submodule is used to weight the first dark level adjustment amount to obtain the first weighted dark level adjustment amount, and to weight the second dark level adjustment amount to obtain the second weighted dark level adjustment amount. The fourth calculation submodule is used to add the first weighted dark level adjustment amount and the second weighted dark level adjustment amount to obtain the third dark level adjustment amount; The third determining submodule is used to determine the dark level adjustment threshold as the target dark level adjustment when the third dark level adjustment amount is greater than the dark level adjustment amount threshold. The fourth determining submodule is used to determine the third dark level adjustment as the target dark level adjustment when the third dark level adjustment is less than or equal to the dark level adjustment threshold.
6. The image adjustment device according to claim 5, characterized in that, The first determining module includes: The fifth determining submodule is used to determine the value of the starting point of the bright area where a first number of pixels in the first image are located, based on the L component of the first image, as the first brightness level adjustment amount. The sixth determining submodule is used to determine the value of the end point of the bright area where the second number of pixels in the first image are located as the first dark level adjustment amount based on the L component of the first image. The fifth calculation submodule is used to partition the first image according to the target number and calculate the fourth brightness level adjustment and the fourth darkness level adjustment for each partition. The seventh determining submodule is used to determine the second brightness adjustment amount and the second darkness adjustment amount of each partition based on the fourth brightness adjustment amount and the fourth darkness adjustment amount of each partition.
7. The image adjustment device according to claim 6, characterized in that, The seventh determining submodule includes: The determining unit is configured to, when the partition is located at the edge position, use the fourth brightness adjustment amount as the second brightness adjustment amount and the fourth darkness adjustment amount as the second darkness adjustment amount. The calculation unit is configured to, when the partition is located at a non-edge position, calculate the second brightness adjustment amount and the second darkness adjustment amount based on the target pixel point of the partition and the center point of the target partition, using a bilinear interpolation algorithm, based on the fourth brightness adjustment amount and the fourth darkness adjustment amount.
8. The image adjustment apparatus according to any one of claims 5 to 7, characterized in that, The first conversion module includes: The correction submodule is used to perform inverse gamma correction on the third image after the third image has undergone gamma correction, so as to obtain the first image; A conversion submodule is used to convert the first image to the Lab color space.