Image enhancement method, electronic device and computer readable storage medium
By acquiring images with different fill light intensities and performing image fusion processing, determining the enhancement parameters of different regions, the problem of limited image quality improvement capabilities in the prior art is solved, and a higher quality image enhancement effect is achieved.
Patent Information
- Application Number
- CN202411646845.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-18
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2044-11-18
AI Technical Summary
The existing image enhancement methods have limited ability to improve image quality when processing original acquired images, especially when the original image quality is poor.
By acquiring two images in the same scene, the fill light intensity of the first image and the second image is different, and the target shadow area and other areas are determined in the image, and the respective enhancement parameters are determined according to the area where the pixel points are located, and the image fusion is performed Process to generate the target image.
Through image fusion processing, the image quality can be effectively improved, and the image quality can be compensated for the unclear image and the lack of highlighting details caused by insufficient brightness, while avoiding the negative impact of the target shadowed area generated by fill light on the target image.
Smart Images

Figure CN119151803B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to an image enhancement method, electronic equipment and a computer-readable storage medium. Background Art
[0002] Image sensors may have problems such as unclear details or unclear images due to process and environment, which is not conducive to the subsequent use of images and also affects the user's perception. Therefore, image enhancement, as a way to improve image quality, has attracted the attention of many researchers.
[0003] Most of the current image enhancement methods are based on the original acquired image itself. In this way, if the image quality of the original acquired image is poor, even after image processing, the obtained image is still affected by the original acquired image, and the ability to improve image quality is limited. Summary of the invention
[0004] The main technical problem solved by the present application is to provide an image enhancement method, an electronic device and a computer-readable storage medium, which can improve the effect of image enhancement.
[0005] To solve the above technical problems, a technical solution adopted in the present application is: an image enhancement method is provided, the method comprising: acquiring a first image and a second image in the same scene, the first image and the second image having different fill light intensities, the pixels in the first image and the second image corresponding one to one, the first image and the second image including the same target shadow area and other areas, the other areas being areas in the image other than the target shadow area; determining a first enhancement parameter of each pixel in the first image and a second enhancement parameter of the corresponding pixel in the second image according to the area where each pixel is located in the first image; performing image fusion processing on the first image and the second image according to the first enhancement parameter of each pixel in the first image and the second enhancement parameter of the corresponding pixel in the second image to obtain a target image.
[0006] In some embodiments, the first enhancement parameter includes a first sub-enhancement parameter and a second sub-enhancement parameter, the second enhancement parameter includes a third sub-enhancement parameter and a fourth sub-enhancement parameter, and the step of determining the first enhancement parameter of each pixel in the first image and the second enhancement parameter of the corresponding pixel in the second image according to the area where each pixel in the first image is located includes: determining the enhancement parameter of the pixel in the first image that is in the target shadow area as the first sub-enhancement parameter, and determining the enhancement parameter of the pixel in the second image that is in the target shadow area as the third sub-enhancement parameter; determining the enhancement parameter of the pixel in the first image that is in the other area as the second sub-enhancement parameter, and determining the enhancement parameter of the pixel in the second image that is in the other area as the fourth sub-enhancement parameter; wherein the first sub-enhancement parameter is greater than the third sub-enhancement parameter, and the second sub-enhancement parameter is less than the fourth sub-enhancement parameter.
[0007] In some embodiments, the target shadow area includes a target pixel point area and a target area boundary, the other areas include other pixel point areas and other area boundaries, the first image and the second image in the same scene are acquired, the first image and the second image have different fill light intensities, the pixels in the first image and the second image correspond one to one, the first image and the second image include the same target shadow area and other areas, and the other areas are areas in the image other than the target shadow area, the step includes: determining the target pixel point area and other pixel point areas in the first image and the second image according to the brightness information and fill light intensity of the first image and the brightness information and fill light intensity of the second image; determining the target area boundary and other area boundary of the image according to the target pixel point area and the other pixel point area.
[0008] In some embodiments, the brightness information includes the brightness value of each pixel and the gradient histogram of the image. The step of determining the target pixel area and other pixel areas in the first image and the second image according to the brightness information and fill light intensity of the first image and the brightness information and fill light intensity of the second image includes: obtaining the fill light intensity ratio between the fill light intensity of the second image and the fill light intensity of the first image; obtaining the absolute value of the difference between the brightness value of each pixel in the second image and the brightness value of the corresponding pixel in the first image; determining the first target pixel area according to the size relationship between the absolute value of the difference and the fill light intensity ratio; determining the second target pixel area from the first target pixel area according to the size relationship between the brightness value of each pixel in the second image and the preset brightness value; determining the target pixel area from the second target pixel area according to the gradient histogram of the second image; and determining the area in the image other than the target pixel area as the other pixel area.
[0009] In some embodiments, the step of determining the target area boundary and other area boundaries of the image based on the target pixel area and the other pixel area includes: performing filtering calculations on the target pixel area and the other pixel area to obtain the initial area boundary of the target pixel area and the initial area boundary of the other area; determining the pixel points whose gradient in the gradient histogram of the second image is greater than a preset gradient threshold as the pixels to be confirmed; in response to the existence of the pixel to be confirmed in the initial area boundary of the target pixel area, removing the corresponding pixel to be confirmed from the initial area boundary of the target pixel area, and adding the pixel to be confirmed to the initial area boundary of the other area to obtain the target area boundary of the target pixel area and the other area boundaries of the other pixel area.
[0010] In some embodiments, the step of determining the target area boundary and other area boundaries of the image based on the target pixel point area and the other pixel point areas includes: connecting adjacent pixels between the target pixel point area and the other pixel point areas to obtain an initial area boundary of the target pixel point area and an initial area boundary of the other areas; widening the initial area boundary of the target pixel point area and the initial area boundary of the other areas to obtain the target area boundary and other area boundaries of the image.
[0011] In some embodiments, the step of performing image fusion processing on the first image and the second image according to the first enhancement parameter of each pixel point in the first image and the second enhancement parameter of the corresponding pixel point in the second image to obtain a target image includes: respectively acquiring a first target high-frequency component and a first target low-frequency component of the first image, and a second target high-frequency component and a second target low-frequency component of the second image; fusing the first target high-frequency component and the second target high-frequency component according to the first enhancement parameter of each pixel point in the first image and the second enhancement parameter of the pixel point in the second image to obtain a fused high-frequency component; and obtaining the target image based on the fused high-frequency component and the first target low-frequency component.
[0012] In some embodiments, the second image includes a first sub-image and a second sub-image, the first sub-image and the second sub-image have the same fill light direction, and the fill light intensity of the second sub-image is greater than the fill light intensity of the first sub-image; the step of obtaining the second target high-frequency component of the second image includes: determining the first fusion weight of each pixel in the first sub-image and the second fusion weight of the corresponding pixel in the second sub-image according to the brightness information of the second sub-image; obtaining the initial high-frequency component of the first sub-image and the initial high-frequency component of the second sub-image; fusing the initial high-frequency component of the first sub-image and the initial high-frequency component of the second sub-image according to the first fusion weight of each pixel in the first sub-image and the second fusion weight of the corresponding pixel in the second sub-image to obtain the second target high-frequency component of the second image.
[0013] To solve the above technical problem, another technical solution adopted in the present application is: to provide an electronic device, including a memory and a processor, wherein the memory stores program instructions, and the processor retrieves the program instructions from the memory to execute the above image enhancement method.
[0014] In order to solve the above technical problem, another technical solution adopted by the present application is: providing a computer-readable storage medium including program data stored therein, wherein the program data is used to implement the above image enhancement method when executed by a processor.
[0015] Compared with the traditional method of image enhancement based on one image, which leads to the problem of low quality of enhanced image, the above scheme proposes an image enhancement method, which includes: obtaining a first image and a second image in the same scene, the first image and the second image have different fill light intensities, the pixels in the first image and the second image correspond to each other, the first image and the second image include the same target shadow area and other areas, and the other areas are areas other than the target shadow area in the image; determining the first enhancement parameter of each pixel in the first image and the second enhancement parameter of the corresponding pixel in the second image according to the area where each pixel is located in the first image; performing image fusion processing on the first image and the second image according to the first enhancement parameter of each pixel in the first image and the second enhancement parameter of the corresponding pixel in the second image to obtain the target image. Thus, by obtaining the first image and the second image with different fill light intensities for fusion, the problems of unclear image and lack of detail caused by insufficient brightness can be compensated, and different enhancement parameters are determined for the target shadow area and other areas of the first image and the second image, which can avoid the influence of the target shadow area generated by the fill light on the target image. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work, among which:
[0017] Figure 1 is a flowchart of an exemplary embodiment of an image enhancement method shown in the present application;
[0018] Figure 2 yes Figure 1 FIG. 1 is a flow chart of an exemplary embodiment of step S120 in the image enhancement method;
[0019] Figure 3 It is a schematic diagram of the initial area boundary;
[0020] Figure 4 is another schematic diagram of the initial region boundary;
[0021] Figure 5 It is a specific flow chart of an exemplary embodiment of the image enhancement method shown in the present application;
[0022] Figure 6 is a schematic structural diagram of an exemplary embodiment of an image enhancement device shown in the present application;
[0023] Figure 7It is a structural schematic diagram of an embodiment of an electronic device provided by the present application;
[0024] Figure 8 It is a structural schematic diagram of an embodiment of a computer-readable storage medium provided by the present application. DETAILED DESCRIPTION
[0025] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It will be appreciated that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for ease of description, only some but not all structures related to the present application are shown in the drawings. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the art without making creative work are within the scope of protection of the present application.
[0026] First of all, it should be noted that in order to enhance the quality of images, the current main acquisition methods can be roughly divided into statistical-based image enhancement algorithms, layered-based image enhancement methods and learning-based image enhancement algorithms.
[0027] The statistical image enhancement algorithms mainly include the global histogram enhancement method, the local histogram enhancement method, CLAHE (Contrast Limited Adaptive Histogram Equalization) and other classic algorithms. The layered image enhancement methods mainly include the Retinex (retina cortex) method, which uses filtering or equation optimization to extract high frequencies for enhancement. The learning-based image enhancement algorithms mainly include sparse coding methods and deep learning methods.
[0028] However, these methods are all based on the processing of the original captured image and are still affected by the image quality of the original captured image. Based on this, the present application proposes an image enhancement method, an electronic device and a computer-readable storage medium, which can improve the image enhancement effect by adaptively fusing multiple images in different areas to obtain a higher quality target image.
[0029] The execution subject of the image enhancement method may be a terminal device or a server or other processing device, wherein the terminal device may be a user equipment (UE), a computer, a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. The execution subject of the image enhancement method may also be an image enhancement device. In some possible implementations, the image enhancement method may be implemented by a processor calling a computer-readable instruction stored in a memory.
[0030] Specifically, the image enhancement method of this embodiment includes the following steps:
[0031] S110: Acquire a first image and a second image of the same scene, wherein the fill light intensities of the first image and the second image are different, and the pixels in the first image and the second image correspond one to one. The first image and the second image include the same target shadow area and other areas, and the other areas are areas in the image other than the target shadow area.
[0032] The first image and the second image may be images collected with different fill light intensities. Exemplarily, the first image and the second image may be obtained by collecting the same scene through an image acquisition device or the like. The image acquisition device may be an image sensor such as a camera, an infrared camera, etc. When collecting the first image and the second image, different fill light intensities may be obtained by adjusting the built-in flash or external fill light of the image acquisition device, so as to collect the first image and the second image under different fill light intensities. In some embodiments, the fill light intensity when collecting the first image is less than the fill light intensity when collecting the second image. For example, the fill light intensity when collecting the first image may be set to 0, that is, there is no fill light environment, and the fill light intensity when collecting the second image may be set to be greater than 0, that is, there is a fill light environment; the fill light intensity when collecting the first image may also be set to be greater than 0, and the fill light intensity when collecting the second image may be set to be greater than the fill light intensity when collecting the first image. In order to avoid the negative impact of the shadow area, the fill light intensity when collecting the first image may be set as small as possible. In other embodiments, the fill light intensity when collecting the first image may also be greater than the fill light intensity when collecting the second image. The following embodiments are described by assuming that the fill light intensity when capturing the first image is less than the fill light intensity when capturing the second image. The following embodiments can be referred to if the fill light intensity when capturing the first image is greater than the fill light intensity when capturing the second image.
[0033] Of course, in order to save resources, the second image may be acquired only when the environment in which the first image is acquired is a dark environment to enhance the image. Otherwise, the first image may be directly processed to obtain the target image.
[0034] In addition, in some embodiments, the second image may include at least one sub-image with different fill light intensities. In some embodiments, the second image may represent an image. In other embodiments, the second image includes a first sub-image and a second sub-image, wherein the fill light intensity of the first sub-image is less than the fill light intensity of the second sub-image. In other embodiments, the second image includes a first sub-image, a second sub-image, and a third sub-image, and the fill light intensities of the first sub-image, the second sub-image, and the third sub-image increase in sequence.
[0035] Fill light intensity refers to the brightness level of the additional light source used when capturing an image. The choice of fill light intensity has an important impact on the quality of the final image, because it determines whether the light in the scene is sufficient and uniform, and whether the desired visual effect can be achieved. Exemplarily, the fill light intensity can be controlled by adjusting the fill light power. It should be noted that in order for the fused target image to maintain the style of the first image, the image acquisition device can, when capturing the second image, keep all parameters except the fill light intensity consistent with those when capturing the first image, including shutter, exposure time, fill light direction and other parameters.
[0036] Pixels are the basic building blocks of an image. Each pixel includes brightness information and color information. Multiple pixels are combined to form an image. In this embodiment, the first image and the second image are obtained by an image acquisition device capturing the same scene based on the same angle. Therefore, the pixels of the first image and the second image correspond one to one and correspond to the same position in the scene. In some embodiments, the first image and the second image are obtained by the same image acquisition device capturing the same scene. In other embodiments, the first image and the second image may also be obtained by different image acquisition devices capturing the same scene.
[0037] A shadow generally refers to a dark area formed behind an object after the object blocks the light. A target shadow area refers to a shadow area existing in an image. Exemplarily, the target shadow area in an image can be determined based on the brightness information of the image. Methods for determining the target shadow area include, but are not limited to, determining pixels whose brightness values of each pixel in the second image are less than a threshold as shadow areas, determining shadow areas based on a gradient histogram of the image, and the like. This is only taken as an example.
[0038] The other regions may also be referred to as illuminated regions, which are regions in the image other than the target shadow region. For example, the other regions in the image may be determined based on the brightness information of the image. After the target shadow region is determined, the other regions may be obtained by subtracting the target shadow region from the image.
[0039] The image enhancement device captures a first image in a non-fill light environment (or a first fill light intensity), keeps other parameters unchanged, adjusts the fill light intensity to a second fill light intensity, wherein the second fill light intensity is greater than the first fill light intensity, and captures a second image; performs shadow detection on the image to obtain target shadow areas and other areas of the first image and the second image.
[0040] S120: Determine a first enhancement parameter of each pixel in the first image and a second enhancement parameter of the corresponding pixel in the second image according to the area where each pixel is located in the first image.
[0041] The first enhancement parameter may be an enhancement parameter corresponding to each pixel in the first image. The second enhancement parameter may be an enhancement parameter corresponding to each pixel in the second image. At corresponding pixels, the sum of the first enhancement parameter and the second enhancement parameter is 1. In the same image, pixels located in different areas have different values, and in different images, pixels located in the same area also have different values. Exemplarily, in order to make full use of the illuminated area and avoid the influence of the target shadow area, the first enhancement parameter of the pixel located in the target shadow area can be set to be greater than the second enhancement parameter, and the first enhancement parameter of the pixel located in other areas can be set to be less than the second enhancement parameter. In this way, other areas of the second image and the target shadow area of the first image are fully utilized to improve the image enhancement effect.
[0042] When the pixel point is located in the target shadow area, the image enhancement device sets the first enhancement parameter of the first image and the second enhancement parameter of the second image, wherein the first enhancement parameter may be greater than the second enhancement parameter; when the pixel point is located in other areas, the image enhancement device sets the first enhancement parameter of the first image and the second enhancement parameter of the second image, wherein the first enhancement parameter may be less than the second enhancement parameter.
[0043] S130: Performing image fusion processing on the first image and the second image according to the first enhancement parameter of each pixel point in the first image and the second enhancement parameter of the corresponding pixel point in the second image to obtain a target image.
[0044] The target image may be an enhanced image. Exemplarily, the first image and the second image may be subjected to image fusion processing by using the first enhancement parameter and the second enhancement parameter to obtain the target image. The first enhancement parameter and the second enhancement parameter are used as weights of the first image and the second image to perform image fusion processing to obtain the target image. After obtaining the target image, image enhancement operations such as cropping, sharpening, and denoising may be performed on the target image to further improve the quality of the target image.
[0045] It can be seen that the image enhancement method of the embodiment of the present application obtains the first image and the second image in the same scene, the fill light intensity of the first image and the second image is different, the pixels in the first image and the second image correspond one to one, the first image and the second image include the same target shadow area and other areas, and the other areas are areas in the image other than the target shadow area; the first enhancement parameter of each pixel in the first image and the second enhancement parameter of the corresponding pixel in the second image are determined according to the area where each pixel is located in the first image; the first image and the second image are image fused according to the first enhancement parameter of each pixel in the first image and the second enhancement parameter of the corresponding pixel in the second image to obtain the target image. Therefore, by obtaining the first image and the second image with different fill light intensities for fusion, it is possible to make up for the problems of unclear images and lack of details caused by insufficient brightness, and by determining different enhancement parameters for the target shadow area and other areas of the first image and the second image, it is possible to avoid the influence of the target shadow area generated by the fill light on the target image.
[0046] Based on the above embodiments, the embodiments of the present application adopt Figure 2 The flowchart details how to set the first enhancement parameter and the second enhancement parameter of the pixels located in different areas. Figure 2 , Figure 2 yes Figure 1 A flowchart of an exemplary embodiment of step S120 in the image enhancement method is shown. Specifically, the process of step S120 determining the first enhancement parameter of each pixel in the first image and the second enhancement parameter of the corresponding pixel in the second image according to the area where each pixel is located in the first image specifically includes the following steps:
[0047] S210: Determine enhancement parameters of pixels in the first image in the target shadow area as first sub-enhancement parameters, and determine enhancement parameters of pixels in the second image in the target shadow area as third sub-enhancement parameters.
[0048] It should be noted that the first enhancement parameter and the second enhancement parameter are calculated based on the brightness information of the first image and the second image. For example, the brightness information and color information of the first image and the second image can be extracted using Bayer format data, and each channel has only one color. Including but not limited to the following two methods:
[0049] The first method first interpolates the image data of the first image and the second image (for example, the image data may be raw data) to obtain RGB (red, green, and blue) data, and then uses a standard RGB to YUV (Y: luminance, U and V: chrominance) method to obtain brightness information and color information.
[0050] The second method is to perform template filtering on the image data (raw data) of the first image and the second image to obtain brightness information, and then obtain color information by subtracting the raw data from the brightness information. The template filter is as follows:
[0051]
[0052] The first method consumes a lot of computing resources, but the brightness information is more accurate and the color information has a larger storage space. For a piece of raw data, the first method can get 2 color channels. The second method can only get 1 color channel. You can choose the corresponding method according to the actual positioning of the product.
[0053] For the convenience of distinction, the first enhancement parameter includes a first sub-enhancement parameter and a second sub-enhancement parameter. The first enhancement parameter of the pixel points located in the target shadow area in the first image can be set to the first sub-enhancement parameter, and the first enhancement parameter of the pixel points located in other areas in the first image can be set to the second sub-enhancement parameter. In the first image, the first sub-enhancement parameter of the pixel points located in the target shadow area can be set to be greater than the second sub-enhancement parameter of the pixel points located in other areas.
[0054] S220: Determine the enhancement parameters of the pixel points in other areas of the first image as the second sub-enhancement parameters, and determine the enhancement parameters of the pixel points in other areas of the second image as the fourth sub-enhancement parameters; wherein the first sub-enhancement parameter is greater than the third sub-enhancement parameter, and the second sub-enhancement parameter is less than the fourth sub-enhancement parameter.
[0055] The second enhancement parameter includes a third sub-enhancement parameter and a fourth sub-enhancement parameter. The second enhancement parameter of the pixel located in the target shadow area in the second image can be set to the third sub-enhancement parameter, and the second enhancement parameter of the pixel located in other areas in the second image can be set to the fourth sub-enhancement parameter. In the second image, the third sub-enhancement parameter of the pixel located in the target shadow area can be less than the fourth sub-enhancement parameter located in other areas. Between different images, the first sub-enhancement parameter of the pixel located in the target shadow area in the first image is greater than the third sub-enhancement parameter in the second image, and the second sub-enhancement parameter of the pixel located in other areas in the first image is less than the fourth sub-enhancement parameter in the second image. In this way, the target shadow area mainly uses the first image, and other areas mainly use the second image, which makes up for the problem of unclear pictures caused by insufficient light, and further alleviates the negative impact of the shadow caused by light on the image.
[0056] In some other embodiments, other regions include illuminated regions and transition regions, and the enhancement parameters of the pixels in the first image in the target shadow region are determined as the first sub-enhancement parameter; the enhancement parameters of the pixels in the first image in the illuminated region are determined as the second sub-enhancement parameter; the enhancement parameters of the pixels in the first image in the transition region are determined as the fifth sub-enhancement parameter; the enhancement parameters of the pixels in the second image in the target shadow region are determined as the third sub-enhancement parameter; the enhancement parameters of the pixels in the second image in the illuminated region are determined as the fourth sub-enhancement parameter; and the enhancement parameters of the pixels in the second image in the transition region are determined as the sixth sub-enhancement parameter. Among them, the first sub-enhancement parameter is greater than the third sub-enhancement parameter, and the second sub-enhancement parameter is less than the fourth sub-enhancement parameter.
[0057] Exemplarily, the determination formula of the first sub-enhancement parameter of the first image satisfies the following formula:
[0058]
[0059] in, represents the first enhancement parameter; Indicates the pixel values of each pixel in the image located in different areas. For example, shadow detection is performed on the image to obtain the target shadow area in the image. The target shadow area includes the target area boundary. When the pixel is located at the target area boundary, Set to 1, when the pixel is located outside the boundary of the target area, Set to 0, when the pixel is in the transition area, The value of belongs to [0.1,0.8]; when When , it means that the pixel point is located in the area outside the boundary of the target area. represents the second sub-enhancement parameter, which is generally set to 0.2; When , it means that the pixel is located at the boundary of the target area. represents the first sub-enhancement parameter, which is generally set to 0.7; belong ([0.1,0.8]), it means that the pixel is in the transition area. represents the fifth sub-enhancement parameter; and is the default value, Generally set to 0.1. It is generally set to 0.8.
[0060] The calculation formula of the second enhancement parameter of the second image is expressed as: , the calculation formulas of the third sub-enhancement parameter, the fourth sub-enhancement parameter and the sixth sub-enhancement parameter in the second enhancement parameter can be expressed as , , 1- .
[0061] In some other embodiments, the calculation of the first sub-enhancement parameter of the first image may also satisfy the following formula:
[0062]
[0063] in, represents the first enhancement parameter, Indicates the pixel values of each pixel in the image located in different areas. Perform shadow detection on the image to obtain the target shadow area of the image. The target shadow area includes the target pixel area and the target area boundary. The target pixel area and the target area boundary are merged to obtain , The calculation formula satisfies the following formula: , represents the target pixel area, Indicates the boundary of the target area, through Will Limited to 0-1. When , it means that the pixel is in the illuminated area. represents the second sub-enhancement parameter, which is generally set to 0.2; When , it means that the pixel is located in the target shadow area (target pixel area + target area boundary). represents the first sub-enhancement parameter, which is generally set to 0.7; When it belongs to else ([0.1,0.8]), it means that the pixel is in the transition area. represents the fifth sub-enhancement parameter; and is the default value, Generally set to 0.1. It is generally set to 0.8.
[0064] The calculation formula of the second enhancement parameter of the second image is expressed as: , the calculation formulas of the third sub-enhancement parameter, the fourth sub-enhancement parameter and the sixth sub-enhancement parameter in the second enhancement parameter can be expressed as , , 1- .
[0065] In some embodiments, the step of acquiring a target shadow area of a first image and a second image, wherein the target shadow area includes a target pixel point area and a target area boundary includes: determining the target pixel point area and other pixel point areas in the first image and the second image according to the brightness information and fill light intensity of the first image and the brightness information and fill light intensity of the second image; determining the target area boundary and other area boundaries of the image according to the target pixel point area and other pixel point areas.
[0066] The target pixel area refers to the area where the pixels belonging to the shadow are located. As an example, the target pixel area of the first image and the second image can be determined according to the brightness information and fill light intensity of the first image, the brightness information and fill light intensity of the second image. In some embodiments, the fill light intensity ratio of the second image to the first image can be determined first, and the black level of the obtained original data (raw data) of the first image and the second image is removed. After point correction, no other ISP algorithm (Image Signal Processor) processing is performed. In this case, it can be considered that after removing the environmental influence, the proportional relationship of the brightness values of the pixels in the illuminated areas of the first image and the second image is close to the fill light intensity ratio. Based on this, the pixels that deviate from the fill light intensity ratio are defined as the target pixel area.
[0067] Exemplarily, the calculation of determining the target pixel area based on the fill light intensity satisfies the following formula:
[0068]
[0069] in, represents the second image, represents the first image, Indicates the fill light intensity ratio, When the brightness value of the corresponding pixel in the image satisfies the above formula, it is identified as a pixel in the target pixel area.
[0070] In some other embodiments, the second image includes a first sub-image and a second sub-image, and the calculation of determining the target pixel point area based on the fill light intensity satisfies the following formula:
[0071]
[0072] in, represents the second sub-image, represents the first sub-image, represents the first image, represents the fill light intensity ratio between the fill light intensity of the second sub-image and the fill light intensity of the first sub-image, When the brightness value of the corresponding pixel in the image satisfies the above formula, it is identified as a pixel in the target pixel area.
[0073] As another example, the target pixel area can be determined based on the brightness information of the second image. Specifically, the brightness information includes the brightness value of each pixel in the image. It is determined whether the brightness value of each pixel in the second image is greater than a preset brightness value. If not, it is determined as a pixel in the target pixel area, which can be expressed as ,in, represents the second image, When the second image includes the first sub-image and the second sub-image, the pixel point in the second sub-image may be determined as a pixel point in the target pixel point area according to whether the brightness value of each pixel point in the second sub-image is greater than the preset brightness value.
[0074] As another example, the brightness information includes a gradient histogram of the image. The target pixel area can be determined based on the gradient histogram of the second image. Specifically, the gradient histogram of the second image is counted, the gradient histogram is divided into 256 parts, and smoothed. The first peak is detected from left to right, and the gradient value corresponding to the peak is determined as the adaptive shadow gradient threshold. If the gradient is less than the adaptive shadow threshold, the corresponding pixel is determined as a pixel in the target pixel area. The target shadow area has a relatively low contrast compared to other areas.
[0075] Exemplarily, the calculation of determining the target pixel area according to the gradient histogram may satisfy the following formula:
[0076]
[0077] in, represents the gradient histogram of the second image, represents the adaptive shadow gradient threshold, This is a preset value, usually set to a value greater than 1.
[0078] When the second image includes the first sub-image and the second sub-image, the calculation formula is:
[0079]
[0080] in, represents the gradient histogram of the second image, represents the adaptive shadow gradient threshold, This is a preset value, usually set to a value greater than 1.
[0081] The other pixel point regions may be regions other than the target pixel point region in the image, which will not be described in detail herein.
[0082] As another example, the target pixel area can be determined in combination with the above determination method, and only pixels that meet the above determination method at the same time will be identified as pixels in the target pixel area. Specifically, the fill light intensity ratio between the fill light intensity of the second image and the fill light intensity of the first image is obtained; the absolute value of the difference between the brightness value of each pixel in the second image and the brightness value of the corresponding pixel in the first image is obtained; the first target pixel area is determined according to the size relationship between the absolute value of the difference and the fill light intensity ratio; the second target pixel area is determined from the first target pixel area according to the size relationship between the brightness value of each pixel in the second image and the preset brightness value; the target pixel area is determined from the second target pixel area according to the gradient histogram of the second image; and the area in the image other than the target pixel area is determined as other pixel areas. Thus, the target pixel area is determined by combining the three methods at the same time, thereby improving the accuracy of the target pixel area.
[0083] When the second image includes the first sub-image and the second sub-image, the fill light intensity ratio of the fill light intensity between the second sub-image and the first sub-image is obtained; the first difference absolute value between the brightness values of the corresponding pixels in the first sub-image and the first image is obtained; the second difference absolute value between the brightness values of the pixels in the second sub-image and the first image is obtained; the ratio between the first difference absolute value and the second difference absolute value is obtained; the absolute value of the difference between the ratio and the fill light intensity ratio is determined as the target difference absolute value; the pixels whose target difference absolute value is greater than the first preset value (rashadow) are determined as the first target pixel area; due to the limitations of the manufacturing process of the image sensor, its response presents nonlinear characteristics in the dark area and the area close to overexposure, so it is necessary to exclude brighter pixels, that is, the pixels whose brightness values in the first target pixel area of the second sub-image are less than the preset brightness value are determined as the second target pixel area; finally, the target pixel area is selected from the second target pixel area according to the gradient histogram of the second sub-image.
[0084] In other embodiments, the above three methods may be arbitrarily arranged and combined to obtain the target pixel point area.
[0085] After obtaining the target pixel area, the target area boundary of the target pixel area can be further determined. Specifically, the target pixel area and other pixel areas are filtered and calculated to obtain the initial area boundary of the target pixel area and the initial area boundary of other areas; the pixel points whose gradient in the gradient histogram of the second image is greater than the preset gradient threshold are determined as the pixels to be confirmed; in response to the existence of the pixel to be confirmed in the initial area boundary of the target pixel area, the corresponding pixel to be confirmed is removed from the initial area boundary of the target pixel area, and the pixel to be confirmed is added to the initial area boundary of other areas to obtain the target area boundary of the target pixel area and other area boundaries of other pixel areas. The initial area boundary of the target pixel area obtained by filtering calculation includes pixels adjacent to other areas, but the adjacent pixels belong to other areas. Therefore, this embodiment removes the pixels belonging to other areas in the initial area boundary through the gradient histogram, and the obtained target area boundary is more accurate, avoiding the inclusion of pixels in other areas into the target shadow area, thereby reducing the fusion effect of the corresponding pixels.
[0086] Exemplarily, algorithms for filtering calculations include, but are not limited to, sobel (Sobel Operator), Laplacian (Laplacian of Gaussian (LoG)), and Prewitt (Prewitt Operator) algorithms.
[0087] Taking the Sobel algorithm as an example, the Sobel operator usually uses a pair of 3x3 convolution kernels, one for detecting vertical edges and the other for detecting horizontal edges. As an example, its template is as follows, the left matrix is used to detect vertical edges, and the right matrix is used to detect horizontal edges:
[0088]
[0089] It should be noted that after determining the target pixel area and other pixel areas, each pixel in the target pixel area is marked as 0, and each pixel in the other pixel area is marked as 1, to obtain a shadow marking map. Each pixel in the shadow marking map is filtered using the Sobel template to satisfy the following formula:
[0090]
[0091] in, Represents the first shadow boundary marking map, marking the initial region boundary of the target pixel area as 1 and the non-initial region boundary as 0. Represents the value after matrix conversion of vertical edge detected by Sobel template. Represents the value after matrix conversion of the horizontal edge detected by the Sobel template. and There is at least one absolute value greater than 0, that is The absolute value of is greater than 0 or If the absolute value of is greater than 0, the corresponding pixel in the shadow mark map is determined as the initial region boundary of the target pixel region. Indicates other situations. See Figure 3 , Figure 3 is a schematic diagram of the initial region boundary, wherein the thinner solid line is the initial region boundary of other pixel regions, and the thicker solid line is the initial region boundary of the target pixel region.
[0092] The initial area of the target pixel area calculated by filtering may include the boundaries of other areas, resulting in that these pixels mainly use the first image, and the fill light intensity of the first image is lower than the fill light intensity of the second image, which reduces the clarity of the fused target image. Therefore, it is necessary to correct the initial area of the target pixel area and the initial areas of other areas to obtain the boundaries of the target area and other areas.
[0093] Exemplarily, the erroneous pixel points in the initial region boundary of the target pixel point area can be excluded by the gradient histogram of the second image. When the gradient is greater than the preset gradient threshold, the corresponding pixel point is determined as the other region boundary of other regions. If the second image includes a first sub-image and a second sub-image, the gradient histogram of the first sub-image and the second sub-image is calculated, and the initial region boundary of the target pixel point area and the initial region boundary of other regions are corrected by the gradient histogram of the first sub-image and the second sub-image to obtain the target region boundary and the other region boundary. The formula can be expressed as:
[0094]
[0095] in, Indicates the second shadow boundary marking map, the initial area of the target pixel area can be marked as 1, and the non-initial area boundary can be marked as 0. represents the gradient histogram of the first sub-image, represents the gradient histogram of the second sub-image, Less than the preset value or Less than the preset value , then mark the corresponding pixel as 1. To indicate other situations, and is the default value.
[0096] The first shadow boundary mark map obtained by filtering The second shadow boundary marker map is calculated by the gradient histogram and merged to obtain a target shadow boundary marker map composed of the target area boundary and other area boundaries. The calculation of the merged processing satisfies the following formula:
[0097]
[0098] in, The target shadow boundary marking map represents the target area boundary and other area boundaries, where the target area boundary is marked as 1 and the non-target area boundary is marked as 0; represents the first shadow boundary marker map, obtained by filtering calculation, Represents the second shadow boundary marker map, which is calculated from the gradient histogram. Figure 4 , Figure 4 is another schematic diagram of the initial region boundary, wherein the thinner solid line is the initial region boundary of other pixel regions, and the thicker solid line is the initial region boundary of the target pixel region.
[0099] In other embodiments, the initial region boundary of the target pixel region and the initial region boundaries of other regions obtained after filtering calculation may be used as the target region boundary of the target pixel region and the other region boundaries of other regions, respectively. Alternatively, the pixel points whose gradient in the gradient histogram of the second image is greater than a preset gradient threshold are used as the other region boundaries, and the pixel points whose gradient is less than the preset gradient threshold are used as the target region boundary.
[0100] In other embodiments, adjacent pixels between the target pixel region and other pixel regions are connected to obtain the initial region boundary of the target pixel region and the initial region boundary of other regions; the initial region boundary of the target pixel region and the initial region boundary of other regions are widened to obtain the target region boundary and the initial region boundary of other regions of the image, thereby widening the boundary and increasing the accuracy of boundary detection.
[0101] In some embodiments, the adjacent pixels between the target pixel area and other pixel areas can be connected to obtain the initial area boundary of the target pixel area and the initial area boundary of other areas. In other embodiments, the initial area boundary of the target pixel area and the initial area boundary of other areas can be determined by referring to the above-mentioned method of filtering calculation and gradient histogram calculation, and specifically, filtering calculation can be performed on the target pixel area and other pixel areas to obtain the first initial area boundary of the target pixel area and the first initial area boundary of other areas; the pixel whose gradient in the gradient histogram of the second image is greater than the preset gradient threshold is determined as the pixel to be confirmed; in response to the existence of the pixel to be confirmed in the initial area boundary of the target pixel area, the corresponding pixel to be confirmed is removed from the first initial area boundary of the target pixel area, and the pixel to be confirmed is added to the first initial area boundary of other areas to obtain the initial area boundary of the target pixel area and the initial area boundary of other pixel areas.
[0102] After obtaining the initial region boundary of the target pixel region and the initial region boundary of other regions, the image enhancement device widens the initial region boundary to obtain the target region boundary and other region boundary of the image. For example, 3, 4 or 5 pixels may be widened, which is not specifically limited here and can be adjusted according to actual needs. At the same time, Gaussian filtering may also be performed, and the radius and intensity of the Gaussian filtering may also be adjusted according to actual needs.
[0103] The image enhancement device obtains a first image and a second image, and obtains brightness information and color information of the first image and the second image; performs shadow detection on the first image and the second image according to the brightness information of the first image and the second image to obtain a target pixel area and other pixel areas; then performs boundary detection on the target pixel area and other pixel areas to obtain a target area boundary and other area boundaries, and performs correction processing through the gradient histogram of the second image when detecting the area boundary, so as to obtain a more accurate target area boundary and other area boundaries; then determines the first enhancement parameter and the second enhancement parameter according to the target area boundary. After obtaining the first enhancement parameter and the second enhancement parameter, respectively obtain the first target high-frequency component and the first target low-frequency component of the first image, and the second target high-frequency component and the second target low-frequency component of the second image; fuse the first target high-frequency component and the second target high-frequency component according to the first enhancement parameter of each pixel in the first image and the second enhancement parameter of the corresponding pixel in the second image to obtain a fused high-frequency component; obtain the target image based on the fused high-frequency component and the first target low-frequency component. In this way, the image is divided into a high-frequency component and a low-frequency component, and the high-frequency component is fused through the first enhancement parameter and the second enhancement parameter, which can improve the clarity of fusion between different areas.
[0104] Among them, the first target high-frequency component and the first target low-frequency component can be obtained according to the brightness information of the first image. Exemplarily, the brightness information of the first image is extracted, the brightness information includes a brightness map, and the brightness map of the first image is decomposed into high and low frequencies to obtain the first target high-frequency component and the first target low-frequency component of the first image. The second target high-frequency component and the second target low-frequency component can be obtained according to the brightness information of the second image. Exemplarily, the brightness information of the second image is extracted, and the brightness map of the second image is decomposed into high and low frequencies to obtain the second target high-frequency component and the second target low-frequency component of the second image. High and low frequency decomposition methods include but are not limited to bilateral filtering, TV (Total Variation, total variation), RTV (Rolling Guidance Total Variation, rolling guidance total variation), WLS (Weighted LeastSquares, weighted least squares) and other algorithms.
[0105] Taking the simplified bilateral filtering as an example, its calculation satisfies the following formula:
[0106]
[0107] in, represents the target low-frequency component, Represents the brightness map of the image, s and p are the pixel coordinates, It means to traverse all the pixels in the area centered on s. Indicates the brightness value of the pixel corresponding to the s coordinate, Indicates the brightness value of the pixel corresponding to the p coordinate, and Sigma is the preset value. This formula calculates the low-frequency value of the s coordinate point, traverses the brightness values of all pixels in the image, and calculates the target low-frequency component.
[0108] Subtract the target low-frequency component from the brightness map in the brightness information of the image to obtain the target high-frequency component of the image. Exemplarily, the calculation of the target high-frequency component satisfies the following formula:
[0109]
[0110] in, represents the first target high frequency component of the first image, represents the brightness map of the first image, represents the first target low-frequency component of the first image, represents the second target high frequency component of the second image, represents the brightness map of the second image, Represents a second target low-frequency component of the first image.
[0111] After obtaining the first target high-frequency component of the first image and the second target high-frequency component of the second image, the image enhancement device fuses the first target high-frequency component and the second target high-frequency component according to the first enhancement parameter of each pixel point in the first image and the second enhancement parameter of the corresponding pixel point in the second image to obtain a fused high-frequency component. Exemplarily, the calculation of the fused high-frequency component may satisfy the following formula:
[0112]
[0113] in, represents the fusion of high-frequency components, represents the first target high frequency component, represents the first enhancement parameter, represents the second target high frequency component, Represents the second enhancement parameter.
[0114] Finally, the target image is obtained by combining the fused high-frequency component and the first target low-frequency component. For example, the calculation of the target image satisfies the following formula:
[0115]
[0116] Here, represents the target image, represents the fused high-frequency component, and represents the first target low-frequency component. Thus, the final target image is generated by fusing the high-frequency component and the first target low-frequency component, without changing the style of the original first image.
[0117] After the target image is obtained, the target image is combined with the color information of the first image to obtain a final image.
[0118] If the second image includes a first sub-image and a second sub-image, the fill light directions of the first sub-image and the second sub-image are the same, and the fill light intensity of the second sub-image is greater than the fill light intensity of the first sub-image; the step of obtaining the target high-frequency component of the second image includes: determining the first fusion weight of each pixel point in the first sub-image and the second fusion weight of the corresponding pixel point in the second sub-image according to the brightness information of the second sub-image; obtaining the high-frequency component of the first sub-image and the high-frequency component of the second sub-image; and fusing the high-frequency component of the first sub-image and the high-frequency component of the second sub-image according to the first fusion weight of each pixel point in the first sub-image and the second fusion weight of the corresponding pixel point in the second sub-image to obtain the second target high-frequency component of the second image.
[0119] The first fusion weight and the second fusion weight are used to fuse the high-frequency components of the first sub-image and the high-frequency components of the second sub-image. Since the first sub-image and the second sub-image are images obtained after fill light, there may be an overexposure problem due to fill light. The closer the object is to the light source, the greater the possibility of overexposure. To prevent this situation, it is necessary to fuse the high-frequency components of the first sub-image and the second sub-image.
[0120] Since fill light has attenuation problem, the closer the area is to the light source, the more sufficient the fill light is. Therefore, the first fusion weight of each pixel in the first sub-image and the second fusion weight of the corresponding pixel in the second sub-image are determined according to the brightness information of the second sub-image. Exemplarily, the calculation of the first fusion weight of the first sub-image can satisfy the following formula:
[0121]
[0122] in, represents the first fusion weight, represents the second sub-image, Indicates the first image, which is the default value. Used to adjust the high-frequency fusion style of the foreground and background. Used to limit the first fusion weight between 0 and 1.
[0123] The sum of the second fusion weight and the first fusion weight is 1, so the second fusion weight is obtained by subtracting the first fusion weight from 1.
[0124] The image enhancement device obtains the initial high-frequency component of the first sub-image and the initial high-frequency component of the second sub-image. The calculation is referred to above, and the initial low-frequency component is first obtained by using bilateral filtering, TV (Total Variation), RTV (Rolling Guidance Total Variation), WLS (Weighted Least Squares) and other algorithms, and then the initial low-frequency component is subtracted from the brightness image to obtain the initial high-frequency component.
[0125] The calculation of the initial high-frequency component satisfies the following formula:
[0126]
[0127] in, represents the initial high-frequency component of the first image, represents the brightness map of the first image, represents an initial low-frequency component of the first image; represents the initial high-frequency component of the first sub-image, represents the brightness map of the first sub-image, represents the initial low-frequency component of the first sub-image; represents the initial high-frequency component of the second sub-image, represents the brightness map of the second sub-image, Represents the initial low-frequency component of the second sub-image.
[0128] The image enhancement device fuses the initial high-frequency component of the first sub-image and the initial high-frequency component of the second sub-image according to the first fusion weight of each pixel point in the first sub-image and the second fusion weight of the corresponding pixel point in the second sub-image to obtain the second target high-frequency component of the second image. Exemplarily, the calculation of the second target high-frequency component satisfies the following formula:
[0129]
[0130] in, represents the second target high frequency component, represents the initial low-frequency component of the first sub-image, represents the first fusion weight of the first sub-image, represents the initial high-frequency component of the second sub-image, Indicates the second fusion weight of the second sub-image. Thus, the first sub-image and the second sub-image are fused by the first fusion weight and the second fusion weight, so that the foreground mainly uses the first sub-image with lower fill light intensity, and the background mainly uses the second sub-image with higher fill light intensity, which solves the problem that the foreground fill light is too strong and easily overexposed, and the background fill light is too weak and the image is unclear.
[0131] In order to elaborate on the image enhancement method of the present application, Figure 5 The flowchart shown further illustrates it, and the details are as follows:
[0132] First, the brightness information and color information of the original image data of the first image and the second image (the first sub-image and the second sub-image) are obtained. Processing the original data can avoid the change of local information of the image after ISP processing, which leads to a decrease in the accuracy of image shadow judgment; shadow detection is performed on the first image and the second image according to the brightness information of the first image and the second image to obtain the target pixel point area and other pixel point areas; the target area boundary and other area boundaries are determined according to the target pixel point area and other pixel point areas; the first enhancement parameter and the second enhancement parameter are generated according to the target area boundary and the other area boundaries; the fusion weight of the high-frequency component is generated according to the second sub-image, including the first fusion weight of the first sub-image and the second fusion weight of the second sub-image; the high-frequency components of the first sub-image and the second sub-image are fused with the foreground and background high frequencies according to the first fusion weight and the second fusion weight to obtain the second target high-frequency component; the first target high-frequency component and the second target high-frequency component of the first image are fused according to the first enhancement parameter and the second enhancement parameter to obtain the fused high-frequency component; the target image is obtained based on the fused high-frequency component and the first target low-frequency component of the first image; finally, the final image is obtained by combining the color information of the first image.
[0133] See also Figure 6 , Figure 6 It is a structural schematic diagram of an exemplary embodiment of an image enhancement device shown in the present application. The image enhancement device 600 includes an acquisition module 610, a parameter determination module 620 and a fusion module 630. The acquisition module 610 is used to acquire a first image and a second image in the same scene. The fill light intensity of the first image and the second image is different. The pixels in the first image and the second image correspond to each other. The first image and the second image include the same target shadow area and other areas. The other areas are areas in the image other than the target shadow area. The parameter determination module 620 is used to determine the first enhancement parameter of each pixel in the first image and the second enhancement parameter of the corresponding pixel in the second image according to the area where each pixel is located in the first image. The fusion module 630 is used to perform image fusion processing on the first image and the second image according to the first enhancement parameter of each pixel in the first image and the second enhancement parameter of the corresponding pixel in the second image to obtain the target image.
[0134] In the above scheme, the image enhancement device obtains the first image and the second image of the same scene, the fill light intensity of the first image and the second image is different, the pixels in the first image and the second image correspond one to one, the first image and the second image include the same target shadow area and other areas, and the other areas are areas in the image other than the target shadow area; the first enhancement parameter of each pixel in the first image and the second enhancement parameter of the corresponding pixel in the second image are determined according to the area where each pixel is located in the first image; the first image and the second image are image fused according to the first enhancement parameter of each pixel in the first image and the second enhancement parameter of the corresponding pixel in the second image to obtain the target image. Thus, by obtaining the first image and the second image with different fill light intensities and fusing them, it is possible to compensate for the problems of unclear images and lack of prominent details caused by insufficient brightness, and by determining different enhancement parameters for the target shadow area and other areas of the first image and the second image, it is possible to avoid the influence of the target shadow area generated by the fill light on the target image.
[0135] The functions of each module can be found in the embodiment of the image enhancement method and will not be described in detail here.
[0136] To implement the image enhancement method of the above embodiment, the present application proposes another electronic device, for details, please refer to Figure 7 , Figure 7 It is a structural schematic diagram of an embodiment of an electronic device provided by the present application.
[0137] The electronic device 700 includes a memory 710 and a processor 720 , wherein the memory 710 and the processor 720 are coupled.
[0138] The memory 710 is used to store program data, and the processor 720 is used to execute the program data to implement the image enhancement method of the above embodiment.
[0139] In this embodiment, the processor 720 may also be referred to as a CPU (Central Processing Unit). The processor 720 may be an integrated circuit chip having signal processing capabilities. The processor 720 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. A general-purpose processor may be a microprocessor or the processor 720 may also be any conventional processor, etc.
[0140] The present application also provides a computer-readable storage medium, such as Figure 8 As shown, the computer-readable storage medium 800 is used to store program data 810. When the program data 810 is executed by a processor, it is used to implement the image enhancement method in the method embodiment of the present application.
[0141] The method involved in the embodiment of the image enhancement method of the present application, when implemented in the form of a software functional unit and sold or used as an independent product, can be stored in a device, such as a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or part of the contribution to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.
[0142] The above description is only an implementation method of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. An image enhancement method, characterized in that: The image enhancement method comprises: Acquire a first image and a second image of the same scene, wherein the first image and the second image have different fill light intensities, pixels in the first image and the second image correspond to each other one by one, and the first image and the second image include the same target shadow area and other areas, wherein the other areas are areas other than the target shadow area in the image; Determine, according to the area where each pixel point is located in the first image, a first enhancement parameter of each pixel point in the first image and a second enhancement parameter of the corresponding pixel point in the second image; Performing image fusion processing on the first image and the second image according to a first enhancement parameter of each pixel point in the first image and a second enhancement parameter of the corresponding pixel point in the second image to obtain a target image; The first enhancement parameter includes a first sub-enhancement parameter and a second sub-enhancement parameter, the second enhancement parameter includes a third sub-enhancement parameter and a fourth sub-enhancement parameter, and the step of determining the first enhancement parameter of each pixel in the first image and the second enhancement parameter of the corresponding pixel in the second image according to the area where each pixel is located in the first image includes: Determine enhancement parameters of pixels in the first image that are in the target shadow area as first sub-enhancement parameters, and determine enhancement parameters of pixels in the second image that are in the target shadow area as third sub-enhancement parameters; Determine enhancement parameters of pixels in the first image located in the other regions as second sub-enhancement parameters, and determine enhancement parameters of pixels in the second image located in the other regions as fourth sub-enhancement parameters; The fill light intensity of the first image is smaller than the fill light intensity of the second image, the first sub-enhancement parameter is larger than the third sub-enhancement parameter, and the second sub-enhancement parameter is smaller than the fourth sub-enhancement parameter.
2. The image enhancement method according to claim 1, characterized in that: The target shadow area includes a target pixel area and a target area boundary, the other areas include other pixel areas and other area boundaries, the first image and the second image in the same scene are acquired, the fill light intensity of the first image is different from that of the second image, the pixels in the first image and the second image correspond to each other one by one, the first image and the second image include the same target shadow area and other areas, and the other areas are areas in the image other than the target shadow area, comprising: Determine a target pixel point region and other pixel point regions in the first image and the second image according to the brightness information and fill light intensity of the first image and the brightness information and fill light intensity of the second image; The target region boundary and other region boundaries of the image are determined according to the target pixel region and the other pixel regions.
3. The image enhancement method according to claim 2, characterized in that: The brightness information includes the brightness value of each pixel and the gradient histogram of the image. The step of determining the target pixel area and other pixel areas in the first image and the second image according to the brightness information and fill light intensity of the first image and the brightness information and fill light intensity of the second image includes: Acquire a fill light intensity ratio between the fill light intensity of the second image and the fill light intensity of the first image; Obtaining an absolute value of a difference between a brightness value of each pixel in the second image and a brightness value of a corresponding pixel in the first image; Determine a first target pixel point area according to a magnitude relationship between the absolute value of the difference and the fill light intensity ratio; Determine a second target pixel point region from the first target pixel point region according to a magnitude relationship between a brightness value of each pixel point in the second image and a preset brightness value; Determining the target pixel point region from the second target pixel point region according to the gradient histogram of the second image; An area in the image except the target pixel area is determined as the other pixel area.
4. The image enhancement method according to claim 2, characterized in that: The step of determining the target region boundary and other region boundaries of the image according to the target pixel region and the other pixel regions comprises: Performing filtering calculation on the target pixel point region and the other pixel point regions to obtain an initial region boundary of the target pixel point region and an initial region boundary of the other regions; Determine the pixel points whose gradients in the gradient histogram of the second image are greater than a preset gradient threshold as the pixel points to be confirmed; In response to the fact that the pixel point to be confirmed exists in the initial area boundary of the target pixel point area, the corresponding pixel point to be confirmed is removed from the initial area boundary of the target pixel point area, and the pixel point to be confirmed is added to the initial area boundary of the other area to obtain the target area boundary of the target pixel point area and the other area boundaries of the other pixel point area.
5. The image enhancement method according to claim 2, characterized in that: The step of determining the target region boundary and other region boundaries of the image according to the target pixel region and the other pixel regions comprises: Connecting adjacent pixels between the target pixel point region and the other pixel point regions to obtain an initial region boundary of the target pixel point region and an initial region boundary of the other regions; The initial region boundary of the target pixel point region and the initial region boundaries of the other regions are widened to obtain the target region boundary and the other region boundaries of the image.
6. The image enhancement method according to claim 1, characterized in that: The step of performing image fusion processing on the first image and the second image according to the first enhancement parameter of each pixel point in the first image and the second enhancement parameter of the corresponding pixel point in the second image to obtain the target image includes: Respectively acquiring a first target high-frequency component and a first target low-frequency component of the first image, and a second target high-frequency component and a second target low-frequency component of the second image; fusing the first target high-frequency component and the second target high-frequency component according to a first enhancement parameter of each pixel point in the first image and a second enhancement parameter of the pixel point in the second image to obtain a fused high-frequency component; The target image is obtained based on the fused high-frequency component and the first target low-frequency component.
7. The image enhancement method according to claim 6, characterized in that: The second image includes a first sub-image and a second sub-image, the first sub-image and the second sub-image have the same fill-light direction, and the fill-light intensity of the second sub-image is greater than the fill-light intensity of the first sub-image; The step of acquiring a second target high-frequency component of the second image comprises: Determining, according to the brightness information of the second sub-image, a first fusion weight of each pixel point in the first sub-image and a second fusion weight of the corresponding pixel point in the second sub-image; Acquire an initial high-frequency component of the first sub-image and an initial high-frequency component of the second sub-image; The initial high-frequency component of the first sub-image and the initial high-frequency component of the second sub-image are fused according to the first fusion weight of each pixel point in the first sub-image and the second fusion weight of the corresponding pixel point in the second sub-image to obtain a second target high-frequency component of the second image.
8. An electronic device, characterized in that: include: A memory and a processor, wherein the memory stores program instructions, and the processor retrieves the program instructions from the memory to execute the method according to any one of claims 1 to 7.
9. A computer-readable storage medium, characterized in that: include: Program data is stored, and when the program data is executed by a processor, it is used to implement the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Image fusion method and apparatus, electronic device, and computer readable storage medium
CN108881730A
Image enhancement method and device, electronic equipment and computer readable storage medium
CN112819702A