Image processing method and device, equipment and storage medium
By dividing the brightness image area and enhancing the mask image on the mobile terminal images, the problem of insufficient professional shooting experience caused by the small size of the mobile terminal image sensor is solved, and the image visual effect is improved and the authenticity of the content is retained.
Patent Information
- Application Number
- CN202510127457.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-27
- Publication Date
- 2025-05-13
AI Technical Summary
The image sensor of the mobile terminal is small in size and it is difficult to provide a professional shooting experience. Especially in adjusting the global and local tone relationship of the image, the prior art is prone to cause block effects and tone reversal, resulting in distortion of the image content.
By acquiring the first brightness image of the image to be processed, it is divided into image areas of different brightness levels, and using the first mask image and the second mask image to adapt each area to enhance the transparency and hierarchy of the highlight area and improve the texture details of the dark light area.
It effectively improves the visual effect of the image, enhances the global transparency and layering of the image, and at the same time improves the texture details of the dark light areas, avoiding block effects and tone reversal.
Smart Images

Figure CN119991466A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an image processing method, apparatus, device and storage medium. Background Art
[0002] With the widespread use of mobile terminals in daily life, more and more people will use mobile terminals to take photos and record videos. The image sensors used in mobile terminals are usually small in size, much smaller than professional photographic equipment such as SLRs. However, as users' aesthetic taste for images continues to improve, users are not only satisfied with basic recording functions, but also hope that mobile terminals can provide a more professional shooting experience. Therefore, in order to improve the shooting effect of mobile terminals, it is usually necessary to adjust the global and local tonal relationships of the image to obtain better visual effects. Summary of the invention
[0003] The embodiments of the present application hope to provide an image processing method, apparatus, device and storage medium to enhance the global transparency and layering of the image, as well as the local details, which is conducive to improving the visual effect of the image.
[0004] The technical solution of this application is implemented as follows:
[0005] In a first aspect, an image processing method is provided, comprising:
[0006] Acquire a first brightness image of the image to be processed;
[0007] determining a first mask image of a first image area of the first brightness image and a second mask image of a second image area, the first image area and the second image area having different brightness levels;
[0008] The first image region is enhanced based on the first mask image, and the second image region is enhanced based on the second mask image.
[0009] In a second aspect, an image processing device is provided, comprising:
[0010] An acquisition unit, used for acquiring a first brightness image of an image to be processed;
[0011] a determining unit, configured to determine a first mask image of a first image area of the first brightness image and a second mask image of a second image area, the first image area and the second image area having different brightness levels;
[0012] A processing unit is used to perform enhancement processing on the first image area based on the first mask image, and to perform enhancement processing on the second image area based on the second mask image.
[0013] In a third aspect, a terminal device is provided, comprising: a processor and a memory configured to store a computer program that can be run on the processor,
[0014] Wherein, the processor is configured to execute the steps of the aforementioned method when running the computer program.
[0015] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, wherein the computer program implements the steps of the aforementioned method when executed by a processor.
[0016] According to a fifth aspect, a computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the aforementioned method are implemented.
[0017] In an embodiment of the present application, an image processing method, apparatus, device and storage medium are provided, the method comprising: obtaining a first brightness image of an image to be processed; determining a first mask image of a first image area of the first brightness image and a second mask image of a second image area, the brightness levels of the first image area and the second image area are different, the first image area is enhanced based on the first mask image, and the second image area is enhanced based on the second mask image. In this way, the brightness image is divided into image areas of different brightness levels by the first mask image and the second mask image, and adaptive enhancement processing operations are performed on image areas of different brightness levels, thereby improving the transparency and layering of the highlight area, and improving the texture details of the dark light area, which is conducive to improving the visual effect of the image. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 This is a schematic diagram of a first process of the image processing method in an embodiment of the present application;
[0019] Figure 2 Schematic diagram of the process of determining mask images of different image areas in an embodiment of the present application;
[0020] Figure 3 Schematic diagram of a mask curve in an embodiment of the present application;
[0021] Figure 4 is a schematic diagram of a tone mapping curve in an embodiment of the present application;
[0022] Figure 5 This is a second flow chart of the image processing method in the embodiment of the present application;
[0023] Figures 6A-6D is a schematic diagram of a mask image in an embodiment of the present application;
[0024] Figure 7A-7BA schematic diagram of an image to be processed and an image with enhanced tone in a highlight area in an embodiment of the present application;
[0025] Figure 8 A schematic diagram of the structure of an image processing device according to an embodiment of the present application;
[0026] Fig. 9 This is a schematic diagram of the structure of a terminal device in an embodiment of the present application;
[0027] Fig.10 This is a schematic structural diagram of a chip in an embodiment of the present application. DETAILED DESCRIPTION
[0028] In order to enable a more detailed understanding of the features and technical contents of the embodiments of the present application, the implementation of the embodiments of the present application is described in detail below in conjunction with the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present application.
[0029] In the related art, by adjusting the contrast of the image captured by the terminal locally, the local tone of the image can be improved to obtain a more transparent image effect. However, in the related art, the contrast is enhanced by dividing the image into several small blocks and performing histogram equalization on each small block separately. This local processing method can adjust the tone for different areas in the image. However, this local processing method is prone to cause negative effects such as block effect and tone inversion of the image, resulting in distortion of the image content.
[0030] Based on this, the embodiments of the present application provide an image processing method, apparatus, device and storage medium, which divides a brightness image into image areas with different brightness levels through a first mask image and a second mask image, and performs adaptive enhancement processing operations on image areas with different brightness levels, thereby improving the transparency and layering of the highlight area, and improving the texture details of the dark area, which is beneficial to improving the visual effect of the image.
[0031] Figure 1 Schematic diagram of the first process of the image processing method in the embodiment of the present application. Figure 1 As shown, the method may specifically include:
[0032] Step 101: Acquire a first brightness image of an image to be processed;
[0033] The image to be processed is composed of a brightness image and a color image. The brightness image of the image to be processed includes the brightness component of each pixel of the image to be processed. Since the brightness component of the image to be processed needs to be adjusted, the brightness image of the image to be processed can be adjusted, and the color image of the image to be processed can remain unchanged.
[0034] It should be noted that the methods for obtaining the brightness component are different in different image formats.
[0035] For example, if the image to be processed is in RGB format, the brightness component is not directly given, but can be calculated. A common method is to weighted average the values of the red (R), green (G) and blue (B) components of the three channels of each pixel of the image to be processed to simulate the human eye's perception of brightness. The specific calculation formula is as follows:
[0036] Brightness value = 0.299 * R + 0.587 * G + 0.114 * B (1)
[0037] For example, if the image to be processed is in YUV format, the brightness component is directly given, represented by Y, and the value of the Y channel can be directly read. Among them, the YUV format specifically includes: YUV444 each pixel has independent Y, U and V channels, YUV422 each pixel has an independent Y channel, every two pixels share a U and V channel, YUV420 each pixel has an independent Y channel, every four pixels share a U and V channel. The brightness component is obtained from the Y channel.
[0038] For example, if the image to be processed is a grayscale image, which is a special image format that only contains brightness information but not color information. In a grayscale image, the value of each pixel represents the brightness of the pixel. Therefore, it is also very simple to obtain the brightness component of the grayscale image, and the value of each pixel can be directly read.
[0039] It should also be noted that in addition to the common image formats mentioned above, there are some other image formats. The methods of obtaining the brightness component in these formats may be different, depending on the definition and storage method of the format.
[0040] Step 102: determining a first mask image of a first image area of a first brightness image and a second mask image of a second image area, wherein the brightness levels of the first image area and the second image area are different;
[0041] The mask image (also called a mask image / mask image) can be a binary image or a grayscale image of the same size as the first brightness image. If it is a binary image, each pixel indicates whether the corresponding position in the original image belongs to a specific area or object. The mask image is used to select a specific area in the image by blocking, so as to perform subsequent enhancement processing. If it is a grayscale image, the value of each pixel directly corresponds to the brightness of the pixel. The higher the value of each pixel, the brighter the pixel; the lower the value, the darker the pixel.
[0042] The first mask image is a mask image of the first image area, and the value of each pixel in the first mask image is used to characterize whether the pixel belongs to the first image area and the processing intensity, and the first mask image can be used to implement enhancement processing of the first image area. The second mask image is a mask image of the second image area, and the value of each pixel in the first mask image is used to characterize whether the pixel belongs to the second image area and the processing intensity, and the second mask image can be used to implement enhancement processing of the second image area.
[0043] In some embodiments, Figure 2 As shown, determining a first mask image of a first image area of a first brightness image and a second mask image of a second image area may include:
[0044] Step 201: determining a mask image of the first brightness image based on a mask curve and a first brightness image;
[0045] The mask curve determines the shape of the mask in the image, so as to achieve accurate selection and processing of specific areas in the image. The mask curve can be pre-configured or automatically created based on the characteristics of the image (such as color, texture, shape, etc.). The mask curve can be a linear curve or a non-linear curve.
[0046] Exemplarily, the mask image of the first brightness image may be a grayscale image obtained through a mask curve, and the value of each pixel represents the brightness of the pixel.
[0047] In some embodiments, determining the mask image of the first brightness image based on the mask curve and the first brightness image may include: using the brightness value of each pixel in the first brightness image as an input parameter of the mask curve, and using the output parameter as the value of each pixel in the mask image of the first brightness image. For example, it can be expressed as y=f(x), where f() represents a function of the mask curve, x represents an input parameter, and y represents an output parameter.
[0048] In other embodiments, determining the mask image of the first brightness image based on the mask curve and the first brightness image may further include: normalizing the output parameter to a range of 0-1 to obtain a value of each pixel in the mask image of the first brightness image.
[0049] That is to say, the value range of each pixel in the mask image can be the same as the value range of the brightness value, such as 0-255, or it can be normalized to a specific value range for subsequent processing, such as a specific value range of 0-1.
[0050] Figure 3 is a schematic diagram of a mask curve in an embodiment of the present application, such as Figure 3As shown in the figure, the horizontal axis is the brightness value of each pixel in the first brightness image, and the vertical axis is the value of each pixel in the mask image obtained after the mask curve. The closer the value of each pixel is to 1, the brighter the pixel point is; the closer it is to 0, the darker the pixel point is. Figure 3 Taking the mask curve in as an example, for pixels with brightness values less than or equal to 100 in the first brightness image, the value of the corresponding pixel in the mask image is 0, and for pixels with brightness values greater than 100 in the first brightness image, the value of the corresponding pixel in the mask image is obtained after passing through the mask curve.
[0051] Step 202: scaling the first brightness image to obtain a second brightness image, wherein the first brightness image and the second brightness image have different sizes;
[0052] The size of the first brightness image is the same as the size of the image to be processed. The brightness image is a representation of the image to be processed, in which the value of each pixel represents the brightness information of the pixel. The scaling process can be understood as scaling the first brightness image to obtain the second brightness image, and scaling the image.
[0053] The scaling process may specifically be an enlargement process or a reduction process. The enlargement process includes but is not limited to an interpolation algorithm, an image enlargement algorithm based on deep learning, etc., and the reduction process includes but is not limited to downsampling, a local mean algorithm, etc.
[0054] In some embodiments, the size of the first brightness image is larger than the size of the second brightness image. Accordingly, scaling the first brightness image to obtain the second brightness image may include: dividing the first brightness image into multiple image blocks; calculating the average brightness value of each image block to obtain the brightness value of each pixel in the second brightness image.
[0055] By taking the average brightness value of each image block as the brightness value of each pixel in the second brightness image, each pixel in the mask image of the second brightness image can effectively reflect the global brightness information of the image block in which it is located.
[0056] Step 203: determining a mask image of the second brightness image based on the mask curve and the second brightness image;
[0057] In some embodiments, determining the mask image of the second brightness image based on the mask curve and the second brightness image may include: using the brightness value of each pixel in the second brightness image as an input parameter of the mask curve and the output parameter as the value of each pixel in the mask image of the second brightness image.
[0058] In other embodiments, determining the mask image of the first brightness image based on the mask curve and the first brightness image may further include: normalizing the output parameter to a range of 0-1 to obtain a value of each pixel in the mask image of the first brightness image.
[0059] Step 204: determining a first mask image of the first image area based on the mask image of the first brightness image;
[0060] In some embodiments, the mask image of the first brightness image and the mask image of the second brightness image are fused to determine a first mask image of the first image area.
[0061] By fusing the mask images of brightness images at different sizes, a first mask image of the first image area is obtained. The first mask image combines global brightness information with local brightness information. The first mask image can ensure that the global transparency and layering of the first image area are improved while enhancing local details, thereby improving the visual effect of the first image area.
[0062] In some embodiments, fusing the mask image of the first brightness image and the mask image of the second brightness image to determine the first mask image of the first image area can include: scaling the mask image of the second brightness image to obtain the mask image after the scaling of the second brightness image, the mask image after the scaling of the second brightness image has the same size as the mask image of the first brightness image; obtaining the minimum value of the first value of the current pixel of the mask image of the first brightness image and the second value of the current pixel of the mask image after the scaling of the second brightness image as the value of the current pixel of the first mask image.
[0063] Exemplarily, the fusion formula is as follows:
[0064] mask (x,y) =min{mask1 (x,y) ,mask2 (x,y)} (2)
[0065] Among them, (x, y) represents a pixel, mask1 (x,y) Indicates the value of the pixel in the mask image of the first brightness image, mask2 (x,y) Indicates the value of the pixel in the mask image of the second brightness image, mask (x,y) Indicates the value of the pixel in the final first mask image.
[0066] The scaling process may specifically be an enlargement process or a reduction process. Exemplarily, the size of the first brightness image is larger than the size of the second brightness image, that is, the size of the mask image of the first brightness image is larger than the size of the mask image of the second brightness image, and the mask image of the second brightness image is enlarged to the same size as the mask image of the first brightness image. Exemplarily, the size of the first brightness image is smaller than the size of the second brightness image, that is, the size of the mask image of the first brightness image is smaller than the size of the mask image of the second brightness image, and the mask image of the second brightness image is reduced to the same size as the mask image of the first brightness image.
[0067] The first mask image obtained by this method fully combines global and local brightness information to ensure that when the tone mapping curve is subsequently applied to the first image area, the global transparency and layering of the first image area are improved, while the local details of the first image area are enhanced in combination with the local brightness information.
[0068] In some embodiments, the mask image of the first brightness image is used as the first mask image of the first image area.
[0069] Step 205: Determine a second mask image of the second image area based on the mask image of the second brightness image.
[0070] In some embodiments, determining the second mask image of the second image area based on the mask image of the second brightness image may include: inverting the mask image of the second brightness image to obtain the mask image after the second brightness image is inverted; scaling the mask image after the second brightness image is inverted to obtain the second mask image of the second image area, and the second mask image and the first mask image have the same size.
[0071] The inversion process is used to invert the value of each pixel in the mask image, and invert the area of the second brightness level in the mask image into the area of the first brightness level. For example, the larger the original value of each pixel, the smaller the value after inversion; the smaller the original value of each pixel, the larger the value after inversion.
[0072] In one example, inverting the mask image of the second brightness image to obtain the mask image after the second brightness image is inverted can include: determining the maximum value in the mask image of the second brightness image; inverting the mask image of the second brightness image based on the scaling factor and the maximum value of the mask image, and clamping the inversion value between a first lower threshold value and a first upper threshold value to obtain the mask image after the second brightness image is inverted.
[0073] Exemplarily, the inversion formula is as follows:
[0074] Mask out =CLAMP(α*MAX(Maskin )-Mask in ,maskThd min ,maskThd max ) (3)
[0075] Among them, Mask out It is the mask image after the MASK image of the second brightness image is inverted. in is the mask image of the second brightness image, MAX(Mask in ) is the maximum value in the mask image of the second brightness image, α is the scaling factor, maskThd min is the first lower threshold, maskThd max is the first upper threshold.
[0076] In some embodiments, the method further includes: configuring one or more parameters of a scaling factor, a first lower threshold, and a first upper threshold. By configuring the scaling factor, the maximum value of the MASK image can be flexibly controlled to achieve control of the enhancement intensity to adapt to the enhancement requirements of different types of images. By configuring the first lower threshold and the first upper threshold, the upper and lower limits of the MASK image can be flexibly controlled to also achieve control of the enhancement intensity.
[0077] Exemplarily, the value of the scaling factor is 0-1. For example, the scaling factor can be configured as 0.4, or the scaling factor can be configured as 1.
[0078] The first lower threshold is greater than or equal to 0.0, the first upper threshold is less than or equal to 1.0, and the first lower threshold is less than the first upper threshold. For example, the first lower threshold can be configured as 0.0, and the first upper threshold can be configured as 0.15.
[0079] In another example, inverting the mask image of the second brightness image to obtain the mask image after the second brightness image is inverted may include: inverting the mask image of the second brightness image based on a preset maximum value to obtain the mask image after the second brightness image is inverted. For example, the preset maximum value may be 1.
[0080] In some embodiments, the size of the first brightness image is larger than the size of the second brightness image, and the mask image after the second brightness image is inverted is enlarged to obtain the second mask image of the second image area; or, the size of the first brightness image is smaller than the size of the second brightness image, and the mask image after the second brightness image is inverted is reduced to obtain the second mask image of the second image area.
[0081] In some embodiments, determining a first mask image of a first image area of a first brightness image, and a second mask image of a second image area may include: the first brightness image is input into a multi-semantic segmentation model, and the first mask image of the first image area, and the second mask image of the second image area are determined.
[0082] As another possible implementation, the multi-semantic segmentation model can be a neural network model (such as a U-Net network), and the neural network model is used to extract the mask images of the two image areas of the image to be processed. This method requires high computing power, but the mask images of the two image areas can be determined by the brightness features of the image within the frame. For example, the multi-semantic segmentation model can be used to extract the area close to the light source in the highlight area as the highlight mask image, and the blurred area in the dark area as the dark mask image.
[0083] In some embodiments, the first image area is a high brightness level area, and the second image area is a low brightness level area. That is, the overall brightness of the first image area is higher than the overall brightness of the second image area.
[0084] Correspondingly, the first image area is a highlight area, the first mask image is a mask image of the highlight area, the second image area is a dark area, and the second mask image is a mask image of the dark area.
[0085] Step 103: performing enhancement processing on the first image region based on the first mask image, and performing enhancement processing on the second image region based on the second mask image;
[0086] In some embodiments, enhancing the first image area based on the first mask image and enhancing the second image area based on the second mask image may include: enhancing the first image area in the first brightness image based on the first mask image and the tone mapping curve to obtain a third brightness image; enhancing the second image area in the third brightness image based on the second mask image to obtain a fourth brightness image.
[0087] The tone mapping curve may be a global tone mapping curve, and the same conversion function is used to perform tone mapping on all pixels of the first brightness image. In the embodiment of the present application, since the first mask image combines global brightness information and local brightness information, when the tone mapping curve is used to perform tone mapping on the first brightness image, the first mask image is combined to ensure that the global transparency and layering of the first image area are improved, and local details can also be enhanced, thereby improving the visual effect of the first image area.
[0088] In some embodiments, the method further comprises determining a tone mapping curve for the first luminance image.
[0089] Exemplarily, the brightness histogram of the first brightness image is determined; the chromaticity mapping curve function is determined; common chromaticity mapping curve functions include but are not limited to linear functions, logarithmic functions, exponential functions, etc. The selection of these functions depends on the desired visual effect and algorithm complexity. For example, the logarithmic function can effectively compress the contrast of high brightness areas while maintaining image details, so that the image is not overexposed in the high brightness part, while maintaining sufficient details in the low brightness part. Based on the brightness histogram, the parameters of the mapping function are calculated to obtain the tone mapping curve.
[0090] In some embodiments, the first image area in the first brightness image is enhanced based on the first mask image and the tone mapping curve to obtain an enhanced brightness image, including: inverting the first mask image to obtain a third mask image; multiplying the third mask image and the first brightness image pixel by pixel to obtain a first product of each pixel; tone mapping the first brightness image based on the tone mapping curve, multiplying the mapping result of each pixel with the first mask image pixel by pixel to obtain a second product of each pixel; adding the first product and the second product of each pixel to obtain a third brightness image.
[0091] Exemplarily, the formula for performing enhancement processing on the first image region is as follows:
[0092] L h =(1.0-Mask h )*L in +Mask h *Lut g (L in ) (4)
[0093] Among them, L h is the brightness image after the tone enhancement of the first image area, Mask h is the highlight MASK image, L in is the first brightness image, Lut g is the tone mapping curve, Lut g (L in ) includes the mapping results of each pixel in the first brightness image.
[0094] Figure 4 is a schematic diagram of a tone mapping curve in an embodiment of the present application, such as Figure 4 As shown, the horizontal axis is the brightness value of each pixel in the first brightness image, and the vertical axis is the brightness value obtained after the tone mapping curve. Mapping curve 1 is the chromaticity mapping curve, MASK is the mask curve, and mapping curve 2 is a deformed tone mapping curve obtained according to the chromaticity mapping curve and the mask curve.
[0095] It should be noted that if the first mask image is a mask image of the first brightness image, the enhancement processing formula is equivalent to applying Figure 4 The mapping curve 2 shown is on the first brightness image, and implements enhancement processing on the first image area.
[0096] In some embodiments, the second image area in the third brightness image is enhanced based on the second mask image to obtain a fourth brightness image, including: subtracting the brightness value of each pixel in the first brightness image from the corresponding reference value to obtain the difference value of each pixel in the first brightness image; multiplying the difference value of each pixel in the first brightness image by the second mask image pixel by pixel, and clamping the product between the second lower threshold and the second upper threshold to obtain the brightness enhancement value of each pixel in the third brightness image; adding the brightness value of each pixel in the third brightness image to the brightness enhancement value to obtain a fourth brightness image.
[0097] In one example, the reference value is the brightness value of the corresponding pixel in the fifth brightness image obtained by scaling the second brightness image. The scaling process can be specifically a magnification process or a reduction process, and the size of the fifth brightness image is the same as that of the first brightness image.
[0098] In another example, the reference value is the brightness value of the corresponding pixel in the second brightness image of the image block where each pixel in the first brightness image is located.
[0099] Exemplarily, the formula for performing enhancement processing on the second image region is as follows:
[0100] L out =L h +CLAMP(Mask d *(L in -L dc ),-darkThd,darkThd) (5)
[0101] Among them, L out is the output fourth brightness image, L h It is the brightness image after the tone enhancement of the first image area, that is, the third brightness image, Mask d is the mask image of the first image region, L in is the first brightness image of the image to be processed, L dc is the reference value corresponding to each pixel, for example, the brightness value of the corresponding pixel in the second brightness image, or the brightness value of the corresponding pixel in the fifth brightness image, and darkThd is the brightness threshold of detail enhancement in the second image area, which is used to control the intensity of detail enhancement.
[0102] Exemplarily, the value range of darkThd is 0-255, for example, darkThd is configured to 20.
[0103] In some embodiments, the second image area in the third brightness image is enhanced based on the second mask image to obtain a fourth brightness image, including: inverting the second mask image to obtain a fourth mask image; multiplying the fourth mask image and the third brightness image pixel by pixel to obtain a third product of each pixel; deblurring the third brightness image through an image processing model to obtain a sixth brightness image; multiplying the sixth brightness image and the second mask image pixel by pixel to obtain a fourth product of each pixel; adding the third product and the fourth product of each pixel to obtain a fourth brightness image.
[0104] In one example, inverting the second mask image to obtain a fourth mask image may include: determining a maximum value in the second mask image; inverting the second mask image based on a scaling factor and the maximum value of the mask image, and clamping the inversion value between a third lower threshold and a third upper threshold to obtain a fourth mask image.
[0105] In another example, inverting the second mask image to obtain the fourth mask image may include: inverting the second mask image based on a preset maximum value to obtain the fourth mask image. For example, the preset maximum value may be 1.
[0106] Exemplarily, the formula for performing enhancement processing on the second image region is as follows:
[0107] L out =(1.0-Mask d )*L h +Mask d *cnn(L h ) (6)
[0108] Among them, L out is the output fourth brightness image, Mask d is the mask image of the second image area, L h is the third brightness image, i.e., the brightness image after the tone enhancement of the first image area, cnn is the image processing model, cnn(L h ) is a sixth brightness image, that is, a processing result obtained by deblurring the third brightness image through the image processing model.
[0109] In some embodiments, the first image area is a highlight area, the first mask image is a mask image of the highlight area, the second image area is a dark area, and the second mask image is a mask image of the dark area. Accordingly, the enhancement processing of the first image area includes but is not limited to tone enhancement, and the enhancement processing of the second image area includes but is not limited to detail enhancement.
[0110] Tone enhancement aims to improve the visual effect of highlight areas by adjusting the light and dark relationship of highlight areas. The purpose of enhancement is usually to highlight the key information in the image, enhance the three-dimensional sense of the image, and create a specific atmosphere or emotion. For example, when processing landscape photos, you can enhance the brightness and contrast of highlight areas to highlight the brightness and vastness of the sky, or reduce the brightness of highlight areas to emphasize the depth and mystery of the mountains.
[0111] The dark areas of an image may contain important details, but due to insufficient light or improper exposure, these details are often difficult to present clearly. By enhancing the dark area details, the details in the dark areas can be made more visible, thereby improving the overall quality and visual effect of the image.
[0112] In some embodiments, enhancing the first image area based on the first mask image and enhancing the second image area based on the second mask image may include: enhancing the first image area in the first brightness image based on the first mask image and the tone mapping curve to obtain a third brightness image; enhancing the second image area in the first brightness image based on the second mask image to obtain a fourth brightness image; and obtaining a final fourth brightness image based on the third brightness image and the fourth brightness image.
[0113] It should be noted that when the embodiment of the present application performs enhancement processing on different image areas based on the mask image, it can be implemented through serial processing or parallel processing, and then the parallel processing results are fused to obtain the final processing result. The parallel processing method of each image area can refer to the above-mentioned embodiment of the present application, and will not be repeated here.
[0114] In some embodiments, the method further includes: obtaining a target image based on the fourth brightness image.
[0115] Exemplarily, obtaining the target image based on the fourth brightness image may include: using the brightness value of each pixel in the fourth brightness image as the brightness value of each pixel in the target image.
[0116] In some embodiments, obtaining a target image based on the fourth brightness image may include: determining the gain of a color image of the image to be processed based on the fourth brightness image and the first brightness image; and multiplying the gain of the color image in the image to be processed by the color image in the image to be processed pixel by pixel to obtain the target image.
[0117] In some embodiments, the method further includes: displaying the target image.
[0118] In some embodiments, the image processing method provided in the embodiments of the present application can be applied to shooting stages such as previewing, taking pictures, and recording videos, and can also be applied to a separate image processing stage.
[0119] By adopting the above technical solution, the brightness image is divided into image areas with different brightness levels through the first mask image and the second mask image, and adaptive enhancement processing operations are performed on the image areas with different brightness levels, thereby improving the transparency and layering of the highlight area and improving the texture details of the dark area.
[0120] In order to better reflect the purpose of this application, further examples are given based on the above embodiments of this application. Figure 5 : is a second flow chart of the image processing method in the embodiment of the present application, such as Figure 5 As shown, the method may specifically include:
[0121] Step 501: Obtain an image to be processed;
[0122] Exemplarily, acquiring the image to be processed includes at least one of the following: acquiring a preview image / video; acquiring a captured image / video; and acquiring an image / video from a storage unit.
[0123] Step 502: Count the brightness histogram of the image to be processed and calculate the tone mapping curve;
[0124] Exemplarily, the brightness histogram of the first brightness image is determined; the chromaticity mapping curve function is determined; common chromaticity mapping curve functions include but are not limited to linear functions, logarithmic functions, exponential functions, etc. The selection of these functions depends on the desired visual effect and algorithm complexity. For example, the logarithmic function can effectively compress the contrast of high brightness areas while maintaining image details, so that the image is not overexposed in the high brightness part, while maintaining sufficient details in the low brightness part. Based on the brightness histogram, the parameters of the mapping function are calculated to obtain the tone mapping curve.
[0125] Step 503: determining mask images of brightness images of different sizes;
[0126] The brightness images of different sizes include at least a first brightness image and a second brightness image. The first brightness image may be a brightness image of a large size, and the second brightness image may be a brightness image of a small size.
[0127] The first brightness image may be a base layer brightness image or an original layer brightness image of the image to be processed. The second brightness image may be obtained by reducing the first brightness image by N times.
[0128] Exemplarily, the base layer image in the image to be processed is first extracted as a large-size brightness image; secondly, a small-scale brightness image is calculated, in which the value of each pixel corresponds to the average brightness of each image block in the large-size brightness image. For example, the size of the small-scale brightness image is 32x32, and the size of the small-scale brightness image can be reconfigured according to actual needs.
[0129] Then, according to the pre-configured MASK curve, the MASK images of the large-scale brightness image and the small-scale image are calculated. Fig. 6A is a mask image of a small-size brightness image. Figure 6B is a mask image of a large-size brightness image. In a possible implementation, the MASK curve is as follows: Figure 3 shown.
[0130] Step 504: fuse the mask images of the brightness images of different sizes to determine the mask image of the highlight area and the mask image of the dark area;
[0131] Exemplarily, mask images of brightness images of different sizes are fused to determine the mask image of the highlight area. For example, fusion can be achieved by fusion formula (2).
[0132] Exemplarily, the mask image of the second brightness image is subjected to inversion processing and N-fold magnification processing to obtain a mask image of the dark light area. For example, the inversion can be achieved by inverting formula (3), and the N-fold magnification processing can be achieved by an interpolation algorithm.
[0133] Figure 6C It is a mask image of a highlight area, that is, a mask image of a highlight area obtained by fusing mask images of large and small brightness images. Fig.6D It is a mask image of a dark light area, that is, the mask image of the small-size brightness image is inverted so that the positions of pixels indicating the highlight area and the dark light area in the mask image are swapped, and then the size of the inverted mask image is enlarged to be consistent with the size of the first mask image.
[0134] Step 505: Fusing the first brightness image of the image to be processed, the mask image of the highlight area, and the tone mapping curve, and performing tone enhancement on the highlight area to obtain a brightness image after tone enhancement on the highlight area;
[0135] For example, the tone enhancement processing of the highlight area can be achieved by formula (4).
[0136] The first mask image is used to fully combine global and local brightness information to ensure that when the tone mapping curve is applied to the highlight area, the global transparency and layering of the highlight area are improved while the local brightness information is combined to enhance the local details of the highlight area.
[0137] Fig. 7A is a schematic diagram of an image to be processed in an embodiment of the present application, Figure 7B Schematic diagram of an image with enhanced tone in a highlight region in an embodiment of the present application. It can be seen that the global transparency and layering of the image after the tone enhancement in the highlight region (such as the sky) as well as the local contrast are significantly improved.
[0138] Step 506: The first brightness image of the image to be processed, the brightness image after the highlight area tone enhancement, the second brightness image of the image to be processed and the mask image of the dark area are fused to enhance the details of the dark area to obtain a fourth brightness image.
[0139] For example, the detail enhancement processing of the dark light area can be achieved by formula (5) or (6).
[0140] In some embodiments, step 506 can be replaced by: fusing the brightness image after tone enhancement in the highlight area, the brightness image after tone enhancement in the highlight area processed by the neural network model, and the mask image of the dark area to enhance the details of the dark area to obtain a fourth brightness image.
[0141] It should be noted that if the brightness image to be adjusted is processed only by the tone mapping curve, it may cause the negative effect of the brightness of the dark area of the image being too dark or the details of the dark area being lost.
[0142] The embodiment of the present application generates a mask image of a dark light area through a mask image of a small-scale brightness image, thereby accurately detecting the dark area and performing detail enhancement. This method enhances the overall transparency of the image by enhancing the texture details of the dark area, and can avoid the negative effect of the dark area being too dark due to only using the tone mapping curve.
[0143] Step 507: Output the target image.
[0144] The brightness value of each pixel in the target image is the brightness value of each pixel in the fourth brightness image.
[0145] The embodiment of the present application provides an image processing method, which can be specifically an image enhancement method for adaptively adjusting the tone. The method adaptively calculates the tone mapping curve by counting the brightness histogram of the image to be processed; then, on two brightness images of different sizes, a mask image of the highlight area and a mask image of the dark area are fused, so as to clearly identify the highlight area in the image to be processed that needs to improve the overall transparency and the dark area in which the texture details need to be improved; finally, the highlight mask image and the global tone mapping curve are used to fuse the image with the image to be processed, so as to improve the transparency of the highlight area, and then the dark mask image and the detail enhancement method are used to improve the dark area details of the image to be processed.
[0146] This method is simple and efficient. Applying this method can enhance the light and shadow effects of videos and photos taken using terminal devices, improve the overall transparency and layering of the picture, and thus bring users a better shooting experience.
[0147] The terminal devices described in this application may include terminal devices with shooting functions such as mobile phones, tablet computers, laptops, PDAs, portable media players (PMPs), wearable devices, cameras, etc.
[0148] To implement the method of the embodiment of the present application, based on the same inventive concept, the embodiment of the present application also provides an image processing device, such as Figure 8 As shown, the image processing device 800 includes:
[0149] An acquisition unit 801 is used to acquire a first brightness image of an image to be processed;
[0150] A determining unit 802 is configured to determine a first mask image of a first image region of a first brightness image and a second mask image of a second image region, wherein the brightness levels of the first image region and the second image region are different;
[0151] The processing unit 803 is configured to perform enhancement processing on the first image region based on the first mask image, and perform enhancement processing on the second image region based on the second mask image.
[0152] In some embodiments, the determination unit 802 is used to determine the mask image of the first brightness image based on the mask curve and the first brightness image; scale the first brightness image to obtain a second brightness image, and the first brightness image and the second brightness image have different sizes; determine the mask image of the second brightness image based on the mask curve and the second brightness image; determine the first mask image of the first image area based on the mask image of the first brightness image; determine the second mask image of the second image area based on the mask image of the second brightness image.
[0153] In some embodiments, the determination unit 802 is configured to divide the first brightness image into a plurality of image blocks; and calculate the brightness average of each image block to obtain the brightness value of each pixel in the second brightness image.
[0154] In some embodiments, the determination unit 802 is configured to fuse the mask image of the first brightness image and the mask image of the second brightness image to determine a first mask image of the first image area.
[0155] In some embodiments, the determination unit 802 is used to scale the mask image of the second brightness image to obtain the mask image after the scaling of the second brightness image, and the mask image after the scaling of the second brightness image has the same size as the mask image of the first brightness image; obtain the minimum value of the first value of the current pixel of the mask image of the first brightness image and the second value of the current pixel of the mask image after the scaling of the second brightness image, as the value of the current pixel of the first mask image.
[0156] In some embodiments, the determination unit 802 is used to invert the mask image of the second brightness image to obtain a mask image after the second brightness image is inverted; and scale the mask image after the second brightness image is inverted to obtain a second mask image of the second image area, and the second mask image has the same size as the first mask image.
[0157] In some embodiments, the determination unit 802 is used to determine the maximum value in the mask image of the second brightness image; based on the scaling factor and the maximum value of the mask image, the mask image of the second brightness image is inverted, and the inversion value is clamped between a first lower threshold and a first upper threshold to obtain the mask image after the second brightness image is inverted.
[0158] In some embodiments, the determining unit 802 is used to input the first brightness image into the multi-semantic segmentation model to determine a first mask image for the first image area and a second mask image for the second image area.
[0159] In some embodiments, the processing unit 803 is used to enhance the first image area in the first brightness image based on the first mask image and the tone mapping curve to obtain a third brightness image; and enhance the second image area in the third brightness image based on the second mask image to obtain a fourth brightness image.
[0160] In some embodiments, the processing unit 803 is used to invert the first mask image to obtain a third mask image; multiply the third mask image and the first brightness image pixel by pixel to obtain a first product of each pixel; perform tone mapping on the first brightness image based on the tone mapping curve, multiply the mapping result of each pixel with the first mask image pixel by pixel to obtain a second product of each pixel; add the first product and the second product of each pixel to obtain a third brightness image.
[0161] In some embodiments, the processing unit 803 is used to subtract the corresponding reference value from the brightness value of each pixel in the first brightness image to obtain the difference value of each pixel in the first brightness image; multiply the difference value of each pixel in the first brightness image by the second mask image pixel by pixel, and clamp the product to between the second lower threshold and the second upper threshold to obtain the brightness enhancement value of each pixel in the third brightness image; add the brightness value of each pixel in the third brightness image to the brightness enhancement value to obtain a fourth brightness image.
[0162] In some embodiments, the reference value is a brightness value of a corresponding pixel in a fifth brightness image obtained by scaling the second brightness image.
[0163] In some embodiments, the processing unit 803 is used to invert the second mask image to obtain a fourth mask image; multiply the fourth mask image and the third brightness image pixel by pixel to obtain a third product of each pixel; deblur the third brightness image through the image processing model to obtain a sixth brightness image; multiply the sixth brightness image and the second mask image pixel by pixel to obtain a fourth product of each pixel; add the third product and the fourth product of each pixel to obtain a fourth brightness image.
[0164] Exemplarily, the processing unit 803 is used to determine the maximum value in the second mask image; invert the second mask image based on the scaling factor and the maximum value of the mask image, and clamp the inversion value between a third lower threshold and a third upper threshold to obtain a fourth mask image.
[0165] Exemplarily, the processing unit 803 is configured to perform inversion processing on the second mask image based on a preset maximum value to obtain a fourth mask image.
[0166] In some embodiments, the processing unit 803 is further configured to obtain a target image based on the fourth brightness image.
[0167] In some embodiments, the processing unit 803 is specifically used to use the brightness value of each pixel in the fourth brightness image as the brightness value of each pixel in the target image; or, the processing unit 803 is specifically used to determine the gain of the color image of the image to be processed based on the fourth brightness image and the first brightness image; and multiply the gain of the color image and the color image pixel by pixel to obtain the target image.
[0168] In some embodiments, the image processing apparatus further includes a display unit for displaying the target image.
[0169] In some embodiments, the image processing device further includes an image acquisition unit for acquiring an original image; and obtaining an image to be processed according to the original image.
[0170] In practical applications, the above device can be a terminal device or a chip applied to a terminal device. In the present application, the device can realize the functions of multiple units by software, hardware, or a combination of software and hardware, so that the device can execute the image processing method provided in any of the above embodiments. The technical effects of each technical solution of the device can refer to the technical effects of the corresponding technical solution in the image processing method, and the present application will not elaborate on them one by one.
[0171] Based on the hardware implementation of each unit in the above-mentioned image processing device, the embodiment of the present application also provides a terminal device, such as Fig. 9 As shown, the terminal device 900 includes: a processor 901 and a memory 902 configured to store a computer program that can be run on the processor;
[0172] The processor 901 is configured to execute the method steps in the aforementioned embodiment when running a computer program.
[0173] Of course, in practical applications, Fig. 9 As shown, the various components in the terminal device 900 are coupled together through a bus system 903. It can be understood that the bus system 903 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 903 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, various buses are marked as bus system 903 in the figure.
[0174] In practical applications, the processor may be at least one of an application-specific integrated circuit (ASIC), a digital signal processing device (DSPD), a programmable logic device (PLD), a field-programmable gate array (FPGA), a controller, a microcontroller, and a microprocessor. It is understandable that for different devices, the electronic device used to implement the functions of the processor may also be other, and the embodiments of the present application do not specifically limit this.
[0175] The above-mentioned memory can be a volatile memory (volatile memory), such as a random access memory (RAM); or a non-volatile memory (non-volatile memory), such as a read-only memory (ROM), a flash memory, a hard disk (HDD) or a solid-state drive (SSD); or a combination of the above-mentioned types of memory, and provide instructions and data to the processor.
[0176] The embodiment of the present application also provides a chip, Fig.10 It is a schematic structural diagram of a chip in an embodiment of the present application. Fig.10 The chip 1000 shown includes a processor 1010, which can call and run a computer program from a memory to implement the method in the embodiment of the present application.
[0177] Alternatively, if Fig.10 As shown, the chip 1000 may further include a memory 1020. The processor 1010 may call and run a computer program from the memory 1020 to implement the method in the embodiment of the present application.
[0178] The memory 1020 may be a separate device independent of the processor 1010 , or may be integrated into the processor 1010 .
[0179] Optionally, the chip 1000 may further include an input interface 1030. The processor 1010 may control the input interface 1030 to communicate with other devices or chips, and specifically, may obtain information or data sent by other devices or chips.
[0180] Optionally, the chip 1000 may further include an output interface 1040. The processor 1010 may control the output interface 1040 to communicate with other devices or chips, and specifically, may output information or data to other devices or chips.
[0181] Optionally, the chip can be applied to the terminal device in the embodiments of the present application, and the chip can implement the corresponding processes implemented by the terminal device in the various methods of the embodiments of the present application. For the sake of brevity, they will not be repeated here.
[0182] In an exemplary embodiment, the embodiment of the present application further provides a computer-readable storage medium, such as a memory including a computer program, and the computer program can be executed by a processor of a terminal device to complete the steps of the aforementioned method.
[0183] The embodiments of the present application also provide a computer program product, including a computer program, which, when executed by a processor, implements the steps of any one of the methods in the embodiments of the present application.
[0184] Optionally, the computer program product can be applied to the terminal device in the embodiments of the present application, and the computer program instructions enable the computer to execute the corresponding processes implemented by the terminal device in the various methods of the embodiments of the present application. For the sake of brevity, they are not repeated here.
[0185] The embodiment of the present application also provides a computer program.
[0186] Optionally, the computer program can be applied to the terminal device in the embodiments of the present application. When the computer program runs on the computer, the computer executes the corresponding processes implemented by the terminal device in the various methods of the embodiments of the present application. For the sake of brevity, they are not repeated here.
[0187] It should be understood that in the embodiments of the present application, data related to user information is involved. When the embodiments of the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0188] It should be understood that the terms used in the present application are only for the purpose of describing specific embodiments, but are not intended to limit the present application. The singular forms of "a", "said" and "the" used in the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in this article refers to and includes any or all possible combinations of one or more associated listed items. The expressions "having", "may have", "include" and "include", or "may include" and "may include" in this application can be used to indicate the presence of corresponding features (e.g., elements such as numerical values, functions, operations or components), but the presence of additional features is not excluded.
[0189] It should be understood that although the terms first, second, third, etc. may be used in this application to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other and are not necessarily used to describe a specific order or sequence. For example, without departing from the scope of the present invention, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information.
[0190] The technical solutions described in the embodiments of the present application can be combined arbitrarily without conflict.
[0191] In the several embodiments provided in the present application, it should be understood that the disclosed methods, devices and equipment can be implemented in other ways. The embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0192] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0193] In addition, all functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may be a separate unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0194] The above description is only a specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.
Claims
1. An image processing method, characterized in that: The method comprises: Acquire a first brightness image of the image to be processed; determining a first mask image for a first image region of the first brightness image and a second mask image for a second image region, the first image region and the second image region having different brightness levels; The first image region is enhanced based on the first mask image, and the second image region is enhanced based on the second mask image.
2. The method according to claim 1, characterized in that The determining of a first mask image of a first image area of the first brightness image and a second mask image of a second image area includes: determining a mask image of the first brightness image based on a mask curve and the first brightness image; performing scaling processing on the first luminance image to obtain a second luminance image, wherein the first luminance image and the second luminance image have different sizes; determining a mask image of the second luminance image based on the mask curve and the second luminance image; determining the first mask image of the first image area based on the mask image of the first brightness image; The second mask image of the second image area is determined based on the mask image of the second brightness image.
3. The method according to claim 2, characterized in that The scaling process is performed on the first brightness image to obtain a second brightness image, comprising: dividing the first brightness image into a plurality of image blocks; The average brightness value of each image block is calculated to obtain the brightness value of each pixel in the second brightness image.
4. The method according to claim 2, characterized in that The determining, based on the mask image of the first brightness image, the first mask image of the first image area includes: The mask image of the first luminance image and the mask image of the second luminance image are fused to determine the first mask image of the first image area.
5. The method according to claim 4, characterized in that The fusing the mask image of the first brightness image and the mask image of the second brightness image to determine the first mask image of the first image area includes: scaling the mask image of the second luminance image to obtain a scaled mask image of the second luminance image, wherein the scaled mask image of the second luminance image has the same size as the mask image of the first luminance image; A minimum value between a first value of a current pixel of the mask image of the first luminance image and a second value of the current pixel of the mask image after scaling of the second luminance image is obtained as a value of the current pixel of the first mask image.
6. The method according to claim 2, characterized in that The determining, based on the mask image of the second brightness image, the second mask image of the second image area includes: performing an inversion process on the mask image of the second brightness image to obtain an inverted mask image of the second brightness image; The mask image obtained by inverting the second brightness image is scaled to obtain the second mask image of the second image area, where the second mask image has the same size as the first mask image.
7. The method according to claim 6, characterized in that The inverting the mask image of the second brightness image to obtain the mask image after the second brightness image is inverted includes: determining a maximum value in the mask image of the second brightness image; The mask image of the second luminance image is inverted based on the scaling factor and the maximum value of the mask image, and the inversion value is clamped between a first lower threshold and a first upper threshold to obtain a mask image after the second luminance image is inverted.
8. The method according to claim 1, characterized in that The determining of a first mask image of a first image area of the first brightness image and a second mask image of a second image area includes: The first brightness image is input into a multi-semantic segmentation model to determine a first mask image of the first image region and a second mask image of the second image region.
9. The method according to any one of claims 1 to 8, characterized in that The performing enhancement processing on the first image region based on the first mask image and the performing enhancement processing on the second image region based on the second mask image include: performing enhancement processing on a first image region in the first luminance image based on the first mask image and the tone mapping curve to obtain a third luminance image; The second image region in the third luminance image is enhanced based on the second mask image to obtain a fourth luminance image.
10. The method according to claim 9, characterized in that The step of enhancing the first image region in the first luminance image based on the first mask image and the tone mapping curve to obtain an enhanced luminance image includes: performing inversion processing on the first mask image to obtain a third mask image; Multiplying the third mask image and the first brightness image pixel by pixel to obtain a first product of each pixel; performing tone mapping on the first luminance image based on the tone mapping curve, and multiplying the mapping result of each pixel by the first mask image pixel by pixel to obtain a second product of each pixel; The first product and the second product of each pixel are added together to obtain the third brightness image.
11. The method according to claim 9, characterized in that The step of enhancing the second image region in the third brightness image based on the second mask image to obtain a fourth brightness image includes: subtracting a corresponding reference value from a brightness value of each pixel in the first brightness image to obtain a difference value of each pixel in the first brightness image; multiplying the difference value of each pixel in the first luminance image by the second mask image pixel by pixel, and clamping the product to between a second lower threshold and a second upper threshold, to obtain a luminance enhancement value for each pixel in the third luminance image; The brightness value of each pixel in the third brightness image is added to the brightness enhancement value to obtain the fourth brightness image.
12. The method according to claim 11, characterized in that The reference value is a brightness value of a corresponding pixel in a fifth brightness image obtained by scaling the second brightness image.
13. The method according to claim 9, characterized in that The step of enhancing the second image region in the third brightness image based on the second mask image to obtain a fourth brightness image includes: performing inversion processing on the second mask image to obtain a fourth mask image; Multiplying the fourth mask image and the third luminance image pixel by pixel to obtain a third product of each pixel; Deblurring the third brightness image using an image processing model to obtain a sixth brightness image; multiplying the sixth luminance image and the second mask image pixel by pixel to obtain a fourth product of each pixel; The third product and the fourth product of each pixel are added together to obtain the fourth brightness image.
14. The method according to claim 9, characterized in that The method further comprises: A target image is obtained based on the fourth brightness image.
15. The method according to claim 14, characterized in that The step of obtaining a target image based on the fourth brightness image includes: Using the brightness value of each pixel in the fourth brightness image as the brightness value of each pixel in the target image; or, determining a gain of a color image of the image to be processed based on the fourth luminance image and the first luminance image; The gain of the color image is multiplied pixel by pixel by the color image to obtain the target image.
16. An image processing device, characterized in that: The device comprises: an acquisition unit, configured to acquire a first brightness image of an image to be processed; a determining unit, configured to determine a first mask image for a first image region of the first brightness image and a second mask image for a second image region, the first image region and the second image region having different brightness levels; A processing unit is configured to perform enhancement processing on the first image region based on the first mask image, and perform enhancement processing on the second image region based on the second mask image.
17. A terminal device, characterized in that: The terminal device includes: a processor and a memory configured to store a computer program that can be run on the processor, Wherein, the processor is configured to execute the steps of the method according to any one of claims 1 to 15 when running the computer program.
18. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 15 are implemented.