An image processing method, apparatus, electronic device, and storage medium

By acquiring the control parameters of the current frame and performing digital gain and compression processing on the image based on the statistical brightness information of historical images, the problem of obtaining high dynamic range images in the prior art is solved, and high brightness and stable high dynamic range images can be obtained simply and at low cost in electronic devices.

CN119941596BActive Publication Date: 2026-07-03HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
Filing Date
2023-11-03
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively obtain high dynamic range images and cannot preserve the range of brightness differences between the darkest and brightest parts of an image.

Method used

By acquiring the control parameters of the current frame, digital gain processing and compression processing are performed on the initial image of the current frame based on the statistical brightness information of historical images, and the control parameters are adjusted to obtain a high dynamic range image with a target pixel value range.

Benefits of technology

It enables the simple and low-cost acquisition of high dynamic range images with appropriate brightness and stability in electronic devices, while preserving the image's highlight information and brightness difference range.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119941596B_ABST
    Figure CN119941596B_ABST
Patent Text Reader

Abstract

This application provides an image processing method, apparatus, electronic device, and storage medium. The method includes: acquiring current frame control parameters; obtaining an initial image of the current frame based on the current frame control parameters; performing digital gain processing and compression processing on the initial image of the current frame based on the current frame control parameters and a target pixel value range to obtain a compressed image with pixel value ranges within the target pixel value range, which is then used as the current frame output image; determining statistical brightness information corresponding to the target image, and adjusting the current frame control parameters based on the statistical brightness information corresponding to the target image to obtain target control parameters. The digital gain processing method is used to process the initial image of the current frame. The pixel value range of the image after digital gain processing is not less than the pixel value range of the image before digital gain processing, resulting in an image with a high pixel value range, retaining highlight information, and obtaining a high dynamic range image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, and in particular to an image processing method, apparatus, electronic device and storage medium. Background Technology

[0002] Image dynamic range is the range of brightness difference between the darkest and brightest parts of an image. A high dynamic range image is an image with a larger range of brightness difference between the darkest and brightest parts. Compared with ordinary images, it can provide more dynamic range and image detail, resulting in a better visual effect.

[0003] Therefore, an image processing method is needed to obtain high dynamic range images from images acquired by image acquisition devices. Summary of the Invention

[0004] The purpose of this application is to provide an image processing method, apparatus, electronic device, and storage medium to obtain high dynamic range images. The specific technical solution is as follows:

[0005] In a first aspect, embodiments of this application provide an image processing method, the method comprising:

[0006] Obtain the control parameters for the current frame, wherein the control parameters for the current frame are determined based on statistical brightness information corresponding to historical images, and the historical images are either a preset number of frames captured before the current frame or an image after image processing of the preset number of frames.

[0007] Based on the current frame control parameters, obtain the initial image of the current frame;

[0008] Based on the current frame control parameters and the target pixel value range, digital gain processing and compression processing are performed on the initial image of the current frame to obtain a compressed image with pixel value ranges within the target pixel value range, which is used as the current frame output image. The pixel value range of the image after digital gain processing is not less than the pixel value range of the image before digital gain processing, and the target pixel value range is preset based on the application requirements of the current frame output image.

[0009] The statistical brightness information corresponding to the target image is determined, and the control parameters of the current frame are adjusted based on the statistical brightness information corresponding to the target image to obtain the target control parameters. The target control parameters are used to control the acquisition and processing of the preset number of frames after the current frame. The target image is the initial image of the current frame, the image before digital gain processing, the image after digital gain processing, the image before compression processing, or the image after compression processing.

[0010] Secondly, embodiments of this application provide an image processing apparatus, the apparatus comprising:

[0011] The parameter acquisition module is used to acquire the control parameters of the current frame, wherein the control parameters of the current frame are determined based on the statistical brightness information corresponding to the historical images, and the historical images are the preset number of frames collected before the current frame or the images after image processing of the preset number of frames.

[0012] The image acquisition module is used to obtain the initial image of the current frame based on the current frame control parameters;

[0013] The image processing module is used to perform digital gain processing and compression processing on the initial image of the current frame based on the current frame control parameters and the target pixel value range, to obtain a compressed image with pixel value range within the target pixel value range, which is used as the current frame output image. The pixel value range of the image after digital gain processing is not less than the pixel value range of the image before digital gain processing, and the target pixel value range is preset based on the application requirements of the current frame output image.

[0014] The parameter adjustment module is used to determine the statistical brightness information corresponding to the target image, and adjust the current frame control parameters based on the statistical brightness information corresponding to the target image to obtain the target control parameters. The target control parameters are used to control the acquisition and processing of the preset number of frames after the current frame. The target image is the initial image of the current frame, the image before digital gain processing, the image after digital gain processing, the image before compression processing, or the image after compression processing.

[0015] Thirdly, embodiments of this application also provide an electronic device, including:

[0016] Memory, used to store computer programs;

[0017] When a processor executes a program stored in memory, it implements the method described in the first aspect above.

[0018] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the method described in the first aspect above.

[0019] Beneficial effects of the embodiments in this application:

[0020] In the solution provided in this application embodiment, for the initial image of the current frame obtained based on the current frame control parameters, the electronic device can process it using digital gain and compression processing methods. The pixel value range of the image after digital gain processing is not less than the pixel value range of the image before digital gain processing. In this way, the image after digital gain processing can also have a high pixel value range, retaining highlight information, and the brightness difference range between its darkest and brightest parts can be larger, thus obtaining a high dynamic range image. Furthermore, the current frame control parameters are determined based on the statistical brightness information corresponding to historical images. The historical images are the preset number of frames acquired before the current frame or the images after image processing of the preset number of frames. The target control parameters obtained based on the statistical brightness information corresponding to the target image are used to control the acquisition and processing of the preset number of frames after the current frame. The target image can be the initial image of the current frame, the image before digital gain processing, the image after digital gain processing, the image before compression processing, or the image after compression processing. In this way, the acquisition and processing of images can be controlled based on statistical brightness information, so that high dynamic range images with appropriate and stable brightness can be continuously obtained. The solutions provided in this application can very simply handle high dynamic range scenarios, have no special requirements for electronic device hardware, and are low in cost. Of course, implementing any product or method of this application does not necessarily require achieving all of the advantages described above simultaneously. Attached Figure Description

[0021] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other embodiments can be obtained based on these drawings.

[0022] Figure 1 A flowchart illustrating an image processing method provided in an embodiment of this application;

[0023] Figure 2 A schematic diagram illustrating the acquisition of the initial image of the current frame by the image acquisition device provided in this application embodiment;

[0024] Figure 3 A schematic diagram of the transmittance curve of a filter provided in an embodiment of this application;

[0025] Figure 4(a) is a schematic diagram of the pixel arrangement of the RGBW sensor provided in the embodiment of this application;

[0026] Figure 4(b) is a schematic diagram of the pixel arrangement of the Bayer sensor provided in the embodiment of this application;

[0027] Figure 4(c) is a schematic diagram of the pixel arrangement of the RGB-IR sensor provided in the embodiment of this application;

[0028] Figure 5 Figure 4(a) shows a schematic diagram of the spectral response curves corresponding to the pixel arrangement shown.

[0029] Figure 6 For based on Figure 1 A specific flowchart of step S103 in the illustrated embodiment;

[0030] Figure 7 For based on Figure 6 A schematic diagram of the image processing flow in the embodiment shown;

[0031] Figure 8 For based on Figure 1 A flowchart illustrating the method for determining statistical brightness information in step S104 of the illustrated embodiment;

[0032] Figure 9 For based on Figure 8 A schematic flowchart of the image processing process in the embodiment shown.

[0033] Figure 10 For based on Figure 8 A flowchart illustrating a parameter cache synchronization method in the embodiment shown;

[0034] Figure 11 For based on Figure 8 A specific flowchart of the method for adjusting initial parameters in the illustrated embodiment;

[0035] Figure 12 for Figure 11 A specific flowchart of determining the initial acquisition parameters in step S1102 of the embodiment shown;

[0036] Figure 13 for Figure 11 A specific flowchart of determining the initial processing parameters in step S1102 of the embodiment shown;

[0037] Figure 14 for Figure 11 A specific flowchart of determining the initial acquisition parameters in step S1103 of the embodiment shown;

[0038] Figure 15 for Figure 1 A specific flowchart of the method for adjusting control parameters in step S104 of the embodiment shown;

[0039] Figure 16 for Figure 15 A specific flowchart of step S1503 in the illustrated embodiment;

[0040] Figure 17 for Figure 8 A specific flowchart of step S801 in the illustrated embodiment;

[0041] Figure 18 This is a schematic diagram of an overall process of the image processing method provided in the embodiments of this application;

[0042] Figure 19 This is a schematic diagram of the structure of an image processing apparatus provided in an embodiment of this application;

[0043] Figure 20 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0044] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art based on this application are within the scope of protection of this application.

[0045] To obtain high dynamic range images, embodiments of this application provide an image processing method, apparatus, electronic device, computationally readable storage medium, and computer program product. The image processing method provided by the embodiments of this application will be introduced first.

[0046] The image processing method provided in this application embodiment can be applied to any electronic device that needs to process images to obtain high dynamic range images, such as image processing devices, image processors, servers, etc., without specific limitations.

[0047] like Figure 1 As shown, an image processing method includes:

[0048] S101, Obtain the control parameters for the current frame;

[0049] The current frame control parameters are determined based on statistical brightness information corresponding to historical images. The historical images are either a preset number of frames collected before the current frame or images after image processing of the preset number of frames.

[0050] S102, Based on the current frame control parameters, obtain the initial image of the current frame;

[0051] S103, based on the current frame control parameters and the target pixel value range, perform digital gain processing and compression processing on the initial image of the current frame to obtain a compressed image with pixel value range of the target pixel value range, which is used as the current frame output image;

[0052] The range of pixel values ​​in the image after digital gain processing is not less than the range of pixel values ​​in the image before digital gain processing, and the target pixel value range is preset based on the application requirements of the output image of the current frame.

[0053] S104, determine the statistical brightness information corresponding to the target image, and adjust the current frame control parameters based on the statistical brightness information corresponding to the target image to obtain the target control parameters.

[0054] The target control parameter is used to control the acquisition and processing of a preset number of frames after the current frame. The target image is the initial image of the current frame, the image before digital gain processing, the image after digital gain processing, the image before compression processing, or the image after compression processing.

[0055] As can be seen, in the solution provided by this application embodiment, for the initial image of the current frame obtained based on the current frame control parameters, the electronic device can process it using digital gain and compression processing methods. The pixel value range of the image after digital gain processing is not less than the pixel value range of the image before digital gain processing. In this way, the image after digital gain processing can also have a high pixel value range, retaining highlight information, and the brightness difference range between its darkest and brightest parts can be larger, thus obtaining a high dynamic range image. Furthermore, the current frame control parameters are determined based on the statistical brightness information corresponding to historical images. The historical images are the preset number of frames acquired before the current frame or the images after image processing of the preset number of frames. The target control parameters obtained based on the statistical brightness information corresponding to the target image are used to control the acquisition and processing of the preset number of frames after the current frame. The target image can be the initial image of the current frame, the image before digital gain processing, the image after digital gain processing, the image before compression processing, or the image after compression processing. In this way, the acquisition and processing of images can be controlled based on statistical brightness information, so that high dynamic range images with appropriate and stable brightness can be continuously obtained. The solution provided in this application embodiment can very simply handle high dynamic range scenarios, has no special requirements for electronic device hardware, and is low in cost.

[0056] In step S101 above, the electronic device can acquire the current frame control parameters. The current frame control parameters are determined based on the statistical brightness information corresponding to historical images and may include the current frame acquisition parameters and the current frame processing parameters. That is, the current frame acquisition parameters may be determined based on the statistical brightness information corresponding to a historical image prior to the initial image of the current frame.

[0057] For example, it could be the image of the previous frame, the two previous frames, or the five previous frames of the current frame's initial image, all of which are reasonable. Historical images could be images of a preset number of frames acquired before the current frame or images of images after image processing of the preset number of frames. Image processing could include preprocessing, compression, gain processing, intermediate processing, data truncation, and post-processing, etc., without specific limitations here.

[0058] Accordingly, the current frame processing parameters are determined based on the statistical brightness information corresponding to historical images, and these parameters include at least the digital gain. In other words, the current frame processing parameters can be determined based on the statistical brightness information corresponding to a historical image preceding the initial image of the current frame. For example, they could be the image preceding the initial image of the current frame, the two preceding images, the five preceding images, etc., all of which are reasonable.

[0059] Based on the aforementioned current frame control parameters, the initial image of the current frame can be obtained. For example, the current frame can be acquired based on the current frame acquisition parameters to obtain the initial image of the current frame, or the current frame can be acquired based on the current frame acquisition parameters, and preprocessing such as noise reduction, white balance, and deblurring can be performed on the current frame to obtain the initial image of the current frame. The brightness of the initial image of the current frame can be a preset brightness, which can be an image with slightly insufficient brightness (underexposed), or it can be an image with normal brightness.

[0060] like Figure 2 As shown, the image acquisition device mainly includes a lens 210, a filter assembly 220, and an image sensor 230. The lens 210 is a lens module composed of multiple lenses, which receives ambient light and focuses it into incident light; the amount of light entering can be controlled by adjusting the aperture. The filter assembly 220 is a filter module that allows only certain wavelengths of light to pass through while filtering out other wavelengths. Specifically, the spectral range that can enter the image sensor 230 can be controlled by coating techniques. The incident light, after passing through the filter, enters the image sensor 230.

[0061] For example, such as Figure 3The diagram shows a transmittance curve of a filter. The filter used in the filter module can pass through the visible light band of 340nm-650nm and the near-infrared light band of 930nm-970nm, while filtering out light of other bands; this is the first state. Simultaneously, the filter module can switch to a second state that only allows visible light to pass through, blocking infrared light greater than 650nm while allowing visible light less than or equal to 650nm to pass.

[0062] Image sensor 230 converts light signals into electrical signals. The brightness of the acquired image can be controlled by adjusting the sensor gain and exposure time. Filtered light passes through image sensor 230, and an image signal is output. Image sensor 230 can be an RGBW sensor, or a sensor with a Bayer or RGB-IR arrangement, or other arrangements. The pixel arrangements for RGBW, Bayer, and RGB-IR sensors are shown in Figures 4(a), 4(b), and 4(c), respectively. Taking an RGBW sensor as an example, its corresponding spectral response curve (the relationship between quantum efficiency and wavelength) is shown below. Figure 5 As shown.

[0063] The initial image of the current frame can be an image signal output by the image sensor 230, or it can be an image after preprocessing the image signal output by the image sensor 230; no specific limitation is made here. Preprocessing may include one or more of the following: noise reduction, white balance, and deblurring; no specific limitation is made here.

[0064] In one implementation, when the image sensor is in build-in wide dynamic range mode, the output image signal is a build-in high dynamic range image signal. Here, build-in wide dynamic range refers to a wide dynamic range data acquisition technique where the image sensor acquires multiple frames, synthesizes them to obtain a high data range image, and then compresses the high data range image into a low data range image using non-linear mapping before outputting it. Therefore, the preprocessing in this case may also include decompression processing.

[0065] Specifically, before performing digital gain processing and compression processing on the initial image of the current frame based on the current frame control parameters and the target pixel value range to obtain a compressed image with pixel value ranges within the target pixel value range, the method may further include: when the initial image of the current frame is a high dynamic range image signal, obtaining a preset brightness mapping curve for decompression processing; and mapping the nonlinear image in the initial image of the current frame to a linear image through the preset brightness mapping curve.

[0066] Decompression can be achieved through curve mapping. Specifically, a preset brightness mapping curve can be used to map the input nonlinear image to a linear image with a higher data range. The pixel value range of the linear image is wider than that of the nonlinear image. This preset brightness mapping curve corresponds to the build-in data compression curve in the sensor. In this way, the low data range image output by the image sensor can be restored to a high data range image through decompression.

[0067] For the initial image of the current frame, the electronic device can perform image processing to obtain the output image of the current frame. The image processing includes at least digital gain processing and compression processing. The pixel value range of the image after digital gain processing is not less than the pixel value range of the image before digital gain processing.

[0068] For example, if the pixel values ​​of the image before digital gain processing range from [L1, L1'], and the pixel values ​​of the image after digital gain processing range from [L2, L2'], then the pixel value range of the image after digital gain processing must not be less than the pixel value range of the image before digital gain processing, which means: (L1'-L1) ≤ (L2'-L2). In this way, through digital gain processing and compression processing, an image that retains the information of the highlighted areas can be obtained simply and quickly, meeting the application requirements of the current frame's output image.

[0069] Digital gain processing is a gain method used in digital signal processing, typically achieved by performing arithmetic operations on digital signals, such as multiplication. Therefore, after digital gain processing on the initial image of the current frame, the range of pixel values ​​is no less than the range of pixel values ​​in the image before digital gain processing. This allows for a larger range of brightness differences between the darkest and brightest parts, resulting in a high dynamic range image.

[0070] To obtain a high dynamic range image with a uniform range of pixel values, so as to facilitate the integration with subsequent image processing or application solutions, such as connecting to a display device with a defined display range, the range of pixel values ​​corresponding to the high dynamic range image to be obtained can be preset, that is, the target pixel value range. In other words, the target pixel value range is preset based on the application requirements of the output image of the current frame.

[0071] In this way, the electronic device can perform digital gain processing and compression processing on the initial image of the current frame according to the above-mentioned digital gain and target pixel value range, and obtain a compressed image with pixel value range of the target pixel value range, which is then used as the output image of the current frame.

[0072] Specifically, the electronic device can perform digital gain processing on the initial image of the current frame according to the aforementioned digital gain to obtain an image with a higher data range, and then compress the image with a higher data range according to the target pixel value range to obtain a compressed image with a pixel value range of the target pixel value range.

[0073] The aforementioned image processing package can be implemented through a logic platform containing signal processing algorithms or programs. This logic platform can be an electronic device based on X86 or ARM (Advanced RISC Machine) architecture, or an FPGA (Field-Programmable Gate Array) logic circuit, etc., without specific limitations.

[0074] Image processing performed on the initial image of the current frame can also include post-processing to obtain better visual effects. Post-processing can include one or more of the following methods: noise reduction, enhancement, dehazing, deblurring, and sharpening, without being specifically limited here.

[0075] In step S104 above, the electronic device can determine the statistical brightness information corresponding to the target image, and adjust the current frame control parameters based on the statistical brightness information to obtain target control parameters. These target control parameters are used to control the acquisition and processing of a preset number of frames following the current frame. The statistical brightness information is used to characterize the brightness of the currently captured image.

[0076] The target image can be the initial image of the current frame, the image before digital gain processing, the image after digital gain processing, the image before compression processing, or the image after compression processing. All of these are reasonable and no specific limitation is made here.

[0077] For example, the initial image of the current frame is acquired according to the target acquisition parameters corresponding to the previous frame image, and digital gain processing and compression processing are performed on the initial image of the current frame according to the target processing parameters corresponding to the previous frame image to obtain the output image corresponding to the initial image of the current frame. The target acquisition parameters and target processing parameters determined based on the target image are used to control the acquisition and digital gain processing of the subsequent frame image. This process is repeated cyclically to continuously obtain output images with appropriate and stable brightness and high dynamic range.

[0078] As can be seen, in this scheme, for the initial image of the current frame obtained based on the current frame control parameters, the electronic device can process it using digital gain and compression methods. The pixel value range of the image after digital gain processing is not less than the pixel value range of the image before digital gain processing. In this way, the image after digital gain processing can also have a high pixel value range, retaining highlight information, and the brightness difference range between its darkest and brightest parts can be larger, thus obtaining a high dynamic range image. Furthermore, the current frame control parameters are determined based on the statistical brightness information corresponding to historical images. The historical images are the preset number of frames acquired before the current frame or the images after image processing of the preset number of frames. The target control parameters, obtained based on the statistical brightness information corresponding to the target image, are used to control the acquisition and processing of the preset number of frames after the current frame. The target image can be the initial image of the current frame, the image before digital gain processing, the image after digital gain processing, the image before compression processing, or the image after compression processing. In this way, the acquisition and processing of images can be controlled based on statistical brightness information, enabling the continuous acquisition of high dynamic range images with appropriate and stable brightness. The solution provided in this application embodiment can very simply handle high dynamic range scenarios, has no special requirements for electronic device hardware, and is low in cost.

[0079] As one embodiment of this application, the above digital gain processing does not perform data truncation, or the above digital gain processing performs data truncation on the image after digital gain processing, so that the range of pixel values ​​of the image after data truncation is not less than the range of pixel values ​​of the image before digital gain processing.

[0080] In the digital gain processing described above, data truncation can be omitted, resulting in an image with a wider data range after digital gain processing. Alternatively, data truncation can be performed on the digital gain processed image, both of which are reasonable. The pixel value range of the truncated image should not be less than the pixel value range of the image before digital gain processing. This ensures that a digital gain processed image with a wide data range is still obtained, facilitating the preservation of image highlight information and simplifying subsequent image processing steps such as compression.

[0081] As one implementation, the step of performing digital gain processing and compression processing on the initial image of the current frame based on the current frame control parameters and the target pixel value range to obtain a compressed image with pixel value ranges within the target pixel value range may include:

[0082] The initial image of the current frame is digitally gained according to the digital gain included in the current frame control parameters to obtain a digitally gained image; a preset nonlinear mapping curve is used to perform brightness mapping on the digitally gained image to obtain a compressed image with pixel values ​​ranging from the target pixel value range.

[0083] For images processed by digital gain analysis, electronic devices can use a preset nonlinear mapping curve to perform brightness mapping on the processed images, resulting in a compressed image where the pixel value range is the target pixel value range. The compression parameters of the compression process are related to the digital gain of the digital gain analysis; that is, the preset nonlinear mapping curve needs to be related to the digital gain (dg).

[0084] The correlation is as follows: for different digital gains, the pixel value range of the resulting digitally gained image is different. The compression process adjusts the compression parameters according to these different pixel value ranges, so that the compressed image has the same pixel value range. Specifically, the preset nonlinear mapping curve satisfies the following conditions: the pixel value range of the input image is the same as the pixel value range of the digitally gained image, and the maximum value of the output image is the target pixel value range.

[0085] For example, if the pixel value range of the initial image in the current frame is (0, il1_max), then the pixel value range of the image after digital gain processing is (0, l2_max) = (0, il1_max) * dg. The pixel value range of the compressed image (0, ol1_max) is a pre-set value based on subsequent application conditions, i.e., the target pixel value range. Therefore, the nonlinear mapping curve needs to be set accordingly so that the pixel value range of the input image is (0, l2_max) and the pixel value range of the output image is (0, ol1_max).

[0086] As one implementation method, in order to improve the naturalness of the visual effect of the output image of the current frame, the part of the non-linear mapping curve with brightness less than the preset value lin_thr can be linearly mapped, that is, the value after mapping is equal to the value before mapping.

[0087] In one implementation, after obtaining the image after digital gain processing, the image can be divided into different regions, and the mapping curve corresponding to each region can be obtained. Then, based on the target pixel value range, brightness mapping processing is performed on each region through the mapping curve corresponding to each region to obtain the compressed image.

[0088] In other words, compression can also employ local mapping, which means using different mapping curves for different image regions to achieve better visual effects. The mapping curves for different regions should satisfy the requirement that the pixel value range of the input image is (0, l2_max) and the pixel value range of the output image is (0, ol1_max).

[0089] The compression process described above can also employ other mapping methods, such as retinex and histograms, all of which satisfy the requirement that the pixel values ​​of the input image are in the range of (0, l2_max) and the pixel values ​​of the output image are in the range of (0, ol1_max).

[0090] Electronic devices can perform digital gain processing and compression processing on the initial image of the current frame according to the digital gain and the target pixel value range, to obtain the current frame output image with the target pixel value range. In this way, it is possible to achieve unified processing of high dynamic range images with different pixel value ranges, so that the current frame output image has a uniform pixel value range, which facilitates the integration of subsequent image processing schemes and makes subsequent processing schemes simpler and easier to implement.

[0091] As one implementation method of this application, such as Figure 6 As shown, the steps described above, which involve performing digital gain processing and compression processing on the initial image of the current frame based on the current frame control parameters and the target pixel value range to obtain a compressed image within the target pixel value range, may include:

[0092] S601, if the digital gain included in the current frame control parameters is greater than a preset digital gain upper limit threshold, the preset digital gain upper limit threshold is used as the first digital gain, and the initial image of the current frame is subjected to first digital gain processing to obtain a first gain image.

[0093] The preset digital gain upper limit threshold is used to characterize the maximum value of the digital gain processing capability of the image processing logic platform. If the digital gain is not greater than the preset digital gain upper limit threshold, digital gain processing and compression processing can be performed in the manner described in the above embodiment to obtain a compressed image with pixel value range being the target pixel value range.

[0094] If the digital gain is greater than the preset digital gain upper limit threshold, and the initial image of the current frame is processed according to the digital gain, it will exceed the digital gain processing capability of the image processing logic platform and will also increase the processing resources required for subsequent processing. Therefore, the digital gain can be split into two parts, namely the first digital gain and the second digital gain.

[0095] In one implementation, the electronic device can use a preset digital gain upper limit threshold as the first digital gain to perform first digital gain processing on the initial image of the current frame to obtain a first gain image. That is, when the aforementioned digital gain dg is greater than dg_max, the first digital gain dg1 = min(dg, dg_max). Then, the electronic device can perform first digital gain processing on the initial image of the current frame according to dg1, that is, multiply the signal value of the initial image of the current frame by dg1 to obtain the first gain image.

[0096] S602, based on the preset pixel value range and the pixel value range of the first gain image, the first gain image is compressed to obtain a compressed image of the preset pixel value range;

[0097] To obtain a compressed image with a uniform pixel value range for convenient subsequent processing, the pixel value range of the compressed image can be preset, i.e., a preset pixel value range. In this way, the electronic device can compress the first gain image based on the preset pixel value range and the pixel value range of the first gain image to obtain a compressed image with the preset pixel value range.

[0098] For example, if the pixel value range of the initial image of the current frame is (0, l1_max), then the pixel value range of the first gain image is (0, l2_max) = (0, l1_max) * dg1. The preset pixel value range is (0, l3_max), so the compression processing of the first gain image must satisfy the following conditions: the pixel value range of the input image is (0, l2_max), and the pixel value range of the output image is (0, l3_max). The pixel value range of the compressed image is (0, l3_max). The specific compression processing method can be the same as the compression method in the above embodiments, only the pixel value ranges of the input and output images may be different, which will not be elaborated here.

[0099] S603, the ratio between the digital gain and the preset digital gain upper limit threshold is used as the second digital gain, and the compressed image is processed by the second digital gain to obtain the second gain image;

[0100] In order to ensure that the pixel value range of the second gain image obtained after the second digital gain processing meets the pixel value range requirement corresponding to the above digital gain, that is, the brightening degree after the first digital gain processing and the second digital gain processing is the same as the brightening degree after the digital gain processing using the above digital gain, the second digital gain should be the ratio between the digital gain and the above preset digital gain upper limit threshold, that is, dg2=dg1 / dg_max.

[0101] Therefore, the electronic device can perform second digital gain processing on the compressed image according to the second digital gain to obtain a second gain image. No data truncation is performed on the second gain image to obtain a high dynamic range image.

[0102] S604, based on the target pixel value range and the pixel value range of the second gain image, the second gain image is compressed to obtain a compressed image whose pixel value range is the target pixel value range.

[0103] After performing the second digital gain processing, compression processing can also be performed accordingly to obtain a compressed image with pixel value ranges equal to the target pixel value range. For example, if the gain value of the second gain processing module is dg2, then the pixel value range of the second gain image is (0, l4_max) = (0, l3_max) * dg2.

[0104] The maximum value ol1_max corresponding to the target pixel value range is a preset value based on subsequent application conditions. Therefore, the compression processing of the second gain image should satisfy the pixel value range of the input image as (0, l4_max) and the pixel value range of the output image as (0, ol1_max). The specific compression processing method can be the same as the compression method in the above embodiment, except that the pixel value ranges of the input image and the output image may be different, which will not be elaborated here.

[0105] In one implementation, such as Figure 7 As shown, after performing the first digital gain processing and the first compression processing on the initial image of the current frame, intermediate processing can be performed on the compressed image to obtain better image effects. The intermediate processing can include one or more of noise reduction, white balance, and deblurring, which are not specifically limited here.

[0106] Intermediate processing does not affect the range of pixel values ​​in the image. In other words, the range of pixel values ​​in the intermediate processed image is the same as that in the compressed image. Therefore, the specific process of performing the second digital gain processing and the second compression processing on the intermediate processed image is not affected, and a compressed image with a pixel value range of the target pixel value range can still be obtained.

[0107] As can be seen, in this embodiment, if the digital gain is greater than a preset digital gain upper threshold, the electronic device can use the preset digital gain upper threshold as the first digital gain to perform first digital gain processing on the initial image of the current frame, obtaining a first gain image. Based on the preset pixel value range and the pixel value range of the first gain image, the first gain image is compressed to obtain a compressed image within the preset pixel value range. Then, the ratio between the digital gain and the preset digital gain upper threshold is used as the second digital gain to perform second digital gain processing on the compressed image, obtaining a second gain image. Based on the target pixel value range and the pixel value range of the second gain image, the second gain image is compressed to obtain a compressed image with a pixel value range within the target pixel value range. In this way, even when the digital gain is large, it can ensure that the output image within the target pixel value range is obtained while avoiding an increase in processing resources due to an excessively large image pixel value range during processing. It ensures that a limited image pixel value range is maintained during intermediate processing, achieving a balance between processing resources and processing effect, and ensuring that the digital gain processing capability of the image processing logic platform is not exceeded.

[0108] As one implementation method of this application, such as Figure 8 As shown, the aforementioned statistical brightness information includes dynamic range expansion and brightness statistics. In this case, the step of determining the statistical brightness information corresponding to the target image may include:

[0109] S801, determine the dynamic range expansion value based on the bright pixels in the first target image and the preset bright target value;

[0110] To ensure that subsequent images have a high dynamic range, for the first target image, the electronic device can determine a dynamic range extension value based on the bright pixels in the first target image and a preset bright target value. The bright pixels are pixels whose brightness is higher than a preset brightness threshold. The preset bright target value can be determined according to the human eye's perception of the bright area, specifically a brightness value that makes the human eye feel comfortable in the bright area.

[0111] The first target image can be the initial image of the current frame, the image before digital gain processing, the image after digital gain processing, the image before compression processing, or the image after compression processing; all of these are reasonable.

[0112] The state of the bright pixels in the first target image represents the state of the bright areas in the current shooting scene. Based on the state of the bright areas in the current shooting scene and the brightness value that makes the bright areas comfortable for the human eye, the electronic device can determine the dynamic range that needs to be expanded relative to the initial image of the current frame if it wants to retain as much information about the bright areas in the current shooting scene as possible in subsequent images, while also making the images comfortable for the human eye to view. In other words, the dynamic range expansion value is used to represent the dynamic range required to retain the information about the bright areas in the current shooting scene.

[0113] Since the dynamic range extension value characterizes the dynamic range corresponding to the information of the highlighted areas in the current shooting scene, electronic devices preferentially determine this dynamic range extension value based on the image before digital gain processing. That is, the dynamic range extension value can be determined based on the highlighted pixels in the image signal output by the image sensor and a preset highlight target value, or it can be determined based on the highlighted pixels in the pre-processed image and the preset highlight target value; both are reasonable.

[0114] S802, determine the brightness statistics based on the brightness of the pixels in the second target image.

[0115] To ensure that subsequent images maintain stable and compliant brightness, the electronic device can determine brightness statistics based on the brightness of pixels in the second target image. These statistics characterize the brightness distribution of the second target image. The second target image can be the initial image of the current frame, the image before digital gain processing, the image after digital gain processing, the image before compression processing, or the image after compression processing—all are reasonable. The second target image can be the same as or different from the first target image.

[0116] Since digital gain processing changes image brightness, in order to facilitate subsequent adjustment of processing parameters based on the current digital gain, electronic devices can prioritize determining the brightness statistics based on the brightness of pixels in the image after digital gain processing. In other words, electronic devices can determine the brightness statistics based on the brightness of pixels in the image after digital gain processing of the initial image of the current frame according to the above, or they can determine the brightness statistics based on the brightness of pixels in the post-processed image.

[0117] If digital gain processing includes the first digital gain processing and the second digital gain processing described above, then the electronic device can determine the brightness statistics based on the brightness of the pixels in the second gain image, or it can determine the brightness statistics based on the brightness of the pixels in the image obtained by post-processing the second gain image, both of which are reasonable.

[0118] As can be seen, in this embodiment, the electronic device can determine the dynamic range expansion value based on the bright pixels in the first target image and a preset bright target value, and determine the brightness statistics value based on the brightness of the pixels in the second target image. This allows for the accurate determination of the dynamic range expansion value, which characterizes the dynamic range required to retain the bright area information in the current shooting scene, and the brightness statistics value, which characterizes the image brightness.

[0119] As one embodiment of this application, the aforementioned current frame control parameters may include current frame acquisition parameters and current frame processing parameters, and the target control parameters may include target acquisition parameters and target processing parameters. The step of adjusting the current frame control parameters based on the statistical brightness information corresponding to the target image to obtain the target control parameters may include:

[0120] Based on the relationship between the brightness statistics and the preset target brightness, the initial acquisition parameters and initial processing parameters are determined; based on the relationship between the initial processing parameters and the dynamic range expansion value, the initial acquisition parameters and initial processing parameters are adjusted to obtain the target acquisition parameters and target processing parameters.

[0121] After determining the brightness statistics, the electronic device can determine the initial acquisition parameters and initial processing parameters based on the relationship between the brightness statistics and the preset target brightness. The preset target brightness is a pre-set brightness value that makes the image more suitable for subsequent applications. By determining appropriate initial acquisition and processing parameters based on the relationship between the brightness statistics and the preset target brightness, the electronic device can ensure that the image acquired according to the initial acquisition parameters and processed according to the initial processing parameters achieves a brightness statistics value equal to the preset target brightness.

[0122] The target acquisition parameter is used to control the acquisition of the preset number of frames after the initial image of the current frame, and the target processing parameter is used to control the image processing of the preset number of frames after the initial image of the current frame to obtain the corresponding output image.

[0123] Since the dynamic range extension value represents the dynamic range required to retain the information of the bright areas in the current shooting scene, and the initial processing parameters determine the dynamic range of the image after digital gain based on the initial processing parameters, the electronic device can adjust the initial acquisition parameters and the initial processing parameters based on the relationship between the initial processing parameters and the dynamic range extension value to obtain the target acquisition parameters and the target processing parameters.

[0124] The adjusted target acquisition parameters and target processing parameters enable the output image of the preset number of frames after digital gain according to the target acquisition parameters to achieve the preset target brightness, and also have a high dynamic range adapted to the shooting scene.

[0125] The preset quantity can be 1, 2, 3, 5, etc., and is not specifically limited here. That is to say, the target acquisition parameters and target processing parameters determined based on the initial image of the current frame can be used to control the acquisition and digital gain processing of a subsequent frame image.

[0126] As one implementation method, such as Figure 9 As shown, on the one hand, the initial image of the current frame undergoes preprocessing to obtain a preprocessed image. The electronic device can then perform digital gain processing, compression processing, and post-processing to obtain the output image. On the other hand, the electronic device can perform image statistics on the preprocessed image, i.e., dynamic range statistics, to determine the dynamic range expansion value, and can also perform brightness statistics on the compressed image to obtain brightness statistical values. The dynamic range expansion value and brightness statistical values ​​are then used to subsequently determine the target acquisition parameters and target processing parameters.

[0127] After obtaining the target acquisition parameters and target processing parameters, the electronic device can cache the calculated target acquisition parameters and target processing parameters. In one implementation, such as... Figure 10 As shown, before the exposure of the k-th frame begins, the target acquisition parameters calculated based on the kp-th frame (p≥1) are synchronized to the image acquisition module to control the exposure acquisition of the k-th frame image. When processing of the k-th frame image begins, the target processing parameters calculated based on the kp-th frame are synchronized to the image processing module, so that the target processing parameters corresponding to the kp-th frame take effect on the processing of the k-th frame image. The value of p is related to the computing power of the image processing logic platform and the application requirements, and is not specifically limited.

[0128] Electronic devices can cache the target acquisition parameters and target processing parameters corresponding to each frame of image. Storage space can be reused according to the value of p, reducing resource consumption. For example, when the target acquisition parameters and target processing parameters corresponding to the k-th frame are cached, they can replace the target acquisition parameters and target processing parameters of the kp-th frame that have been synchronously output.

[0129] As can be seen, in this embodiment, the electronic device can determine the target acquisition parameters and target processing parameters based on the dynamic range extension value and brightness statistics. Thus, the output image acquired based on the target acquisition parameters and processed with digital gain based on the target processing parameters can have the required brightness, ensuring that the brightness is appropriate and stable, and possessing a high dynamic range output image adapted to the captured scene.

[0130] As one embodiment of this application, the step of adjusting the current frame acquisition parameters and the current frame processing parameters according to the relationship between the brightness statistics value and the preset target brightness to obtain the initial acquisition parameters and the initial processing parameters includes:

[0131] The brightness statistics are compared with the preset target brightness to obtain a comparison result; the parameter adjustment direction is determined based on the comparison result; the current frame acquisition parameters and the current frame processing parameters are adjusted according to the parameter adjustment direction to obtain the initial acquisition parameters and the initial processing parameters.

[0132] The comparison result obtained by comparing the brightness statistics value with the preset target brightness can characterize the relationship between the brightness statistics value and the preset target brightness. Based on the comparison result, the electronic device can determine whether the parameter adjustment direction is to increase, decrease or remain unchanged. Then, according to the parameter adjustment direction, the current frame acquisition parameters and the current frame processing parameters can be adjusted to obtain the initial acquisition parameters and the initial processing parameters.

[0133] If the brightness statistics value is less than the preset target brightness, it means that the brightness of the image after digital gain processing does not meet the requirements, and the brightness of subsequent images needs to be increased. Therefore, the acquisition parameters for subsequent images need to be adjusted accordingly compared to the acquisition parameters of the current frame. For example, the exposure time, aperture, and sensor gain can be increased. Similarly, the processing parameters for subsequent images need to be adjusted accordingly compared to the processing parameters of the current frame. For example, the digital gain can be increased.

[0134] If the brightness statistics value is greater than the preset target brightness, it indicates that the brightness of the image after digital gain processing is too high, and the brightness of subsequent images needs to be reduced. Therefore, the acquisition parameters for subsequent images need to be adjusted accordingly compared to the acquisition parameters of the current frame. For example, the exposure time, aperture, and sensor gain can be reduced. Similarly, the processing parameters for subsequent images need to be adjusted accordingly compared to the processing parameters of the current frame. For example, the digital gain can be reduced.

[0135] If the brightness statistics value equals the preset target brightness, it means that the brightness of the image after digital gain processing is appropriate, and the brightness of subsequent images can remain unchanged. Therefore, the acquisition parameters for subsequent images can remain unchanged relative to the acquisition parameters of the current frame. Similarly, the processing parameters for subsequent images can also remain unchanged relative to the processing parameters of the current frame.

[0136] Therefore, the electronic device can adjust the current frame acquisition parameters and the current frame processing parameters based on whether the brightness of the image processed by digital gain is appropriate, according to the relationship between the brightness statistics and the preset target brightness, so as to obtain the initial acquisition parameters and the initial processing parameters, so that the brightness of subsequent images meets the brightness requirements.

[0137] As one embodiment of this application, the current frame acquisition parameters may include at least exposure time, aperture, and sensor gain, and the current frame processing parameters may include at least digital gain.

[0138] Correspondingly, such as Figure 11 As shown, the steps described above, which adjust the current frame acquisition parameters and the current frame processing parameters according to the parameter adjustment direction to obtain the initial acquisition parameters and initial processing parameters, may include:

[0139] S1101, calculate the difference between the brightness statistics value and the preset target brightness. If the parameter adjustment direction is to increase, execute step S1102; if the parameter adjustment direction is to decrease, execute step S1103; if the parameter adjustment direction is unchanged, execute step S1104.

[0140] Since the difference between the brightness statistics and the preset target brightness can characterize the difference between the brightness of the image after digital gain processing and the preset target brightness, and the magnitude of acquisition parameters such as exposure time, aperture and sensor gain are positively correlated with the brightness of the acquired image, in order to facilitate subsequent adjustment of the current frame acquisition parameters and current frame processing parameters, the electronic device can calculate the difference between the brightness statistics and the preset target brightness. For example, it can be the ratio or difference between the brightness statistics and the preset target brightness.

[0141] After calculating the difference between the brightness statistics and the preset target brightness, the electronic device can adjust the current frame acquisition parameters and the current frame processing parameters differently according to the specific circumstances of the parameter adjustment direction.

[0142] S1102, based on the difference and the preset acquisition parameter threshold, the acquisition parameters of the current frame are increased sequentially according to the first set order to obtain the initial acquisition parameters; based on the initial acquisition parameters, the digital gain is adjusted to obtain the initial digital gain;

[0143] If the parameter adjustment direction is to increase, meaning the brightness statistics value is less than the preset target brightness, it indicates that the brightness of the image after digital gain processing is low and does not meet the preset target brightness requirement. In this case, it is necessary to increase the acquisition parameters and / or processing parameters. Since increasing the gain processing will amplify image noise, in order to reduce the amplification of image noise, the electronic device can adjust the acquisition parameters and / or processing parameters in the first set order, namely, exposure time, aperture, sensor gain, and digital gain.

[0144] Specifically, the difference between the brightness statistics value and the preset target brightness represents the degree of parameter adjustment. At the same time, the adjustment of each parameter has a maximum and minimum limit. It cannot be too high or too low, otherwise it will affect the image quality. Therefore, the electronic device can increase the current frame acquisition parameters in the first set order according to the difference between the brightness statistics value and the preset target brightness and the preset acquisition parameter threshold to obtain the initial acquisition parameters.

[0145] Since the brightness of the image after digital gain processing is determined by both the image acquisition parameters and the specific value of the digital gain, after adjusting the initial acquisition parameters, the electronic device can adjust the digital gain based on the initial acquisition parameters to obtain the initial digital gain, so that the brightness of the image acquired according to the initial acquisition parameters and the image after digital gain processing according to the initial digital gain can reach the preset target brightness.

[0146] S1103, adjust the digital gain according to the difference and the preset processing parameter threshold to obtain the initial digital gain; based on the initial digital gain, decrease the current frame acquisition parameters in sequence according to the second preset order to obtain the initial acquisition parameters;

[0147] If the parameter adjustment direction is to decrease, meaning the brightness statistics value is greater than the preset target brightness, it indicates that the brightness of the image after digital gain processing is too high and does not meet the preset target brightness requirement. In this case, it is necessary to reduce the acquisition parameters and / or processing parameters. Since gain processing amplifies image noise, in order to reduce the amplification of image noise and avoid flicker as much as possible, the electronic device can adjust the processing parameters and / or acquisition parameters in the second set order, namely digital gain, sensor gain, aperture, and exposure time.

[0148] Specifically, the difference between the brightness statistics value and the preset target brightness represents the degree of parameter adjustment. At the same time, the adjustment of each parameter has a maximum and minimum limit. It cannot be too high or too low, otherwise it will affect the image quality. Therefore, the electronic device can adjust the digital gain according to the difference between the brightness statistics value and the preset target brightness, as well as the preset processing parameter threshold, to obtain the initial digital gain.

[0149] Since the brightness of the image after digital gain processing is determined by both the image acquisition parameters and the specific value of the digital gain, after adjusting and obtaining the initial processing parameters, the electronic device can, based on the initial processing parameters, sequentially decrease the acquisition parameters of the current frame according to the second set order to obtain the initial acquisition parameters, so that the brightness of the subsequent images acquired according to the initial acquisition parameters and digitally gained according to the initial digital gain reaches the preset target brightness.

[0150] S1104, keep the exposure time, the aperture, the sensor gain, and the digital gain unchanged.

[0151] If the parameter adjustment direction remains unchanged, that is, the brightness statistics value is equal to the preset target brightness, it means that the brightness of the image after digital gain processing is appropriate and meets the requirements of the preset target brightness. At this time, the exposure time, aperture, sensor gain, and digital gain can remain unchanged. In this way, the brightness of the image acquired and processed according to the exposure time, aperture, sensor gain, and digital gain can meet the requirements of the preset target brightness.

[0152] As can be seen, in this embodiment, the electronic device can adjust the acquisition parameters and / or processing parameters in different ways based on the different magnitude relationships between the brightness statistics value and the preset target brightness, so as to obtain the initial acquisition parameters and initial processing parameters. This can make the brightness of the subsequently obtained image meet the requirements of the preset target brightness, while minimizing image noise and avoiding flicker as much as possible.

[0153] As one embodiment of this application, for the case where the first setting order is: exposure time, aperture, and sensor gain, and the second setting order is: sensor gain, aperture, and exposure time, the step of increasing the current frame acquisition parameters sequentially according to the first setting order based on the difference and the preset acquisition parameter threshold to obtain the initial acquisition parameters may include:

[0154] Based on the differences, the currently adjusted acquisition parameter is increased according to the first predetermined order to obtain corresponding candidate acquisition parameters; if the candidate acquisition parameter is greater than the upper limit threshold corresponding to the currently adjusted acquisition parameter, the upper limit threshold is used as the adjusted parameter corresponding to the currently adjusted acquisition parameter; the next parameter is determined as the currently adjusted acquisition parameter according to the first predetermined order, and the currently adjusted acquisition parameter is increased based on the adjusted parameter to obtain corresponding candidate acquisition parameters; the step of using the upper limit threshold as the adjusted parameter corresponding to the currently adjusted acquisition parameter if the candidate acquisition parameter is greater than the upper limit threshold corresponding to the currently adjusted acquisition parameter is returned, until all current frame acquisition parameters are adjusted. Specifically, as follows... Figure 12 As shown, the following steps may be included:

[0155] S1201, Calculate the product of the exposure time and the ratio of the preset target brightness to the brightness statistical value, and use it as the first alternative exposure time;

[0156] When the luminance statistics value is less than the preset target luminance, the exposure time can be increased preferentially based on the ratio between the preset target luminance and the statistics value. Specifically, the product of the exposure time included in the current acquisition parameters and this ratio can be calculated as the first alternative exposure time. Where y_dst is the preset target brightness, y_sta is the statistical brightness value, and t k-p This refers to the exposure time included in the currently collected parameters.

[0157] Thus, by acquiring subsequent images according to the increased exposure time (i.e., the first backup exposure time), while keeping other acquisition and processing parameters unchanged, the brightness values ​​of the subsequent images can be statistically analyzed as follows: It equals the preset target brightness.

[0158] S1202, if the first alternative exposure time is greater than the preset exposure time upper limit threshold, the preset exposure time upper limit threshold is used as the initial exposure time;

[0159] However, excessively increasing the exposure time can cause moving objects in the acquired image to appear to have a trailing effect, and the number of image frames acquired by the image sensor per unit time may not meet the application requirements. Therefore, electronic devices can compare the first alternative exposure time with the preset exposure time upper limit threshold t_max.

[0160] If the first alternative exposure time is not greater than the preset upper limit threshold for exposure time, no further adjustment is needed; the first alternative exposure time becomes the initial exposure time, and the aperture, sensor gain, and digital gain remain unchanged. That is, lr k =lr k-p sg k =sg k-p dg k =dg k-p , where lr k sg k and DG k These are the initial aperture, initial sensor gain, and initial digital gain, respectively. k-p sg k-p dg k-p These are the aperture, sensor gain, and digital gain, which are the parameters currently being acquired, and the parameters currently being processed.

[0161] If the first alternative exposure time is greater than the preset exposure time upper limit threshold, the preset exposure time upper limit threshold can be used as the initial exposure time, and then other parameters need to be adjusted.

[0162] S1203, based on the initial exposure time, the aperture is increased to obtain a first alternative aperture, so that the brightness of the image acquired by the image acquisition device based on the initial exposure time, the first alternative aperture and the sensor gain according to the digital gain can reach the preset target brightness;

[0163] If the first alternative exposure time is greater than the preset exposure time upper limit threshold, you can prioritize increasing the aperture (lr). k Greater than lr k-p This increases the amount of light entering the image, so that the brightness of the image acquired by the image acquisition device based on the initial exposure time, the first alternative aperture, and the aforementioned sensor gain can reach the preset target brightness.

[0164] S1204, if the first candidate aperture is greater than the preset aperture upper limit threshold, the preset aperture upper limit threshold is used as the initial aperture;

[0165] Similarly, the aperture cannot be too large, otherwise it will affect the image quality. Therefore, the electronic device can compare the first candidate aperture with the preset aperture upper limit threshold lr_max. If the first candidate aperture is not greater than the preset aperture upper limit threshold, there is no need to continue adjusting other parameters; the first candidate aperture becomes the initial aperture, and both sensor gain and digital gain remain unchanged. That is, sg k =sg k-p dg k =dg k-p .

[0166] If the first alternative aperture is larger than the preset aperture upper limit threshold, the preset aperture upper limit threshold can be used as the initial aperture, and then other parameters need to be adjusted.

[0167] S1205, based on the initial exposure time and the initial aperture, increase the sensor gain to obtain a first alternative sensor gain, so that the brightness of the image acquired by the image acquisition device based on the initial exposure time, the initial aperture and the first alternative sensor gain after processing according to the digital gain can reach the preset target brightness;

[0168] If the first alternative aperture is greater than the preset aperture upper limit threshold, the sensor gain sg can be increased first. k Greater than sg k-pFurthermore, the adjusted brightness statistics are increased. The electronic device can increase the sensor gain based on the initial exposure time and initial aperture to obtain a first alternative sensor gain, so that the brightness of the image acquired by the image acquisition device based on the initial exposure time, initial aperture and the first alternative sensor gain according to the above digital gain can reach the preset target brightness.

[0169] S1206, if the gain of the first candidate sensor is greater than the preset sensor gain upper limit threshold, the preset sensor gain upper limit threshold is used as the initial sensor gain.

[0170] Since sensor gain cannot be too high, otherwise it will affect image quality, the electronic device can compare the gain of the first candidate sensor with a preset sensor gain upper limit threshold sg_max. If the gain of the first candidate sensor is not greater than the preset sensor gain upper limit threshold, no further adjustment is needed, and the digital gain remains unchanged, i.e., dg. k =dg k-p .

[0171] If the gain of the first candidate sensor is greater than the preset upper limit threshold of sensor gain, the preset upper limit threshold of sensor gain will be used as the initial sensor gain, and then the digital gain needs to be adjusted further.

[0172] Accordingly, the step of adjusting the digital gain based on the initial acquisition parameters to obtain the initial digital gain may include:

[0173] Based on the initial acquisition parameters and the digital gain, an initial digital gain is determined so that the brightness of the image acquired by the image acquisition device based on the initial acquisition parameters, processed according to the initial digital gain, can reach the preset target brightness.

[0174] If the gain of the first alternative sensor is greater than the preset upper limit threshold for sensor gain, the electronic device can increase the digital gain dg. k Greater than dg k-p This further increases the adjusted brightness statistics. The electronic device can increase the digital gain based on the previously determined initial exposure time, initial aperture, and initial sensor gain to obtain an initial digital gain. This ensures that the brightness of the image subsequently processed by the image acquisition device based on the initial acquisition parameters, according to this initial digital gain, reaches the preset target brightness.

[0175] As can be seen, in this embodiment, when the brightness statistics value is less than the preset target brightness, the electronic device can adjust the acquisition parameters and processing parameters in the above manner to obtain the initial acquisition parameters and initial processing parameters. On the basis of ensuring the brightness requirements of subsequent images, the adjustment method is optimized to reduce image noise, trailing and other problems, and ensure the quality of subsequent images.

[0176] As one implementation method of this application, such as Figure 13 As shown, the step of adjusting the digital gain based on the difference and a preset processing parameter threshold to obtain the initial digital gain may include:

[0177] S1301, reduce the digital gain according to the difference to obtain an alternative digital gain;

[0178] When the statistical value of brightness exceeds the preset target brightness, the electronic device can reduce the digital gain based on the difference between the statistical value and the preset target brightness to obtain a candidate digital gain. For example, the digital gain can be reduced preferentially based on the ratio between the preset target brightness and the statistical brightness value. Specifically, the product of the digital gain included in the currently acquired parameters and this ratio can be calculated as the candidate digital gain. To reduce the digital magnification.

[0179] In this way, by processing subsequent images according to the reduced digital gain, i.e., the alternative digital gain, while keeping other acquisition parameters unchanged, the brightness values ​​of the subsequent images can be statistically analyzed as follows: It equals the preset target brightness.

[0180] S1302, if the candidate digital gain is less than the preset digital gain lower limit threshold, the preset digital gain lower limit threshold is used as the initial digital gain.

[0181] However, since excessive reduction of digital gain will cause subsequent images to fail to reach the required pixel value range, high dynamic range images cannot be obtained. Therefore, electronic devices can compare the alternative digital gain with the preset digital gain lower limit threshold dg_min.

[0182] If the alternative digital gain is not less than the preset lower threshold of digital gain, no further adjustment is needed. The alternative digital gain becomes the initial digital gain, and the sensor gain, aperture, and exposure time remain unchanged. k =sg k-p ,lr k =lr k-p t k =t k-p If the candidate digital gain is less than the preset lower limit threshold, the preset lower limit threshold can be used as the initial digital gain, and other parameters can then be adjusted.

[0183] Accordingly, the step of obtaining the initial acquisition parameters by sequentially decreasing the current frame acquisition parameters according to the second predetermined order based on the initial digital gain may include:

[0184] Based on the initial digital gain, the currently adjusted acquisition parameter is decreased according to the second preset order to obtain the corresponding candidate acquisition parameter; if the candidate acquisition parameter is less than the lower limit threshold corresponding to the currently adjusted acquisition parameter, the lower limit threshold is used as the adjusted parameter corresponding to the currently adjusted acquisition parameter; the next parameter is determined as the currently adjusted acquisition parameter according to the second preset order, and the currently adjusted acquisition parameter is decreased based on the adjusted parameter to obtain the corresponding candidate acquisition parameter; the process of returning to the step of using the lower limit threshold as the adjusted parameter corresponding to the currently adjusted acquisition parameter if the candidate acquisition parameter is less than the lower limit threshold is repeated until all current frame acquisition parameters have been adjusted. Specifically, as follows... Figure 14 As shown, the following steps may be included:

[0185] S1401, based on the initial digital gain, the sensor gain is reduced to obtain a second alternative sensor gain, so that the brightness of the image acquired by the image acquisition device based on the exposure time, the aperture and the second alternative sensor gain according to the initial digital gain can reach the preset target brightness;

[0186] If the candidate digital gain is less than the preset lower threshold digital gain, the sensor gain can be reduced first. The second alternative sensor gain is obtained to reduce the sensor magnification, so that the brightness of the image acquired by the image acquisition device based on the above exposure time, aperture and the second alternative sensor gain according to the initial digital gain can reach the preset target brightness.

[0187] S1402, if the gain of the second alternative sensor is less than the preset lower limit threshold of sensor gain, the preset lower limit threshold of sensor gain shall be used as the initial sensor gain.

[0188] Similarly, the sensor gain cannot be too small. Therefore, the gain of the second alternative sensor can be compared with the preset lower limit threshold sg_min. If the gain of the second alternative sensor is not less than the preset lower limit threshold, the gain of the second alternative sensor can be used as the initial sensor gain, without needing to adjust other parameters. That is, the aperture and exposure time remain unchanged, i.e., lr. k =lr k-p t k =t k-p .

[0189] If the gain of the second alternative sensor is less than the preset lower limit threshold for sensor gain, the preset lower limit threshold for sensor gain can be used as the initial sensor gain, and other parameters can be adjusted accordingly.

[0190] S1403, based on the initial digital gain and the initial sensor gain, the aperture is reduced to obtain a second alternative aperture, so that the brightness of the image acquired by the image acquisition device based on the exposure time, the second alternative aperture and the initial sensor gain according to the initial digital gain can reach the preset target brightness;

[0191] If the gain of the second alternative sensor is less than the preset lower limit threshold for sensor gain, the aperture lr can be reduced first. k Less than lr k-p To reduce the amount of light entering the camera, the aperture can be reduced based on the initial digital gain and the initial sensor gain to obtain a second alternative aperture. This ensures that the brightness of the image acquired by the image acquisition device based on the initial digital gain, the exposure time, the second alternative aperture, and the initial sensor gain can reach the preset target brightness.

[0192] S1404, if the second alternative aperture is smaller than the preset aperture lower limit threshold, the preset aperture lower limit threshold is used as the initial aperture;

[0193] Since the aperture cannot be too small, otherwise it will affect the image quality, the electronic device can compare the second alternative aperture with the preset lower aperture threshold lr_min. If the second alternative aperture is not smaller than the preset lower aperture threshold, there is no need to continue adjusting other parameters; the second alternative aperture becomes the initial aperture, and the exposure time remains unchanged, i.e., t. k =t k-p .

[0194] If the second alternative aperture is smaller than the preset lower aperture threshold, the preset lower aperture threshold can be used as the initial aperture, and the exposure time needs to be adjusted further.

[0195] S1405, based on the initial digital gain, the initial aperture, and the initial sensor gain, the exposure time is reduced to obtain an initial exposure time, so that the brightness of the image acquired by the image acquisition device based on the initial exposure time, the initial aperture, and the initial sensor gain according to the initial digital gain can reach the preset target brightness.

[0196] If the second alternative aperture is smaller than the preset lower aperture threshold, the electronic device can further reduce the exposure time. The electronic device can reduce the exposure time based on the initial digital gain, initial aperture, and initial sensor gain to obtain the initial exposure time, so that the brightness of the image subsequently processed by the image acquisition device based on the initial exposure time, initial aperture, and initial sensor gain can reach the preset target brightness.

[0197] As can be seen, in this embodiment, when the brightness statistical value is greater than the preset target brightness, the electronic device can adjust the acquisition parameters and processing parameters in the above manner to obtain the initial acquisition parameters and initial processing parameters. On the basis of ensuring the brightness requirements of subsequent images, the adjustment method is optimized to reduce image noise, flicker and other problems, and ensure the quality of subsequent images.

[0198] As one implementation method of this application, such as Figure 15 As shown, the steps described above, which adjust the initial acquisition parameters and the initial processing parameters based on the relationship between the initial processing parameters and the dynamic range expansion value to obtain the target acquisition parameters and the target processing parameters, may include:

[0199] S1501, if the initial digital gain is less than the dynamic range extension value, the dynamic range extension value is determined as the target digital gain;

[0200] If the initial digital gain is less than the dynamic range extension value, it means that the initial digital gain is insufficient to maintain the information of the bright areas in the current shooting scene. In this case, the electronic device can determine the dynamic range extension value as the target digital gain. In this way, subsequent digital gain processing based on the target digital gain can maintain the information of the bright areas in the current shooting scene.

[0201] If the initial digital gain is not less than the dynamic range extension value, it indicates that the initial digital gain is sufficient to maintain the information of the bright areas in the current shooting scene. Therefore, the electronic device can determine the initial digital gain as the target digital gain. By acquiring subsequent images using the aforementioned initial sensor gain, initial exposure time, and initial aperture, and performing digital gain processing on the subsequent images based on the target digital gain, a high dynamic range can be obtained that meets the preset target brightness requirements and is adapted to the shooting scene. Therefore, the electronic device can determine the aforementioned initial sensor gain, initial exposure time, and initial aperture as the target sensor gain, target initial exposure time, and target initial aperture, respectively.

[0202] S1502, Calculate the difference between the initial digital gain and the target digital gain;

[0203] Since the dynamic range extension value is determined as the target digital gain, the brightness of subsequent images processed based on this target digital gain will be higher than the preset target brightness. Therefore, to ensure that the brightness of subsequent images meets the preset target brightness requirement, the initial acquisition parameters need to be lowered. The degree to which the initial acquisition parameters need adjustment is related to the difference between the initial digital gain and the target digital gain. Therefore, the electronic device can calculate the difference between the initial digital gain and the target digital gain to facilitate the lowering of the initial acquisition parameters. The difference between the initial digital gain and the target digital gain can be the ratio or difference between the initial digital gain and the target digital gain.

[0204] S1503, based on the difference and the preset acquisition parameter threshold, the initial acquisition parameters are adjusted sequentially according to the third set order to obtain the target acquisition parameters.

[0205] Since the limitation of the preset acquisition parameter threshold also needs to be considered when adjusting the initial acquisition parameters to ensure that the subsequent images have stable image brightness and image effect, the electronic device can adjust the initial acquisition parameters based on the difference between the initial digital gain and the target digital gain and the preset acquisition parameter threshold.

[0206] Specifically, the electronic device can adjust the initial sensor gain, initial aperture, and initial exposure time in a third preset order to obtain the target acquisition parameters. This can minimize subsequent image noise and avoid flickering.

[0207] As can be seen, in this embodiment, if the initial digital gain is less than the dynamic range extension value, the electronic device can determine the dynamic range extension value as the target digital gain, calculate the difference between the initial digital gain and the target digital gain, and then, based on the difference and a preset acquisition parameter threshold, adjust the initial acquisition parameters sequentially according to a third preset order to obtain the target acquisition parameters. If the initial digital gain is not less than the dynamic range extension value, the electronic device can determine the initial digital gain as the target digital gain, and determine the initial sensor gain, initial exposure time, and initial aperture as the target sensor gain, target initial exposure time, and target initial aperture, respectively. In this way, regardless of whether the initial digital gain is less than the dynamic range extension value, the electronic device can determine appropriate target acquisition parameters and target processing parameters so that the subsequent image meets the required brightness and has a high dynamic range suitable for the current shooting scene.

[0208] As one implementation of this application, the third setting order described above can be: initial sensor gain, initial aperture, and initial exposure time. Correspondingly, the step of adjusting the initial acquisition parameters sequentially according to the third setting order based on the difference and a preset acquisition parameter threshold to obtain the target acquisition parameters can include:

[0209] Based on the aforementioned differences, following a third predetermined order, the initial acquisition parameter is reduced to obtain candidate target acquisition parameters. If the candidate target acquisition parameter is less than the lower threshold corresponding to the initial acquisition parameter, this lower threshold is used as the adjusted parameter corresponding to the current acquisition parameter. Following the third predetermined order, the next parameter is determined as the current acquisition parameter, and the initial acquisition parameter is reduced based on the adjusted parameter to obtain the corresponding candidate target acquisition parameter. The process of returning to the step of using the lower threshold as the adjusted parameter if the candidate target acquisition parameter is less than the lower threshold corresponding to the initial acquisition parameter, continues until all current frame acquisition parameters have been adjusted. Specifically, as follows... Figure 16 As shown, the following steps may be included:

[0210] S1601, Based on the difference between the initial sensor gain and the sensor gain, determine the gain of the third candidate sensor; if the gain of the third candidate sensor is not less than the preset lower limit threshold of sensor gain, proceed to step S1602; if the gain of the third candidate sensor is less than the preset lower limit threshold of sensor gain, proceed to step S1603.

[0211] If the adjusted sensor gain and target digital gain are to have the same effect on image gain as the initial digital gain used for image gain processing, the adjusted sensor gain should be able to compensate for the difference between the initial digital gain and the target digital gain. In order to ensure the image processing effect and meet the computing requirements of the logic platform, the adjusted sensor gain should not be too small. Therefore, the electronic device can determine a third alternative sensor gain based on the initial sensor gain and the difference, and then compare the third alternative sensor gain with the preset sensor gain lower limit threshold.

[0212] In one implementation, the electronic device can calculate the ratio of the initial digital gain to the target digital gain, and then determine the product of the initial sensor gain and that ratio. As a third alternative sensor gain. Among them, sg ’ k For the third alternative sensor gain, sg k For the initial sensor gain, dg ’ k For the target digital gain, dg k This is the initial digital gain.

[0213] S1602, the third alternative sensor gain is used as the target sensor gain; the initial exposure time and the initial aperture are respectively determined as the target exposure time and the target aperture;

[0214] If the gain of the third alternative sensor is not less than the preset lower limit threshold of sensor gain, it means that the gain of the third alternative sensor meets the image processing effect and the operation requirements of the logic platform, and the electronic device can use the gain of the third alternative sensor as the target sensor gain.

[0215] Since the target sensor gain is already sufficient to ensure that the brightness of the subsequent image meets the preset target brightness requirements, the initial aperture and initial exposure time no longer need to be adjusted. The initial exposure time and initial aperture are the target exposure time and target aperture, respectively.

[0216] S1603, the preset sensor gain lower limit threshold is used as the target sensor gain;

[0217] If the gain of the third alternative sensor is less than the preset lower limit threshold for sensor gain, it indicates that the gain of the third alternative sensor does not meet the image processing effect and the operational requirements of the logic platform. In this case, the electronic device can use the preset lower limit threshold for sensor gain as the target sensor gain. Further adjustments to other acquisition parameters are then necessary to ensure that the brightness of subsequent images meets the preset target brightness requirements.

[0218] S1604, based on the target digital gain and the target sensor gain, the initial aperture is reduced to obtain a third alternative aperture, so that the brightness of the image acquired by the image acquisition device based on the initial exposure time, the third alternative aperture and the target sensor gain according to the target digital gain can reach the preset target brightness;

[0219] The electronic device can pre-adjust the aperture. Specifically, the electronic device can reduce the initial aperture based on the target digital gain and the target sensor gain to obtain a third alternative aperture, so that the brightness of the image obtained by processing the image acquired by the image acquisition device based on the initial exposure time, the third alternative aperture and the target sensor gain according to the target digital gain can meet the preset target brightness requirements.

[0220] S1605, if the third alternative aperture is smaller than the preset aperture lower limit threshold, the preset aperture lower limit threshold is used as the target aperture;

[0221] If the third alternative aperture is not less than the preset aperture lower limit threshold, it means that the third alternative aperture can be used as the target aperture to ensure that the brightness of the subsequent image meets the preset target brightness requirements. Therefore, no further adjustment is needed, the third alternative aperture is the target aperture, and the initial exposure time remains unchanged.

[0222] If the third alternative aperture is smaller than the preset aperture lower limit threshold, the electronic device can use the preset aperture lower limit threshold as the target aperture. At this time, the target aperture cannot guarantee that the brightness of the subsequent image meets the preset target brightness requirement, so the exposure time needs to be further reduced.

[0223] S1606, based on the target digital gain, the target aperture, and the target sensor gain, the initial exposure time is reduced to obtain a target exposure time, so that the brightness of the image acquired by the image acquisition device based on the target exposure time, the target aperture, and the target sensor gain, after processing according to the target digital gain, can reach the preset target brightness.

[0224] Electronic devices can reduce the initial exposure time based on the target digital gain, target aperture, and target sensor gain to obtain the target exposure time. This ensures that the brightness of the image obtained after processing the image acquired by the image acquisition device based on the target exposure time, target aperture, and target sensor gain according to the target digital gain can meet the preset target brightness requirements.

[0225] As can be seen, in this embodiment, when the initial digital gain is less than the dynamic range extension value, the electronic device can reduce the initial acquisition parameters in the manner described above. This ensures that the brightness of the subsequent image can meet the preset target brightness requirement without being too bright, while maintaining a high dynamic range.

[0226] As one embodiment of this application, if the image acquisition device does not support automatic aperture adjustment, the aperture adjustment part can be deleted accordingly in any of the above embodiments. That is, the aperture adjustment process is not performed, and the control parameters can be adjusted by adjusting the sensor gain, exposure time and digital processing.

[0227] As one implementation method of this application, such as Figure 17 As shown, the step of determining the dynamic range extension value based on the highlighted pixels in the first target image and the preset highlighted target value may include:

[0228] S1701, Determine the highlight statistics based on the brightness and number of highlighted pixels in the first target image;

[0229] Since bright pixels are those whose brightness exceeds a preset brightness threshold in the initial image of the current frame, a larger bright pixel count indicates the presence of bright areas in the captured scene, requiring a larger dynamic range extension value to preserve this bright area information. Therefore, to accurately determine the dynamic range extension value, the electronic device can determine the bright pixel count based on the brightness and number of bright pixels in the first target image.

[0230] S1702, determine the dynamic range expansion value based on the difference between the high brightness statistics value and the preset high brightness target value and the preset dynamic range expansion value threshold.

[0231] Furthermore, the dynamic range expansion value can be determined based on the difference (e.g., ratio, difference, etc.) between the highlight statistics and the preset highlight target value, as well as the preset dynamic range expansion value threshold. The preset highlight target value is used to characterize a brightness value that is visually appropriate for the highlighted areas of the image. The preset dynamic range expansion value threshold is determined based on the computing power or noise reduction capability of the image processing logic platform, so that the noise amplification during digital processing based on the dynamic range expansion value is within a preset range.

[0232] On the one hand, the difference between the highlight statistics and the preset highlight target value represents the gap between the brightness of the highlighted areas in the current frame and the brightness value that is considered suitable for human visual perception. On the other hand, since a larger dynamic range extension value requires a larger digital gain to process subsequent images, it leads to more severe noise amplification. Therefore, in order to ensure that the brightness values ​​of the highlighted areas in subsequent images are appropriate while keeping noise amplification within a preset range, the dynamic range extension value can be determined based on the difference between the highlight statistics and the preset highlight target value, as well as the preset dynamic range extension value threshold.

[0233] As one implementation method, the ratio between the highlight statistics value and the preset highlight target value can be used as the candidate dynamic range expansion value. Then, the smaller of the candidate dynamic range expansion value and the preset dynamic range threshold is taken as the final dynamic range expansion value.

[0234] As can be seen, in this embodiment, the brightness statistics can be determined based on the brightness and number of bright pixels in the first target image. Then, the dynamic range expansion value is determined based on the difference between the brightness statistics and the preset bright target value, as well as the preset dynamic range expansion value threshold. This not only ensures that the brightness values ​​of the height regions in subsequent images are appropriate, but also ensures that noise amplification is within the preset range, thereby ensuring that subsequent images have stable brightness and a suitable high dynamic range.

[0235] As one implementation of this application, the step of determining the highlight statistics based on the brightness and number of highlight pixels in the first target image may include:

[0236] Based on the brightness and number of highlighted pixels in the first target image, calculate the average brightness of the highlighted pixels in the first target image as a highlight statistical value; or, determine the weight corresponding to each highlighted pixel according to the location of each highlighted pixel in the first target image and the preset relationship between position and weight; calculate the weighted average brightness of the highlighted pixels based on the weight and the number of highlighted pixels as a highlight statistical value; or, determine the weight corresponding to each highlighted pixel according to the location of each highlighted pixel in the first target image and the preset relationship between position and weight; calculate the weighted average brightness of the highlighted pixels based on the weight and the number of highlighted pixels; adjust the weighted average based on the number of highlighted pixels and the preset highlight target value to obtain the highlight statistical value.

[0237] Highlight statistics can be determined based on the brightness and number of highlighted pixels in the first target image. Specifically, at least one of the following three methods can be used to determine the highlight statistics.

[0238] In the first implementation, the average brightness of the highlighted pixels in the first target image can be calculated based on the brightness and number of highlighted pixels in the first target image, and used as a highlight statistical value. For example, if the preset brightness threshold is 220, and the number of pixels with a brightness higher than 220 in the first target image is 307, then the electronic device calculates the average brightness of these 307 highlighted pixels as the highlight statistical value.

[0239] In the second implementation, the weight of each highlighted pixel can be determined based on its location in the first target image and the preset relationship between position and weight. Since highlighted pixels at different locations have different effects on human visual perception, the relationship between pixel position and weight can be preset.

[0240] For example, bright pixels located in the central region of an image may have a greater impact on the visual perception of the human eye, while bright pixels located at the edge of the image may have a smaller impact. Therefore, the weight corresponding to the central region can be larger, while the weight corresponding to the edge position can be smaller.

[0241] For example, the content in an image that a user is interested in may differ. The highlighted pixels located where the content that the user is interested in is likely to have a greater impact on the visual perception of the human eye, while the highlighted pixels located in other positions are likely to have a smaller impact on the visual perception of the human eye. Therefore, the weight corresponding to the position of the content that the user is interested in can be greater, while the weight corresponding to other positions can be smaller.

[0242] In this way, the weight of each highlighted pixel can be determined based on its location in the first target image and the preset relationship between position and weight. For example, the preset relationship between position and weight includes a weight of 0.8 for the central region and a weight of 0.2 for the edge region. Therefore, if a highlighted pixel A is located in the central region, the weight of highlighted pixel A is 0.8.

[0243] Once the weight corresponding to each highlight pixel is determined, the weighted average of the brightness of the highlight pixels can be calculated based on the determined weight and the number of highlight pixels, which serves as the highlight statistics.

[0244] In the third embodiment, the weighted average value of the brightness of the bright pixels can be determined based on the second method described above. Then, based on the number of bright pixels and the preset bright target value, the weighted average value can be adjusted to obtain the bright statistical value.

[0245] Specifically, the number of highlighted pixels can be counted. If the number is small, the weighted average value can be adjusted to approach the preset highlight target value; if the number is large, the weighted average value can be directly used as the highlight statistical value. In this way, different degrees of highlight suppression can be achieved based on the size of the highlighted area in the image.

[0246] As can be seen, in this embodiment, regardless of the method used, the highlight statistics can be accurately determined to ensure the accurate determination of the dynamic range extension value. This further ensures that subsequent adjustments to the acquisition and exposure parameters based on the dynamic range extension value enable the subsequent image to possess an adaptive high dynamic range.

[0247] As one embodiment of this application, the step of determining the brightness statistics based on the brightness of pixels in the second target image may include:

[0248] Calculate the average brightness of pixels in the second target image as a brightness statistical value; or, determine the weight corresponding to each pixel based on the location of each pixel in the second target image and the preset relationship between position and weight; calculate the weighted average brightness of the pixels based on the weights as a brightness statistical value; or, determine the weight corresponding to each pixel based on the brightness of each pixel in the second target image and the preset relationship between brightness and weight; calculate the weighted average brightness of the pixels based on the weights as a brightness statistical value; or, take the smaller value between the brightness of each pixel in the gain-processed image and a preset brightness statistical threshold as the statistical brightness of that pixel; calculate the brightness statistical value based on the statistical brightness of each pixel.

[0249] Brightness statistics can be determined based on the brightness of pixels in the second target image. Specifically, at least one of the following methods can be used to determine the brightness statistics.

[0250] In the first implementation, the average brightness of the pixels in the second target image can be calculated as a brightness statistic. This brightness statistic can thus characterize the average brightness of the image after gain processing.

[0251] In the second implementation, since the brightness of pixels at different locations has different effects on the visual perception of the human eye, the relationship between location and weight can be preset. For example, pixels located in the central region of the image may have a greater impact on the visual perception of the human eye, while pixels located at the edge of the image may have a smaller impact. Therefore, the weight corresponding to the central region can be larger, while the weight corresponding to the edge position can be smaller.

[0252] In this way, the weight corresponding to each pixel can be determined based on the location of each pixel in the second target image and the preset relationship between position and weight. Then, based on the determined weights, a weighted average of the pixel brightness can be calculated as a brightness statistic. This brightness statistic can characterize the average brightness of the image after gain processing, which takes into account the influence of pixels at different locations on human visual perception.

[0253] In the third implementation, since pixels of different brightness have different effects on the visual perception of the human eye, the relationship between brightness and weight can be preset. For example, pixels with higher brightness and pixels with lower brightness may have a greater impact on the visual perception of the human eye, while pixels with moderate brightness may have a smaller impact. Therefore, pixels with higher brightness and lower brightness can have larger weights, while pixels with moderate brightness can have smaller weights.

[0254] In this way, the weight corresponding to each pixel can be determined based on the brightness of each pixel in the second target image and the preset relationship between brightness and weight; then, based on the determined weight, the weighted average brightness of the pixels can be calculated as a brightness statistic. This brightness statistic can characterize the average brightness of the second target image, taking into account the influence of pixels with different brightness on human visual perception.

[0255] In the fourth embodiment, the electronic device can use the smaller value between the brightness of a pixel in the second target image and a preset brightness statistical threshold as the statistical brightness of that pixel. The preset brightness statistical threshold is used to characterize the minimum value of the image brightness statistics. If the brightness of a pixel in the second target image is smaller than the preset brightness statistical threshold, it indicates that the brightness of that pixel is not affected by overexposure, and its brightness can be directly used as the statistical brightness. If the brightness of a pixel in the second target image is not less than the preset brightness statistical threshold, to avoid the effect of overexposure, the smaller of the preset brightness statistical threshold and the brightness of the pixel in the second target image can be used as the statistical brightness.

[0256] Furthermore, a luminance statistical value can be calculated based on the statistical luminance of each pixel. Specifically, the luminance statistical value can be calculated according to any of the first to third embodiments described above, except that the luminance of each pixel in the above three embodiments is replaced with the statistical luminance of each pixel. For details, please refer to the descriptions of the above three embodiments, which will not be repeated here.

[0257] As can be seen, in this embodiment, regardless of which method is used, the brightness statistics can be accurately obtained, so as to ensure that the acquisition parameters and exposure parameters are accurately adjusted based on the brightness statistics, so that the subsequent image has a stable and appropriate brightness.

[0258] The following is combined Figure 18 The image processing method provided in the embodiments of this application will be described with examples. For instance... Figure 18 As shown in the embodiments of this application, the image processing method can be applied to an image processing system, which may include an image acquisition unit, an image processing unit, a statistics unit, an exposure control unit, and a buffer unit.

[0259] The image acquisition unit can acquire images based on the acquisition parameters of the KNth frame stored in the buffer unit, converting the light signal into an image signal (the Kth frame image). Then, the image processing unit can perform image processing on the image signal based on the processing parameters of the KNth frame to obtain the output image. The acquisition parameters of the KNth frame are target acquisition parameters determined based on the brightness statistics and dynamic range expansion values ​​of the Nth frame images preceding the current frame image, and the processing parameters of the KNth frame are target processing parameters determined based on the brightness statistics and dynamic range expansion values ​​of the Nth frame images preceding the current frame image.

[0260] The statistical unit can perform dynamic range statistics on the first statistical image obtained by the image processing unit to determine the dynamic range extension value. The first statistical image is an image that has not undergone digital gain processing. It can be an image signal output by an image sensor or the image after the above preprocessing.

[0261] The statistics unit can perform brightness statistics on the second statistical image obtained by the image processing unit and determine the brightness statistics value. The second statistical image is an image after digital gain processing. It can be an image after digital gain processing of the Kth frame image, or the image after the above post-processing, or an image after compression processing.

[0262] If digital gain processing includes the first digital gain processing and the second digital gain processing described above, the second statistical image can also be the second gain image described above, or it can be an image obtained by post-processing the second gain image, or it can be an image obtained by compressing the second gain image. No specific limitation is made here.

[0263] Furthermore, the statistical unit can input statistical information into the exposure control unit, which includes brightness statistics and dynamic range expansion values. The exposure control unit can then adjust the acquisition parameters and processing parameters of the KN-th frame based on these values ​​to obtain the target acquisition parameters and target processing parameters, which are the acquisition parameters and processing parameters corresponding to the K-th frame image.

[0264] Next, the exposure control unit can input the Kth frame acquisition parameters and Kth frame processing parameters into the buffer unit for storage. This storage is then used to synchronize the parameters to the image acquisition unit and image processing unit during the acquisition and processing of subsequent K+Nth frame images. Specifically, the buffer unit can synchronize the Kth frame acquisition parameters to the image acquisition unit before acquiring the K+Nth frame image, ensuring that the image acquisition unit acquires the K+Nth frame image according to the Kth frame acquisition parameters. Furthermore, when the image processing unit processes the K+Nth frame image, it synchronizes the Kth frame processing parameters to the image acquisition unit, ensuring that the image acquisition unit processes the K+Nth frame image according to the Kth frame processing parameters to obtain the output image.

[0265] As can be seen, in this embodiment, the image processing system can continuously acquire images with stable brightness and adaptive high dynamic range in the manner described above, retain information of bright areas, increase the amount of image information, and make the output image effect stable.

[0266] Corresponding to the above image processing method, this application also provides an image processing apparatus. The image processing apparatus provided in this application embodiment will be described below.

[0267] like Figure 19 As shown, an image processing apparatus includes:

[0268] Parameter acquisition module 1910 is used to acquire control parameters for the current frame;

[0269] The current frame control parameters are determined based on statistical brightness information corresponding to historical images, and the historical images are either a preset number of frames acquired before the current frame or images after image processing of the preset number of frames.

[0270] The image acquisition module 1920 is used to obtain the initial image of the current frame based on the current frame control parameters;

[0271] Image processing module 1930 is used to perform digital gain processing and compression processing on the initial image of the current frame based on the current frame control parameters and the target pixel value range, to obtain a compressed image with pixel value range of the target pixel value range, which is used as the current frame output image;

[0272] The range of pixel values ​​in the image after digital gain processing is not less than the range of pixel values ​​in the image before digital gain processing, and the target pixel value range is preset based on the application requirements of the output image of the current frame.

[0273] The parameter adjustment module 1940 is used to determine the statistical brightness information corresponding to the target image, and adjust the current frame control parameters based on the statistical brightness information corresponding to the target image to obtain the target control parameters.

[0274] The target control parameter is used to control the acquisition and processing of a preset number of frames after the current frame. The target image is the initial image of the current frame, the image before digital gain processing, the image after digital gain processing, the image before compression processing, or the image after compression processing.

[0275] As can be seen, in the solution provided by this application embodiment, for the initial image of the current frame obtained based on the current frame control parameters, the electronic device can process it using digital gain and compression processing methods. The pixel value range of the image after digital gain processing is not less than the pixel value range of the image before digital gain processing. In this way, the image after digital gain processing can also have a high pixel value range, retaining highlight information, and the brightness difference range between its darkest and brightest parts can be larger, thus obtaining a high dynamic range image. Furthermore, the current frame control parameters are determined based on the statistical brightness information corresponding to historical images. The historical images are the preset number of frames acquired before the current frame or the images after image processing of the preset number of frames. The target control parameters obtained based on the statistical brightness information corresponding to the target image are used to control the acquisition and processing of the preset number of frames after the current frame. The target image can be the initial image of the current frame, the image before digital gain processing, the image after digital gain processing, the image before compression processing, or the image after compression processing. In this way, the acquisition and processing of images can be controlled based on statistical brightness information, so that high dynamic range images with appropriate and stable brightness can be continuously obtained. The solution provided in this application embodiment can very simply handle high dynamic range scenarios, has no special requirements for electronic device hardware, and is low in cost.

[0276] As one embodiment of this application, the initial image of the current frame is an image acquired based on the current frame control parameters or an image after preprocessing the acquired image. In the digital gain processing, no data truncation is performed, or the digital gain processing performs data truncation on the image after digital gain processing so that the pixel value range of the image after data truncation is not less than the pixel value range of the image before digital gain processing.

[0277] As one embodiment of this application, the compression parameters of the above compression processing are related to the digital gain of the digital gain processing;

[0278] The correlation is as follows: for different digital gains, the pixel value range of the resulting digital gain processed image is different, and the compression process adjusts the compression parameters according to the different pixel value ranges so that the compressed image has the same pixel value range.

[0279] As one embodiment of this application, the image processing module 1930 includes:

[0280] The first digital gain unit is used to perform first digital gain processing on the initial image of the current frame if the digital gain included in the current frame control parameters is greater than a preset digital gain upper limit threshold, using the preset digital gain upper limit threshold as the first digital gain, to obtain a first gain image.

[0281] The preset digital gain upper limit threshold is used to characterize the maximum digital gain processing capability of the image processing logic platform.

[0282] The second compression unit is used to compress the first gain image based on a preset pixel value range and the pixel value range of the first gain image to obtain a compressed image of the preset pixel value range.

[0283] The second digital gain unit is used to process the compressed image by taking the ratio between the digital gain and the preset digital gain upper limit threshold as the second digital gain, and obtain the second gain image.

[0284] The second compression unit is used to compress the second gain image based on the target pixel value range and the pixel value range of the second gain image to obtain a compressed image whose pixel value range is the target pixel value range.

[0285] As one embodiment of this application, the above-mentioned apparatus further includes:

[0286] The mapping module is used to obtain a preset brightness mapping curve for decompression processing when the initial image of the current frame is a high dynamic range image signal, before performing digital gain processing and compression processing on the initial image of the current frame based on the current frame control parameters and the target pixel value range to obtain a compressed image with pixel value range of the target pixel value range; and to map the nonlinear image in the initial image of the current frame into a linear image through the preset brightness mapping curve.

[0287] The pixel value range of the linear image is wider than that of the nonlinear image.

[0288] As one embodiment of this application, the image processing module 1930 includes:

[0289] The third digital gain processing unit is used to perform digital gain processing on the initial image of the current frame according to the digital gain included in the current frame control parameters, so as to obtain the image after digital gain processing.

[0290] The mapping curve acquisition unit is used to divide the image after digital gain processing into different regions and acquire the mapping curve corresponding to each region.

[0291] The brightness mapping unit is used to perform brightness mapping processing on each region according to the range of target pixel values ​​and the corresponding mapping curve of each region to obtain the compressed image.

[0292] As one embodiment of this application, the above-mentioned statistical brightness information includes dynamic range extension value and brightness statistical value;

[0293] The above parameter adjustment module 1940 includes:

[0294] The dynamic range statistics unit is used to determine the dynamic range expansion value based on the bright pixels in the first target image and the preset bright target value;

[0295] Wherein, the bright pixel is a pixel whose brightness is higher than a preset brightness threshold, the dynamic range extension value is used to characterize the dynamic range required to retain the bright area information in the current shooting scene, and the first target image is the current frame initial image, the image before digital gain processing, the image after digital gain processing, the image before compression processing, or the image after compression processing.

[0296] The brightness statistics unit is used to determine brightness statistics based on the brightness of pixels in the second target image.

[0297] The second target image is either the initial image of the current frame, the image before digital gain processing, the image after digital gain processing, the image before compression processing, or the image after compression processing.

[0298] As one embodiment of this application, the current frame control parameters include current frame acquisition parameters and current frame processing parameters, and the target control parameters include target acquisition parameters and target processing parameters.

[0299] The above parameter adjustment module 1940 includes:

[0300] An initial parameter determination unit is used to adjust the current frame acquisition parameters and the current frame processing parameters according to the relationship between the brightness statistics value and the preset target brightness, so as to obtain initial acquisition parameters and initial processing parameters;

[0301] The target parameter determination unit is used to adjust the initial acquisition parameters and the initial processing parameters based on the relationship between the initial processing parameters and the dynamic range expansion value, so as to obtain the target acquisition parameters and the target processing parameters.

[0302] As one embodiment of this application, the above-mentioned initial parameter determination unit includes:

[0303] An initial parameter determination subunit is used to compare the brightness statistics with a preset target brightness to obtain a comparison result; determine the parameter adjustment direction based on the comparison result; and adjust the current frame acquisition parameters and the current frame processing parameters according to the parameter adjustment direction to obtain initial acquisition parameters and initial processing parameters.

[0304] As one embodiment of this application, the current frame acquisition parameters mentioned above include at least exposure time, aperture, and sensor gain, and the current frame processing parameters include at least digital gain.

[0305] The above initial parameter determination sub-units include:

[0306] The difference calculation subunit is used to calculate the difference between the brightness statistics value and the preset target brightness;

[0307] An initial parameter determination subunit is used to, if the parameter adjustment direction is to increase, sequentially increase the current frame acquisition parameters according to the difference and a preset acquisition parameter threshold, in a first predetermined order, to obtain initial acquisition parameters; and adjust the digital gain based on the initial acquisition parameters to obtain an initial digital gain; or,

[0308] If the parameter adjustment direction is decreasing, adjust the digital gain according to the difference and a preset processing parameter threshold to obtain an initial digital gain; based on the initial digital gain, decrease the current frame acquisition parameters sequentially according to a second preset order to obtain initial acquisition parameters; or,

[0309] This is used to keep the exposure time, aperture, sensor gain, and digital gain constant if the parameter adjustment direction remains unchanged.

[0310] As one embodiment of this application, the first setting order is: exposure time, aperture and sensor gain, and the second setting order is sensor gain, aperture and exposure time.

[0311] The above initial parameter determination sub-units include:

[0312] The first alternative parameter determination subunit is used to increase the currently adjusted acquisition parameter according to the first set order based on the difference to obtain the corresponding alternative acquisition parameter;

[0313] The first initial parameter determination subunit is used to take the upper limit threshold of the parameter as the adjusted parameter corresponding to the currently adjusted acquisition parameter if the candidate acquisition parameter is greater than the upper limit threshold of the parameter corresponding to the currently adjusted acquisition parameter.

[0314] The second alternative parameter determination subunit is used to determine the next parameter as the currently adjusted acquisition parameter according to the first set order, and increase the currently adjusted acquisition parameter based on the adjusted parameter to obtain the corresponding alternative acquisition parameter, and trigger the first initial parameter determination subunit until all current frame acquisition parameters have been adjusted.

[0315] The first initial digital gain calculation unit is used to determine an initial digital gain based on the initial acquisition parameters and the digital gain, so that the brightness of the image acquired by the image acquisition device based on the initial acquisition parameters can reach the preset target brightness after processing according to the initial digital gain.

[0316] As one embodiment of this application, the above-mentioned initial parameter determination subunit includes:

[0317] An alternative digital gain calculation subunit is used to reduce the digital gain according to the difference to obtain an alternative digital gain;

[0318] The second initial digital gain calculation subunit is used to take the preset digital gain lower limit threshold as the initial digital gain if the candidate digital gain is less than the preset digital gain lower limit threshold.

[0319] The third alternative parameter determination subunit is used to reduce the currently adjusted acquisition parameter according to the second set order based on the initial digital gain to obtain the corresponding alternative acquisition parameter;

[0320] The third initial parameter determination subunit is used to take the lower limit threshold of the parameter as the adjusted parameter corresponding to the currently adjusted acquisition parameter if the candidate acquisition parameter is less than the lower limit threshold of the parameter corresponding to the currently adjusted acquisition parameter.

[0321] The fourth initial parameter determination subunit is used to determine the next parameter as the currently adjusted acquisition parameter according to the second set order, and reduce the currently adjusted acquisition parameter based on the adjusted parameter to obtain the corresponding alternative acquisition parameter, and trigger the third initial parameter determination subunit until all current frame acquisition parameters have been adjusted.

[0322] As one embodiment of this application, the target parameter determination unit includes:

[0323] A target digital gain determination subunit is used to determine the dynamic range extension value as the target digital gain if the initial digital gain is less than the dynamic range extension value.

[0324] The difference calculation subunit is used to calculate the difference between the initial digital gain and the target digital gain;

[0325] The target acquisition parameter determination subunit is used to adjust the initial acquisition parameters sequentially according to a third preset order based on the difference and the preset acquisition parameter threshold to obtain the target acquisition parameters;

[0326] The target parameter determination subunit is used to determine the initial digital gain as the target digital gain if the initial digital gain is not less than the dynamic range extension value, and to determine the initial sensor gain, the initial exposure time, and the initial aperture as the target sensor gain, the target exposure time, and the target aperture, respectively.

[0327] As one embodiment of this application, the third setting order is: initial sensor gain, initial aperture, and initial exposure time.

[0328] The above-mentioned target acquisition parameter determination subunit includes:

[0329] The first candidate target parameter calculation subunit is used to reduce the currently adjusted initial acquisition parameter according to the third preset order based on the difference to obtain the candidate target acquisition parameter;

[0330] The target acquisition parameter determination unit is used to determine the lower limit threshold of the parameter if the candidate target acquisition parameter is less than the lower limit threshold of the parameter corresponding to the currently adjusted initial acquisition parameter.

[0331] The second alternative target parameter calculation subunit is used to determine the next parameter as the currently adjusted acquisition parameter according to the third preset order, and reduce the currently adjusted initial acquisition parameter based on the adjusted parameter to obtain the corresponding alternative target acquisition parameter, and trigger the target acquisition parameter determination unit until all current frame acquisition parameters have been adjusted.

[0332] As one embodiment of this application, the above-mentioned dynamic range statistics unit includes:

[0333] The highlight statistics determination subunit is used to determine the highlight statistics based on the brightness and number of highlighted pixels in the first target image;

[0334] The dynamic range expansion value determination subunit is used to determine the dynamic range expansion value based on the difference between the highlight statistics value and the preset highlight target value and the preset dynamic range expansion value threshold.

[0335] The preset dynamic range extension value threshold is determined based on the computing power or noise reduction capability of the image processing logic platform, so that the noise amplification of digital processing based on the dynamic range extension value is within a preset range.

[0336] As one embodiment of this application, the above-mentioned highlight statistics determination subunit includes:

[0337] The highlight statistics calculation subunit is used to calculate the average brightness of the highlighted pixels in the initial image of the current frame based on the brightness and number of highlighted pixels in the first target image, as the highlight statistics value; or,

[0338] This is used to determine the weight corresponding to each highlighted pixel based on the location of each highlighted pixel in the first target image and the preset relationship between position and weight; based on the weight and the number of highlighted pixels, a weighted average of the brightness of the highlighted pixels is calculated as a highlight statistical value; or,

[0339] The method is used to determine the weight corresponding to each bright pixel based on the location of each bright pixel in the first target image and the relationship between the preset position and weight; calculate the weighted average value of the brightness of the bright pixels based on the weight and the number of bright pixels; and adjust the weighted average value based on the number of bright pixels and the preset bright target value to obtain the bright statistical value.

[0340] As one embodiment of this application, the above-mentioned brightness statistics unit includes:

[0341] The brightness statistics subunit is used to calculate the average brightness of pixels in the second target image as a brightness statistical value; or,

[0342] This is used to determine the weight corresponding to each pixel based on the location of each pixel in the second target image and the preset relationship between position and weight; based on the weight, a weighted average value of the brightness of the pixel is calculated as a brightness statistic; or,

[0343] This is used to determine the weight corresponding to each pixel based on the brightness of each pixel in the second target image and the preset relationship between brightness and weight; based on the weight, a weighted average of the brightness of the pixels is calculated as a brightness statistic; or,

[0344] The method is used to take the smaller value between the brightness of each pixel in the second target image and a preset brightness statistical threshold as the statistical brightness of that pixel; and to calculate the brightness statistical value based on the statistical brightness of each pixel.

[0345] This application also provides an electronic device, such as... Figure 20 As shown, it includes:

[0346] Memory 2001 is used to store computer programs;

[0347] When the processor 2002 executes the program stored in the memory 2001, it implements the image processing method steps described in any of the above embodiments.

[0348] As can be seen, in the solution provided by this application embodiment, for the initial image of the current frame obtained based on the current frame control parameters, the electronic device can process it using digital gain and compression processing methods. The pixel value range of the image after digital gain processing is not less than the pixel value range of the image before digital gain processing. In this way, the image after digital gain processing can also have a high pixel value range, retaining highlight information, and the brightness difference range between its darkest and brightest parts can be larger, thus obtaining a high dynamic range image. Furthermore, the current frame control parameters are determined based on the statistical brightness information corresponding to historical images. The historical images are the preset number of frames acquired before the current frame or the images after image processing of the preset number of frames. The target control parameters obtained based on the statistical brightness information corresponding to the target image are used to control the acquisition and processing of the preset number of frames after the current frame. The target image can be the initial image of the current frame, the image before digital gain processing, the image after digital gain processing, the image before compression processing, or the image after compression processing. In this way, the acquisition and processing of images can be controlled based on statistical brightness information, so that high dynamic range images with appropriate and stable brightness can be continuously obtained. The solution provided in this application embodiment can very simply handle high dynamic range scenarios, has no special requirements for electronic device hardware, and is low in cost.

[0349] Furthermore, the aforementioned electronic device may also include a communication bus and / or a communication interface, with the processor 2002, the communication interface, and the memory 2001 communicating with each other via the communication bus.

[0350] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.

[0351] The communication interface is used for communication between the aforementioned electronic devices and other devices.

[0352] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0353] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0354] In another embodiment provided in this application, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements the steps of the image processing method described in any of the above embodiments.

[0355] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to perform the image processing method described in any of the embodiments above.

[0356] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a solid-state drive (SSD), etc.

[0357] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0358] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments of apparatus, electronic devices, computationally readable storage media, and computer program products are basically similar to the method embodiments, and therefore the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0359] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application are included within the scope of protection of this application.

Claims

1. An image processing method, characterized by, The method includes: Obtain the control parameters for the current frame, wherein the control parameters for the current frame are determined based on statistical brightness information corresponding to historical images, and the historical images are either a preset number of frames captured before the current frame or an image after image processing of the preset number of frames. Based on the current frame control parameters, obtain the initial image of the current frame; Based on the current frame control parameters and the target pixel value range, digital gain processing and compression processing are performed on the initial image of the current frame to obtain a compressed image with pixel value ranges within the target pixel value range, which is used as the output image of the current frame. The pixel value range of the image after digital gain processing is not less than the pixel value range of the image before digital gain processing. The target pixel value range is preset based on the application requirements of the output image of the current frame. The initial image of the current frame is an image acquired based on the current frame control parameters or an image after preprocessing the acquired image. The compression parameters of the compression processing are correlated with the digital gain of the digital gain processing. The correlation is that different digital gains result in different pixel value ranges in the digital gain processed images, and the compression processing adjusts the compression parameters according to these different pixel value ranges to ensure that the compressed images have the same pixel value range. The statistical brightness information corresponding to the target image is determined, and the control parameters of the current frame are adjusted based on the statistical brightness information corresponding to the target image to obtain the target control parameters. The target control parameters are used to control the acquisition and processing of the preset number of frames after the current frame. The target image is the initial image of the current frame, the image before digital gain processing, the image after digital gain processing, the image before compression processing, or the image after compression processing.

2. The method of claim 1, wherein, The digital gain processing does not truncate the data, or the digital gain processing truncates the data of the image after digital gain processing so that the range of pixel values ​​of the image after data truncation is not less than the range of pixel values ​​of the image before digital gain processing.

3. The method of claim 1, wherein, The step of performing digital gain processing and compression processing on the initial image of the current frame based on the current frame control parameters and the target pixel value range to obtain a compressed image with pixel value ranges within the target pixel value range includes: If the digital gain included in the current frame control parameters is greater than a preset digital gain upper limit threshold, the preset digital gain upper limit threshold is used as the first digital gain, and the initial image of the current frame is subjected to first digital gain processing to obtain a first gain image. The preset digital gain upper limit threshold is used to characterize the maximum value of the digital gain processing capability of the image processing logic platform. Based on the preset pixel value range and the pixel value range of the first gain image, the first gain image is compressed to obtain a compressed image of the preset pixel value range. The ratio between the digital gain and the preset digital gain upper limit threshold is used as the second digital gain. The compressed image is then subjected to second digital gain processing to obtain a second gain image. Based on the target pixel value range and the pixel value range of the second gain image, the second gain image is compressed to obtain a compressed image whose pixel value range is the target pixel value range.

4. The method of claim 1, wherein, Before the step of performing digital gain processing and compression processing on the initial image of the current frame based on the current frame control parameters and the target pixel value range to obtain a compressed image with pixel value ranges within the target pixel value range, the method further includes: When the initial image of the current frame is a high dynamic range image signal, a preset brightness mapping curve for decompression processing is obtained; The nonlinear image in the initial image of the current frame is mapped to a linear image by the preset brightness mapping curve, wherein the pixel value range of the linear image is wider than the pixel value range of the nonlinear image.

5. The method of claim 1, wherein, The step of performing digital gain processing and compression processing on the initial image of the current frame based on the current frame control parameters and the target pixel value range to obtain a compressed image with pixel value ranges within the target pixel value range includes: According to the digital gain included in the current frame control parameters, the initial image of the current frame is subjected to digital gain processing to obtain the digitally gained image. The image after digital gain processing is divided into different regions, and the mapping curve corresponding to each region is obtained; Based on the target pixel value range, brightness mapping is performed on each region using the corresponding mapping curve to obtain the compressed image.

6. The method according to any one of claims 1 to 5, characterized in that, The statistical brightness information includes dynamic range extension value and brightness statistical value; The step of determining the statistical brightness information corresponding to the target image includes: Based on the bright pixels in the first target image and the preset bright target value, the dynamic range expansion value is determined. The bright pixels are pixels whose brightness is higher than the preset brightness threshold. The dynamic range expansion value is used to characterize the dynamic range required to retain the bright area information in the current shooting scene. The first target image is the initial image of the current frame, the image before digital gain processing, the image after digital gain processing, the image before compression processing, or the image after compression processing. Based on the brightness of pixels in the second target image, a brightness statistical value is determined, wherein the second target image is the initial image of the current frame, the image before digital gain processing, the image after digital gain processing, the image before compression processing, or the image after compression processing.

7. The method of claim 6, wherein, The current frame control parameters include current frame acquisition parameters and current frame processing parameters, and the target control parameters include target acquisition parameters and target processing parameters; The step of adjusting the current frame control parameters based on the statistical brightness information corresponding to the target image to obtain the target control parameters includes: Based on the relationship between the brightness statistics and the preset target brightness, the current frame acquisition parameters and the current frame processing parameters are adjusted to obtain the initial acquisition parameters and the initial processing parameters. Based on the relationship between the initial processing parameters and the dynamic range expansion value, the initial acquisition parameters and the initial processing parameters are adjusted to obtain the target acquisition parameters and the target processing parameters.

8. The method of claim 7, wherein, The step of adjusting the current frame acquisition parameters and the current frame processing parameters based on the relationship between the brightness statistics value and the preset target brightness to obtain the initial acquisition parameters and initial processing parameters includes: The brightness statistics are compared with the preset target brightness to obtain the comparison result; The direction of parameter adjustment is determined based on the comparison results; Adjust the current frame acquisition parameters and the current frame processing parameters according to the parameter adjustment direction to obtain the initial acquisition parameters and the initial processing parameters.

9. The method of claim 8, wherein, The current frame acquisition parameters include at least exposure time, aperture, and sensor gain, and the current frame processing parameters include at least digital gain. The step of adjusting the current frame acquisition parameters and the current frame processing parameters according to the parameter adjustment direction to obtain the initial acquisition parameters and initial processing parameters includes: Calculate the difference between the brightness statistics and the preset target brightness; If the parameter adjustment direction is to increase, based on the difference and the preset acquisition parameter threshold, the acquisition parameters of the current frame are increased sequentially according to a first preset order to obtain initial acquisition parameters; based on the initial acquisition parameters, the digital gain is adjusted to obtain an initial digital gain; or, If the parameter adjustment direction is to decrease, the digital gain is adjusted according to the difference and the preset processing parameter threshold to obtain an initial digital gain; based on the initial digital gain, the current frame acquisition parameters are decreased sequentially according to a second preset order to obtain initial acquisition parameters; or, If the parameter adjustment direction remains unchanged, the exposure time, aperture, sensor gain, and digital gain remain unchanged.

10. The method of claim 9, wherein, The first setting order is: exposure time, aperture, and sensor gain; the second setting order is: sensor gain, aperture, and exposure time. The step of increasing the current frame acquisition parameters sequentially according to the difference and a preset acquisition parameter threshold to obtain initial acquisition parameters includes: Based on the differences, the currently adjusted acquisition parameters are increased in the first set order to obtain the corresponding alternative acquisition parameters; If the alternative acquisition parameter is greater than the upper limit threshold of the parameter corresponding to the currently adjusted acquisition parameter, the upper limit threshold of the parameter shall be used as the adjusted parameter corresponding to the currently adjusted acquisition parameter; The next parameter is determined as the currently adjusted acquisition parameter according to the first set order, and the currently adjusted acquisition parameter is increased based on the adjusted parameter to obtain the corresponding alternative acquisition parameter; The process of returning to the step of using the upper limit threshold of the parameter corresponding to the currently adjusted acquisition parameter as the adjusted parameter if the alternative acquisition parameter is greater than the upper limit threshold of the parameter corresponding to the currently adjusted acquisition parameter continues until all acquisition parameters of the current frame have been adjusted. The step of adjusting the digital gain based on the initial acquisition parameters to obtain the initial digital gain includes: Based on the initial acquisition parameters and the digital gain, an initial digital gain is determined so that the brightness of the image acquired by the image acquisition device based on the initial acquisition parameters can reach the preset target brightness after processing according to the initial digital gain.

11. The method of claim 9, wherein, The step of adjusting the digital gain based on the difference and a preset processing parameter threshold to obtain an initial digital gain includes: Based on the difference, the digital gain is reduced to obtain alternative digital gains; If the candidate digital gain is less than the preset lower limit threshold of digital gain, the preset lower limit threshold of digital gain shall be used as the initial digital gain; The step of obtaining the initial acquisition parameters by sequentially decreasing the acquisition parameters of the current frame according to the second predetermined order based on the initial digital gain includes: Based on the initial digital gain, the currently adjusted acquisition parameters are reduced in the second set order to obtain the corresponding alternative acquisition parameters; If the alternative acquisition parameter is less than the lower limit threshold corresponding to the currently adjusted acquisition parameter, the lower limit threshold is used as the adjusted parameter corresponding to the currently adjusted acquisition parameter. According to the second set order, the next parameter is determined as the current acquisition parameter to be adjusted, and the current acquisition parameter is reduced based on the adjusted parameter to obtain the corresponding alternative acquisition parameter; The process of returning to the step of using the lower limit threshold of the parameter corresponding to the currently adjusted acquisition parameter as the adjusted parameter if the alternative acquisition parameter is less than the lower limit threshold of the parameter corresponding to the currently adjusted acquisition parameter continues until all acquisition parameters of the current frame have been adjusted.

12. The method of claim 7, wherein, The step of adjusting the initial acquisition parameters and the initial processing parameters based on the relationship between the initial processing parameters and the dynamic range expansion value to obtain the target acquisition parameters and the target processing parameters includes: If the initial digital gain is less than the dynamic range extension value, the dynamic range extension value is determined as the target digital gain; Calculate the difference between the initial digital gain and the target digital gain; Based on the aforementioned differences and preset acquisition parameter thresholds, the initial acquisition parameters are adjusted sequentially according to the third preset order to obtain the target acquisition parameters; If the initial digital gain is not less than the dynamic range extension value, the initial digital gain is determined as the target digital gain, and the initial sensor gain, initial exposure time, and initial aperture are determined as the target sensor gain, target exposure time, and target aperture, respectively.

13. The method of claim 12, wherein, The third setting sequence is: initial sensor gain, initial aperture, and initial exposure time; The step of adjusting the initial acquisition parameters sequentially according to a third predetermined order based on the difference and a preset acquisition parameter threshold to obtain the target acquisition parameters includes: Based on the aforementioned differences, the initial acquisition parameters are reduced according to the third predetermined order to obtain the acquisition parameters for the alternative targets. If the parameter of the candidate target is less than the lower limit threshold of the parameter corresponding to the currently adjusted initial parameter, the lower limit threshold of the parameter shall be used as the adjusted parameter corresponding to the currently adjusted parameter. According to the third set order, the next parameter is determined as the current acquisition parameter to be adjusted, and the initial acquisition parameter to be adjusted is reduced based on the adjusted parameter to obtain the corresponding candidate target acquisition parameter; The process of returning to the step of using the lower limit threshold of the parameter corresponding to the current adjusted initial acquisition parameter as the adjusted parameter if the acquisition parameter of the candidate target is less than the lower limit threshold of the parameter corresponding to the current adjusted initial acquisition parameter continues until all acquisition parameters of the current frame have been adjusted.

14. The method of claim 6, wherein, The step of determining the dynamic range extension value based on the bright pixels in the first target image and the preset bright target value includes: Based on the brightness and number of highlighted pixels in the first target image, determine the highlight statistics; The dynamic range expansion value is determined based on the difference between the brightness statistics and the preset brightness target value, and the preset dynamic range expansion value threshold. The preset dynamic range expansion value threshold is determined based on the computing power or noise reduction capability of the image processing logic platform, so that the noise amplification of digital processing based on the dynamic range expansion value is within a preset range.

15. The method of claim 14, wherein, The step of determining the highlight statistics based on the brightness and number of highlighted pixels in the first target image includes: Based on the brightness and number of highlighted pixels in the first target image, calculate the average brightness of the highlighted pixels in the first target image as a highlight statistical value; or, Based on the location of each highlighted pixel in the first target image and the preset relationship between position and weight, the weight corresponding to each highlighted pixel is determined; based on the weight and the number of highlighted pixels, the weighted average brightness of the highlighted pixels is calculated as the highlight statistics; or, Based on the location of each highlighted pixel in the first target image and the preset relationship between position and weight, the weight corresponding to each highlighted pixel is determined; based on the weight and the number of highlighted pixels, the weighted average brightness of the highlighted pixels is calculated; based on the number of highlighted pixels and the preset highlight target value, the weighted average is adjusted to obtain the highlight statistics.

16. The method of claim 6, wherein, The step of determining brightness statistics based on the brightness of pixels in the second target image includes: Calculate the average brightness of the pixels in the second target image as a brightness statistic; or, Based on the location of each pixel in the second target image and the preset relationship between position and weight, the weight corresponding to each pixel is determined; based on the weight, the weighted average brightness of the pixels is calculated as a brightness statistic; or, Based on the brightness of each pixel in the second target image and the preset relationship between brightness and weight, the weight corresponding to each pixel is determined; based on the weight, the weighted average brightness of the pixels is calculated as a brightness statistic; or, The smaller value between the brightness of each pixel in the second target image and a preset brightness statistical threshold is taken as the statistical brightness of that pixel; based on the statistical brightness of each pixel, a brightness statistical value is calculated.

17. An image processing apparatus characterized by comprising: The device includes: The parameter acquisition module is used to acquire the control parameters of the current frame, wherein the control parameters of the current frame are determined based on the statistical brightness information corresponding to the historical images, and the historical images are the preset number of frames collected before the current frame or the images after image processing of the preset number of frames. The image acquisition module is used to obtain the initial image of the current frame based on the current frame control parameters; An image processing module is used to perform digital gain processing and compression processing on the initial image of the current frame based on the current frame control parameters and the target pixel value range, to obtain a compressed image with pixel value ranges within the target pixel value range, which is then used as the output image of the current frame. The pixel value range of the image after digital gain processing is not less than the pixel value range of the image before digital gain processing. The target pixel value range is preset based on the application requirements of the output image of the current frame. The initial image of the current frame is an image acquired based on the current frame control parameters or an image after preprocessing the acquired image. The compression parameters of the compression processing are correlated with the digital gain of the digital gain processing. The correlation is that different digital gains result in different pixel value ranges in the digital gain processed images, and the compression processing adjusts the compression parameters according to these different pixel value ranges to ensure that the compressed images have the same pixel value range. The parameter adjustment module is used to determine the statistical brightness information corresponding to the target image, and adjust the current frame control parameters based on the statistical brightness information corresponding to the target image to obtain the target control parameters. The target control parameters are used to control the acquisition and processing of the preset number of frames after the current frame. The target image is the initial image of the current frame, the image before digital gain processing, the image after digital gain processing, the image before compression processing, or the image after compression processing.

18. The apparatus of claim 17, wherein, The digital gain processing does not truncate the data, or the digital gain processing performs data truncation on the image after digital gain processing so that the range of pixel values ​​in the image after data truncation is not less than the range of pixel values ​​in the image before digital gain processing. The image processing module includes: The first digital gain unit is used to perform first digital gain processing on the initial image of the current frame if the digital gain included in the current frame control parameters is greater than a preset digital gain upper limit threshold, using the preset digital gain upper limit threshold as the first digital gain to obtain a first gain image, wherein the preset digital gain upper limit threshold is used to characterize the maximum value of the digital gain processing capability of the image processing logic platform. The first compression unit is used to compress the first gain image based on a preset pixel value range and the pixel value range of the first gain image to obtain a compressed image of the preset pixel value range. The second digital gain unit is used to process the compressed image by taking the ratio between the digital gain and the preset digital gain upper limit threshold as the second digital gain, and obtain the second gain image. The second compression unit is used to compress the second gain image based on the target pixel value range and the pixel value range of the second gain image to obtain a compressed image whose pixel value range is the target pixel value range; The device further includes: The mapping module is used to, before performing digital gain processing and compression processing on the initial image of the current frame based on the current frame control parameters and the target pixel value range to obtain a compressed image with pixel value ranges within the target pixel value range, acquire a preset brightness mapping curve for decompression processing when the initial image of the current frame is a high dynamic range image signal; and map the nonlinear image in the initial image of the current frame to a linear image through the preset brightness mapping curve, wherein the pixel value range of the linear image is wider than the pixel value range of the nonlinear image; The image processing module includes: The third digital gain processing unit is used to perform digital gain processing on the initial image of the current frame according to the digital gain included in the current frame control parameters, so as to obtain the image after digital gain processing. The mapping curve acquisition unit is used to divide the image after digital gain processing into different regions and acquire the mapping curve corresponding to each region. The brightness mapping unit is used to perform brightness mapping processing on each region according to the range of target pixel values ​​and through the mapping curve corresponding to each region, so as to obtain the compressed image. The statistical brightness information includes dynamic range extension value and brightness statistical value; The parameter adjustment module includes: The dynamic range statistics unit is used to determine the dynamic range expansion value based on the bright pixels in the first target image and the preset bright target value. The bright pixels are pixels whose brightness is higher than the preset brightness threshold. The dynamic range expansion value is used to characterize the dynamic range required to retain the bright area information in the current shooting scene. The first target image is the initial image of the current frame, the image before digital gain processing, the image after digital gain processing, the image before compression processing, or the image after compression processing. A brightness statistics unit is used to determine brightness statistics based on the brightness of pixels in a second target image, wherein the second target image is the initial image of the current frame, the image before digital gain processing, the image after digital gain processing, the image before compression processing, or the image after compression processing. The current frame control parameters include current frame acquisition parameters and current frame processing parameters, and the target control parameters include target acquisition parameters and target processing parameters; The parameter adjustment module includes: An initial parameter determination unit is used to adjust the current frame acquisition parameters and the current frame processing parameters according to the relationship between the brightness statistics value and the preset target brightness, so as to obtain initial acquisition parameters and initial processing parameters; The target parameter determination unit is used to adjust the initial acquisition parameters and the initial processing parameters based on the relationship between the initial processing parameters and the dynamic range expansion value, so as to obtain the target acquisition parameters and the target processing parameters; The initial parameter determination unit includes: An initial parameter determination subunit is used to compare the brightness statistics with a preset target brightness to obtain a comparison result; determine the parameter adjustment direction based on the comparison result; and adjust the current frame acquisition parameters and the current frame processing parameters according to the parameter adjustment direction to obtain initial acquisition parameters and initial processing parameters. The current frame acquisition parameters include at least exposure time, aperture, and sensor gain, and the current frame processing parameters include at least digital gain. The initial parameter determination subunit includes: The difference calculation subunit is used to calculate the difference between the brightness statistics value and the preset target brightness; An initial parameter determination subunit is used to, if the parameter adjustment direction is to increase, sequentially increase the current frame acquisition parameters according to the difference and a preset acquisition parameter threshold, in a first predetermined order, to obtain initial acquisition parameters; and adjust the digital gain based on the initial acquisition parameters to obtain an initial digital gain; or, If the parameter adjustment direction is decreasing, adjust the digital gain according to the difference and a preset processing parameter threshold to obtain an initial digital gain; based on the initial digital gain, decrease the current frame acquisition parameters sequentially according to a second preset order to obtain initial acquisition parameters; or, This is used to keep the exposure time, the aperture, the sensor gain, and the digital gain constant if the parameter adjustment direction remains unchanged; The first setting order is: exposure time, aperture, and sensor gain; the second setting order is: sensor gain, aperture, and exposure time. The initial parameter determination subunit includes: The first alternative parameter determination subunit is used to increase the currently adjusted acquisition parameter according to the first set order based on the difference to obtain the corresponding alternative acquisition parameter; The first initial parameter determination subunit is used to take the upper limit threshold of the parameter as the adjusted parameter corresponding to the currently adjusted acquisition parameter if the candidate acquisition parameter is greater than the upper limit threshold of the parameter corresponding to the currently adjusted acquisition parameter. The second alternative parameter determination subunit is used to determine the next parameter as the currently adjusted acquisition parameter according to the first set order, and increase the currently adjusted acquisition parameter based on the adjusted parameter to obtain the corresponding alternative acquisition parameter, and trigger the first initial parameter determination subunit until all current frame acquisition parameters have been adjusted. The first initial digital gain calculation unit is used to determine an initial digital gain based on the initial acquisition parameters and the digital gain, so that the brightness of the image acquired by the image acquisition device based on the initial acquisition parameters can reach the preset target brightness after processing according to the initial digital gain. The initial parameter determination subunit includes: An alternative digital gain calculation subunit is used to reduce the digital gain according to the difference to obtain an alternative digital gain; The second initial digital gain calculation subunit is used to take the preset digital gain lower limit threshold as the initial digital gain if the candidate digital gain is less than the preset digital gain lower limit threshold. The third alternative parameter determination subunit is used to reduce the currently adjusted acquisition parameter according to the second set order based on the initial digital gain to obtain the corresponding alternative acquisition parameter; The third initial parameter determination subunit is used to take the lower limit threshold of the parameter as the adjusted parameter corresponding to the currently adjusted acquisition parameter if the candidate acquisition parameter is less than the lower limit threshold of the parameter corresponding to the currently adjusted acquisition parameter. The fourth initial parameter determination subunit is used to determine the next parameter as the currently adjusted acquisition parameter according to the second set order, and reduce the currently adjusted acquisition parameter based on the adjusted parameter to obtain the corresponding alternative acquisition parameter, and trigger the third initial parameter determination subunit until all current frame acquisition parameters have been adjusted. The target parameter determination unit includes: A target digital gain determination subunit is used to determine the dynamic range extension value as the target digital gain if the initial digital gain is less than the dynamic range extension value. The difference calculation subunit is used to calculate the difference between the initial digital gain and the target digital gain; The target acquisition parameter determination subunit is used to adjust the initial acquisition parameters sequentially according to a third preset order based on the difference and the preset acquisition parameter threshold to obtain the target acquisition parameters; The target parameter determination subunit is used to determine the initial digital gain as the target digital gain if the initial digital gain is not less than the dynamic range extension value, and to determine the initial sensor gain, initial exposure time and initial aperture as the target sensor gain, target exposure time and target aperture respectively. The third setting sequence is: initial sensor gain, initial aperture, and initial exposure time; The target acquisition parameter determination subunit includes: The first candidate target parameter calculation subunit is used to reduce the currently adjusted initial acquisition parameter according to the third preset order based on the difference to obtain the candidate target acquisition parameter; The target acquisition parameter determination unit is used to determine the lower limit threshold of the parameter if the candidate target acquisition parameter is less than the lower limit threshold of the parameter corresponding to the currently adjusted initial acquisition parameter. The second alternative target parameter calculation subunit is used to determine the next parameter as the currently adjusted acquisition parameter according to the third set order, and reduce the current adjustment initial acquisition parameter based on the adjusted parameter to obtain the corresponding alternative target acquisition parameter, and trigger the target acquisition parameter determination unit until all current frame acquisition parameters have been adjusted. The dynamic range statistics unit includes: The highlight statistics determination subunit is used to determine the highlight statistics based on the brightness and number of highlighted pixels in the first target image; The dynamic range expansion value determination subunit is used to determine the dynamic range expansion value based on the difference between the highlight statistics value and the preset highlight target value and the preset dynamic range expansion value threshold. The preset dynamic range expansion value threshold is determined based on the computing power or noise reduction capability of the image processing logic platform, so that the noise amplification of digital processing based on the dynamic range expansion value is within a preset range. The highlight statistics determination subunit includes: The highlight statistics calculation subunit is used to calculate the average brightness of the highlighted pixels in the initial image of the current frame based on the brightness and number of highlighted pixels in the first target image, as the highlight statistics value; or, This is used to determine the weight corresponding to each highlighted pixel based on the location of each highlighted pixel in the first target image and the preset relationship between position and weight; based on the weight and the number of highlighted pixels, a weighted average of the brightness of the highlighted pixels is calculated as a highlight statistical value; or, The method is used to determine the weight corresponding to each bright pixel based on the location of each bright pixel in the first target image and the relationship between the preset position and the weight; to calculate the weighted average value of the brightness of the bright pixels based on the weight and the number of bright pixels; and to adjust the weighted average value based on the number of bright pixels and the preset bright target value to obtain the bright statistical value. The brightness statistics unit includes: The brightness statistics subunit is used to calculate the average brightness of pixels in the second target image as a brightness statistical value; or, This is used to determine the weight corresponding to each pixel based on the location of each pixel in the second target image and the preset relationship between position and weight; based on the weight, a weighted average of the brightness of the pixels is calculated as a brightness statistic; or, This is used to determine the weight corresponding to each pixel based on the brightness of each pixel in the second target image and the preset relationship between brightness and weight; based on the weight, a weighted average of the brightness of the pixels is calculated as a brightness statistic; or, The method is used to take the smaller value between the brightness of each pixel in the second target image and a preset brightness statistical threshold as the statistical brightness of that pixel; and to calculate the brightness statistical value based on the statistical brightness of each pixel.

19. An electronic device, comprising: include: Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the method described in any one of claims 1-16.

20. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method described in any one of claims 1-16.