Automatic exposure control method and device, computer equipment, readable storage medium and program product

By calculating the entropy value and spatial weight in blocks in image processing and adjusting the camera gain, the shortcomings of the traditional automatic exposure algorithm under extreme lighting conditions are solved, and a higher quality image output is achieved.

CN119893300APending Publication Date: 2025-04-25GLENFLY TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510058986.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-14
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

Traditional automatic exposure control algorithms are difficult to adapt to under extreme lighting conditions, which may lead to underexposed or overexposed high-information blocks.

Method used

By obtaining the global information entropy of the image to be processed, when it is within the preset threshold range, the image is blocked, the entropy value weight and spatial weight of each sub-block are calculated, the target brightness value is calculated, and the camera gain is adjusted according to the target brightness value to achieve automatic exposure.

Benefits of technology

It effectively avoids underexposed or overexposed by high-information blocks, adapts to complex lighting scenes, and improves image quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119893300A_ABST
    Figure CN119893300A_ABST
Patent Text Reader

Abstract

The invention relates to an automatic exposure control method and device, computer equipment, a readable storage medium and a program product. The method comprises the following steps: acquiring a to-be-processed image; the to-be-processed image carries global information entropy; when the global information entropy is within a preset threshold range, partitioning the to-be-processed image to obtain a plurality of sub-blocks, and calculating an entropy weight and a spatial weight of each sub-block; calculating a target brightness value of the to-be-processed image according to the entropy weight of each sub-block and the spatial weight of each sub-block; adjusting a camera gain according to the target brightness value and a preset target brightness range; the camera gain is used for controlling the camera to perform automatic exposure. By adopting the method, the image quality can be improved while the method is suitable for various complex illumination scenes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of computer imaging, and in particular to an automatic exposure control method, apparatus, computer equipment, readable storage medium and program product. Background Art

[0002] The automatic exposure control algorithm is a key component of modern image processing technology. Together with auto focus (AF) and automatic white balance (AWB), it constitutes the core imaging control system of digital camera equipment, namely the 3A algorithm. These algorithms can ensure that the equipment automatically adapts to different lighting and shooting conditions and provides high-quality image output.

[0003] The working principle of automatic exposure is to ensure the image brightness is moderate by adjusting the camera's shutter speed, aperture size and ISO sensitivity. The AE system automatically sets these parameters by analyzing the brightness distribution in the image so that the average brightness of the image meets the preset exposure standard. A good automatic exposure algorithm can obtain appropriate exposure by adaptively adjusting the exposure parameters in different scenarios. In real life scenes, we will face a variety of complex lighting scenes, such as high contrast, low light, backlight, etc. How to effectively apply the automatic exposure algorithm to meet these challenges is the key to improving image and video quality.

[0004] The traditional automatic exposure control algorithm adjusts the exposure parameters by comparing the difference between the average brightness of the entire image and the image reference brightness, so that the average brightness of the entire image is adjusted to the specified range. However, this method has certain limitations and may not be able to adapt to extreme lighting conditions. When the contrast between the subject and the background is relatively large under complex lighting conditions such as backlight or frontal strong light, the traditional automatic exposure algorithm often causes underexposure or overexposure of high-information blocks. Summary of the invention

[0005] Based on this, it is necessary to provide an automatic exposure control method, device, computer equipment, readable storage medium and program product that can avoid underexposure or overexposure of blocks with high information content in order to address the above technical problems.

[0006] In a first aspect, the present application proposes an automatic exposure control method, the method comprising:

[0007] Acquire an image to be processed; the image to be processed carries global information entropy;

[0008] When the global information entropy is within a preset threshold range, the image to be processed is divided into blocks to obtain a plurality of sub-blocks, and the entropy value weight and spatial weight of each of the sub-blocks are calculated;

[0009] Calculating a target brightness value of the image to be processed according to the entropy weight of each sub-block and the spatial weight of each sub-block;

[0010] The camera gain is adjusted according to the target brightness value and the preset target brightness range; the camera gain is used to control the camera to perform automatic exposure.

[0011] In one embodiment, the calculating the entropy weight and the spatial weight of each of the sub-blocks includes:

[0012] Obtaining information entropy of each of the sub-blocks and a brightness mean of each of the sub-blocks;

[0013] The entropy value weight is calculated according to the information entropy of the sub-blocks, and the spatial weight is calculated according to the brightness mean of each sub-block.

[0014] In one of the embodiments, the step of calculating the entropy value weight according to the information entropy of the sub-block includes:

[0015] According to the information entropy, each of the sub-blocks is divided into a first information block and a second information block, wherein the information amount of the first information block is greater than the information amount of the second information block;

[0016] Counting the information entropy mean value of each of the first information blocks and the information entropy mean value of the second information blocks;

[0017] and calculating a mean entropy difference according to the mean information entropy of the first information block and the mean information entropy of the second information block;

[0018] The entropy weight of each of the sub-blocks is allocated according to the mean entropy difference.

[0019] In one of the embodiments, allocating entropy weights of the sub-blocks according to the mean entropy difference includes:

[0020] Obtaining a first information block weight and a second information block weight corresponding to the mean entropy difference through a first preset mapping relationship;

[0021] Calculating, according to the information entropy of each of the sub-blocks, a first proportion of each of the sub-blocks in the first information amount block and in the second information amount block;

[0022] The entropy value weight of each of the sub-blocks is allocated according to the first proportion, the first information block weight and the second information block weight.

[0023] In one of the embodiments, calculating the spatial weight according to the brightness mean of each of the sub-blocks includes:

[0024] According to the position of each sub-block in the image to be processed, each sub-block is divided into a central area and a non-central area;

[0025] Based on the brightness mean values ​​of the sub-blocks, calculating the brightness mean value of the central area and the brightness mean value of the non-central area;

[0026] Calculating a brightness mean difference between a brightness mean of the central area and a brightness mean of the non-central area;

[0027] The spatial weight of each of the sub-blocks is calculated according to the brightness mean difference.

[0028] In one of the embodiments, calculating the spatial weight of each of the sub-blocks according to the brightness mean difference includes:

[0029] Obtaining a central area weight and a non-central area weight corresponding to the brightness mean difference through a second preset mapping relationship;

[0030] Calculating, according to the brightness value of each of the sub-blocks, a second proportion of each of the sub-blocks in the central area and in the non-central area;

[0031] The spatial weight of each of the sub-blocks is allocated according to the second proportion, the central area weight, and the non-central area weight.

[0032] In one of the embodiments, calculating the target brightness value of the image to be processed according to the entropy weight of each of the sub-blocks and the spatial weight of each of the sub-blocks includes:

[0033] Obtaining a target weight based on a preset proportional relationship, the entropy value weight, and the spatial weight;

[0034] Based on the target weight, a weighted sum is performed on the brightness mean values ​​of the sub-blocks to obtain a target brightness value of the image to be processed.

[0035] In one of the embodiments, the image to be processed carries a global average brightness value, and the method further comprises:

[0036] When the global information entropy is not within the preset threshold range, the global average brightness value is used as the target brightness value.

[0037] In one embodiment, adjusting the camera gain according to the target brightness value and a preset target brightness range includes:

[0038] When the target brightness value is less than the preset target brightness range, increasing the camera gain;

[0039] When the target brightness value is greater than the preset target brightness range, the camera gain is reduced.

[0040] In one embodiment, the process of calculating the global information entropy includes:

[0041] Acquire a global histogram; the global histogram is generated by the camera according to the grayscale value of the image to be processed;

[0042] Performing non-uniform compression processing on the global histogram to obtain a compressed histogram;

[0043] The global information entropy is calculated based on the compressed histogram.

[0044] In one embodiment, the non-uniform compression processing is performed on the global histogram to obtain a compressed histogram, including:

[0045] The partitions in the global histogram are merged according to the grayscale areas to obtain the compressed histogram.

[0046] In one embodiment, calculating the global information entropy according to the compressed histogram includes:

[0047] Calculating the pixel ratio of each partition according to the ratio of the number of pixels included in each partition in the compressed histogram to the number of pixels in the image to be processed;

[0048] The global information entropy is calculated according to the pixel ratio.

[0049] In a second aspect, the present application proposes an automatic exposure control device, the device comprising:

[0050] An acquisition module, used for acquiring an image to be processed; the image to be processed carries global information entropy;

[0051] A weight calculation module, used for dividing the image to be processed into blocks to obtain a plurality of sub-blocks, and calculating the entropy value weight and spatial weight of each sub-block when the global information entropy is within a preset threshold range;

[0052] A brightness calculation module, used for calculating a target brightness value of the image to be processed according to the entropy weight of each sub-block and the spatial weight of each sub-block;

[0053] The adjustment module is used to adjust the camera gain according to the target brightness value and a preset target brightness range; the camera gain is used to control automatic exposure.

[0054] In a third aspect, the present application proposes a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.

[0055] In a fourth aspect, the present application proposes a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.

[0056] In a fifth aspect, the present application proposes a computer program product, comprising a computer program, which implements the steps of the above method when executed by a processor.

[0057] The above-mentioned automatic exposure control method, device, computer equipment, computer-readable storage medium and computer program product, when the global information entropy carried by the image to be processed is within the preset threshold range, divides the image to be processed into blocks, and calculates the entropy weight and spatial weight of each sub-block obtained by the block division; then calculates the target brightness value of the image to be processed according to the entropy weight and spatial weight of each sub-block. In the case where the overall information amount of the image to be processed is insufficient, the present application divides it into multiple sub-blocks, and then adjusts the brightness value of each sub-block according to the weight of each sub-block to obtain the target brightness value of the image to be processed. Finally, according to the comparison result of the target brightness value and the preset target brightness range, the appropriate exposure parameters are selected by adjusting the camera gain to complete the automatic exposure of the image to be processed, while adapting to a variety of complex lighting scenes, it also improves the image quality. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0059] Figure 1 is a schematic flow chart of an automatic exposure control method in one embodiment;

[0060] Figure 2 A schematic diagram of the arrangement of sub-blocks in one embodiment;

[0061] Figure 3 A schematic diagram of a flow chart of a step of calculating global information entropy in one embodiment;

[0062] Figure 4 A schematic diagram of a process for calculating entropy value weight and spatial weight in one embodiment;

[0063] Figure 5 is a curve diagram of a first preset mapping relationship in an embodiment;

[0064] Figure 6 is a schematic diagram of arranging sub-blocks grouped according to preset positions in one embodiment;

[0065] Figure 7 is a curve diagram of a second preset mapping relationship in one embodiment;

[0066] Figure 8 is a flow chart of an automatic exposure control method in another embodiment;

[0067] Fig. 9 is a structural block diagram of an automatic exposure control device in one embodiment;

[0068] Fig.10 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0069] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0070] See also Figure 1 In one embodiment, an automatic exposure control method is provided. This embodiment is described by taking the method applied to a terminal as an example. It can be understood that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:

[0071] Step S102, obtaining an image to be processed; the image to be processed carries global information entropy.

[0072] Specifically, the image to be processed is generated during the camera imaging process. Generally speaking, after the camera's shooting button is pressed, the camera can measure the light intensity of the image to be processed through the built-in metering system, and then calculate the appropriate exposure parameters based on the preset automatic exposure algorithm to ensure that the final image has appropriate brightness.

[0073] The information entropy of an image is used to measure the complexity of the image. Generally speaking, the higher the entropy value, the greater the amount of information in the image and the higher the complexity of the image; the lower the entropy value, the smaller the amount of information in the image and the lower the complexity of the image. The information entropy is obtained by calculating the probability distribution of the pixel grayscale values ​​of the image. The global information entropy of an image refers to the information entropy calculated for the entire image. It is used to measure the average amount of information in the entire image and is calculated based on the grayscale histogram of the entire image.

[0074] Step S104: when the global information entropy is within a preset threshold range, the image to be processed is divided into blocks to obtain a plurality of sub-blocks, and the entropy value weight and spatial weight of each sub-block are calculated.

[0075] Specifically, the image entropy value changes with the image exposure value. When the image reaches the ideal exposure value, the image entropy value will reach the maximum. The human eye pays more attention to areas with high grayscale information. Areas with high grayscale information have a wider distribution of grayscale values ​​than areas with low grayscale information, and the entropy value of this area is higher.

[0076] If the global information entropy of the image to be processed is within the preset threshold range, it means that the overall information amount of the image to be processed is insufficient, which will cause the final image to have lost details, reduced contrast, color distortion, etc., ultimately affecting the image quality.

[0077] Exemplarily, the preset threshold range of the embodiment of the present application is set to 0 to 2.8, that is, the global information entropy value H(p)∈(0,2.8], and the image to be processed is divided into blocks.

[0078] In order to solve the above problem, the embodiment of the present application divides the image to be processed into blocks to obtain multiple sub-blocks, and adjusts the brightness of each sub-block to adjust the brightness of the entire image.

[0079] See also Figure 2 For example, the number of sub-blocks can be set as needed. In the embodiment of the present application, the image to be processed is divided into 8x8 sub-blocks. Furthermore, the shape of each sub-block can also be set as needed, for example, it can be a regular rectangular block or an irregular block divided according to the image content.

[0080] Step S106, calculating the target brightness value of the image to be processed according to the entropy weight of each sub-block and the spatial weight of each sub-block.

[0081] Specifically, the weight of each sub-block is related to the brightness of the entire image. If the brightness of a sub-block is low, a higher weight may be assigned to it to increase the brightness of the sub-block in subsequent adjustment steps.

[0082] Furthermore, the entropy weight of each sub-block is derived from the information entropy of each sub-block. The larger the information entropy, the more discrete the pixel value distribution of the sub-block is, the more information it provides, and a higher weight should be assigned to it. On the contrary, the smaller the information entropy, the more concentrated the pixel value distribution of the sub-block is, the less information it provides, and the smaller the weight assigned to it. In this way, allocating weights according to the amount of information of each sub-block helps to better retain important information in image processing.

[0083] Furthermore, the spatial weight of each sub-block takes into account the spatial dependency between pixels. Generally speaking, the correlation between adjacent pixels is stronger than the correlation between pixels that are far apart. By assigning higher weights to adjacent pixels, the local features and structural information of the image can be better captured.

[0084] By dynamically adjusting the entropy weight and spatial weight of each sub-block, the brightness value of each sub-block can be adjusted accordingly, and finally the target brightness value of the overall image composed of each sub-block is obtained.

[0085] Step S108, adjusting the camera gain according to the target brightness value and the preset target brightness range; the camera gain is used to control the camera to perform automatic exposure.

[0086] Specifically, camera gain is an important image processing technology. Gain is achieved through the image sensor of the shooting device. When the gain needs to be increased, the shooting device amplifies the light signal captured by the image sensor to make the picture brighter, thereby improving the brightness of the image in low light conditions.

[0087] Generally speaking, the automatic exposure control algorithm can select appropriate exposure parameters according to the ambient light so that the picture brightness is moderate and the color reproduction is accurate. However, in the case of backlight or too strong light, the traditional automatic exposure control algorithm may cause underexposure or overexposure of the area of ​​interest of the image to be processed. In the embodiment of the present application, the target brightness value and the preset target brightness range are compared, so that the automatic exposure control algorithm can adjust the exposure parameters by adjusting the camera gain according to the comparison result to complete the automatic exposure of the image to be processed.

[0088] The above automatic exposure control method first determines whether the global information entropy carried by the image to be processed is within the preset threshold range. When it is within the preset threshold range, it means that the overall information amount of the image to be processed is insufficient. In this case, the image to be processed is divided into blocks, and the entropy weight and spatial weight of each sub-block obtained by the block division are calculated, wherein the entropy weight is associated with the amount of information of each sub-block, and the spatial weight is associated with the spatial dependency between the pixels of each sub-block. Calculating the target brightness value of the image to be processed based on the entropy weight and the spatial weight can help to better retain important information in image processing, while also better capturing the local features and structural information of the image. Furthermore, according to the comparison result between the target brightness value and the preset target brightness range, the appropriate exposure parameters are selected by adjusting the camera gain to complete the automatic exposure of the image to be processed, thereby improving the image quality.

[0089] See also Figure 3 Optionally, the process of calculating the global information entropy includes:

[0090] Step S302, obtaining a global histogram; the global histogram is generated by the camera according to the grayscale value of the image to be processed.

[0091] Step S304: Perform non-uniform compression processing on the global histogram to obtain a compressed histogram.

[0092] Step S306: Calculate and obtain the global information entropy based on the compressed histogram.

[0093] Specifically, the global histogram is used to represent the grayscale distribution of an image and is generated based on RAW data, where RAW data is unprocessed image data directly output from an image sensor and directly reflects the original brightness value of the pixel.

[0094] Optionally, the step of generating a global histogram includes:

[0095] First, determine the grayscale range of the RAW data. Taking an 8-bit image as an example, its grayscale range is 0 to 255.

[0096] Secondly, the gray value range is divided into a number of bins. For example, if the number of bins is 32, each bin will cover 8 consecutive gray levels.

[0097] Finally, the RAW data is traversed, the number of pixels included in each interval is counted, and the number of times the pixel value appears in each interval is calculated to finally obtain the global histogram.

[0098] Optionally, performing non-uniform compression processing on the global histogram to obtain a compressed histogram includes:

[0099] According to the grayscale area, the partitions in the global histogram are merged to obtain a compressed histogram.

[0100] Specifically, since the linear distribution of RAW data does not conform to the human eye's perception of brightness and contrast, the embodiment of the present application performs non-uniform compression similar to gamma transformation on the histogram of RAW data statistics, allocating more intervals to the dark part and fewer intervals to the highlight part. This solution can make the compressed histogram more consistent with the photosensitivity characteristics of the human eye, while retaining sufficient image information, it also reduces the complexity of calculation.

[0101] For example, taking the above 32-bin global histogram as an example, 7 bins are obtained after non-uniform compression. The specific compression method is as follows:

[0102] hist_new[0] = hist[0];

[0103] hist_new[1] = hist[1];

[0104] hist_new[2]=hist[2]+hist[3];

[0105] hist_new[3] = hist[4:7];

[0106] hist_new[4] = hist[8:15];

[0107] hist_new[5] = hist[16:26];

[0108] hist_new[6] = hist[27:31]

[0109] Among them, hist_new is the compressed histogram, and hist is the original histogram.

[0110] Optionally, the global information entropy is calculated based on the compressed histogram, including:

[0111] According to the ratio of the number of pixels included in each partition in the compressed histogram to the number of pixels in the image to be processed, the pixel ratio of each partition is calculated; according to the pixel ratio, the global information entropy is calculated.

[0112] Specifically, the expression for calculating global information entropy is:

[0113]

[0114] Among them, p i is the probability of the i-th bin, that is, the proportion of the total number of pixels in this bin to the total number of pixels in the image to be processed; n is the total number of bins.

[0115] The above automatic exposure control method performs non-uniform compression processing on the acquired global histogram, which can make the compressed histogram more consistent with the photosensitivity characteristics of the human eye, while retaining sufficient image information, and reducing the complexity of calculation. The global information entropy obtained based on the compressed histogram can more effectively express the details of the information-intensive area, better reflect the amount of information in the image block, and better fit the perception characteristics of the human eye.

[0116] See also Figure 4 , Optionally, the entropy weight and spatial weight of each sub-block are calculated, including:

[0117] Step S402, obtaining the information entropy of each sub-block and the brightness mean of each sub-block.

[0118] Step S404, calculating entropy weights according to the information entropy of the sub-blocks, and calculating spatial weights according to the brightness mean of each sub-block.

[0119] Specifically, the method of obtaining the information entropy of the sub-block is similar to the above-mentioned global information entropy, that is, firstly obtaining the grayscale histogram of the sub-block, and then calculating the information entropy according to the grayscale histogram.

[0120] The pixel brightness value of an image is the light intensity information represented by each pixel in the image, which is used to reflect the brightness of the image. The mean brightness value of an image is an indicator of the overall brightness level of the image, which is usually obtained by calculating the average brightness value of all pixels in the image. Taking a grayscale image as an example, the grayscale value of each pixel in the sub-block is read, and the grayscale value is the brightness value. The sum of the brightness values ​​of all pixels is divided by the number of pixels to obtain the mean brightness value of the sub-block.

[0121] Optionally, before obtaining the information entropy of each sub-block, the histogram of each sub-block is also non-uniformly compressed. The compression principle is similar to the non-uniform compression of the global histogram in the above embodiment, and will not be described here to save space.

[0122] Optionally, the entropy value weight is calculated according to the information entropy of the sub-block, including:

[0123] According to information entropy, each sub-block is divided into a first information block and a second information block, wherein the information amount of the first information block is greater than the information amount of the second information block.

[0124] The information entropy mean value of each first information block and the information entropy mean value of each second information block are counted.

[0125] And according to the information entropy mean of the first information block and the information entropy mean of the second information block, the mean entropy difference is calculated.

[0126] According to the mean entropy difference, the entropy weight of each sub-block is allocated.

[0127] Specifically, the step of dividing each sub-block into a first information amount block and a second information amount block according to information entropy includes:

[0128] The sum of the information entropy of all sub-blocks is divided by the number of sub-blocks to obtain the mean entropy of the sub-blocks, denoted as Enp mean The information entropy of each sub-block is compared with the sub-block entropy mean, and the sub-blocks with information entropy greater than or equal to the sub-block entropy mean are divided into the first information block, denoted as ROI; the sub-blocks with information entropy less than the sub-block entropy mean are divided into the second information block, denoted as NROI. It should be understood that the greater the information entropy, the more information it corresponds to. Therefore, the information amount of the first information block is greater than that of the second information block.

[0129] The method for obtaining the mean information entropy of the first information block and the second information block is similar to the above-mentioned sub-block entropy mean, that is, the sum of the information entropy of each sub-block in the first information block is divided by the number of each sub-block in the first information block, and the sum of the information entropy of each sub-block in the second information block is divided by the number of each sub-block in the second information block.

[0130] Calculating the mean entropy difference according to the information entropy mean of the first information block and the information entropy mean of the second information block, including:

[0131] The difference between the mean information entropy of the first information block and the mean information entropy of the second information block is calculated, and the expression is:

[0132] ENP_DIFF_mean=ENP_NROI_mean-ENP_NROI_mean

[0133] Among them, ENP_DIFF_mean is the mean entropy difference; ENP_NROI_mean is the mean information entropy of the first information block; ENP_NROI_mean is the mean information entropy of the second information block.

[0134] Optionally, the entropy weight of each sub-block is allocated according to the mean entropy difference, including:

[0135] Through the first preset mapping relationship, the first information block weight and the second information block weight corresponding to the mean entropy difference are obtained.

[0136] See also Figure 5 , Figure 5 Shown is a curve diagram of the first preset mapping relationship. Figure 5 The horizontal axis in is the mean entropy difference ENP_DIFF_mean, and the vertical axis is the weight of the first information block ENP_ROI_weight, and the following corresponding relationship is satisfied:

[0137] When the ENP_DIFF_mean value is less than or equal to 0.3, ENP_ROI_weight is equal to 0.5;

[0138] When the ENP_DIFF_mean value is greater than 1.8, ENP_ROI_weight is equal to 1.0;

[0139] When ENP_DIFF_mean is between 0.3 and 1.8, ENP_ROI_weight is equal to the linear difference between 0.5 and 1.0.

[0140] Then the weight of the second information block is calculated by the weight of the first information block, and its expression is:

[0141] ENP_NROI_weight=1-ENP_ROI_weight

[0142] According to the information entropy of each sub-block, the first proportion of each sub-block in the first information block and the second information block is calculated. According to the first proportion, the weight of the first information block and the weight of the second information block, the entropy value weight of each sub-block is allocated.

[0143] Specifically, according to the ratio of the information entropy of each sub-block in the first information block to the total information entropy of the first information block, the weight of each sub-block in the first information block is redistributed, and the expression is:

[0144]

[0145] or

[0146]

[0147] Among them, ENP_ROI[i] is the information entropy of the i-th sub-block; is the sum of the overall information entropy of the first information block; ENP_ROI_weight is the weight of the first information block; and ENP_ROI_number is the number of sub-blocks in the first information block.

[0148] Similarly, according to the ratio of the information entropy of each sub-block in the second information block to the sum of the overall information entropy of the second information block, the weight of each sub-block in the second information block is redistributed, and its expression is:

[0149]

[0150] Among them, ENP_NROI[i] is the information entropy of the i-th sub-block; is the sum of the overall information entropy of the second information block; NP_NROI_weight is the weight of the second information block; ENP_NROI_number is the number of sub-blocks in the second information block.

[0151] It should be noted that if the sum of the overall information entropy of the second information block is zero, the above expression is:

[0152] ENP_NROI_weight[i]=ENP_NROI[i]×ENP_NROI_weight×ENP_NROI_number

[0153] Furthermore, the above reallocated weights are normalized, and the entropy value weight expression of each sub-block in the first information block is finally obtained as follows:

[0154]

[0155] The entropy weight expression of each sub-block in the second information block is:

[0156]

[0157] Optionally, the spatial weight is calculated according to the brightness mean of each sub-block, including:

[0158] According to the position of each sub-block in the image to be processed, each sub-block is divided into a central area and a non-central area.

[0159] Based on the brightness mean of each sub-block, the brightness mean of the central area and the brightness mean of the non-central area are counted.

[0160] The brightness mean difference between the brightness mean of the central area and the brightness mean of the non-central area is calculated.

[0161] The spatial weight of each sub-block is calculated based on the brightness mean difference.

[0162] See also Figure 6 , Figure 6 The sub-blocks are grouped according to the preset positions. Figure 6 The gray area in is the central area, denoted as GRAY_ROI. The white area is the non-central area, denoted as GRAY_NROI. The brightness mean GRAY_ROI_mean of the gray area and the brightness mean GRAY_NROI_mean of the white area are calculated respectively, and then the brightness mean difference GRAY_DIFF_mean between the central area and the non-central area is calculated. The expression is:

[0163] GRAY_DIFF_mean=|GRAY_ROI_mean-GRAY_NROI_mean|

[0164] Optionally, the spatial weight of each sub-block is calculated according to the brightness mean difference, including:

[0165] Through the second preset mapping relationship, the central area weight and the non-central area weight corresponding to the brightness mean difference are obtained.

[0166] See also Figure 7 , Figure 7 Shown is a curve diagram of the second preset mapping relationship.

[0167] Figure 7 The horizontal axis is the brightness mean difference GRAY_DIFF_mean, and the vertical axis is the center area weight GRAY_ROI_weight, and the following corresponding relationship is satisfied:

[0168] When the value of GRAY_DIFF_mean is less than or equal to 5, GRAY_ROI_weight is equal to 0.5;

[0169] When the value of GREAY_DIFF_mean is greater than 60, GRAY_ROI_weight is equal to 1.0;

[0170] When GRAY_DIFF_mean is between 5 and 60, the value of GRAY_ROI_weight is equal to the linear difference between 0.5 and 1.0.

[0171] Then the weight of the non-central area is calculated by the weight of the central area, and its expression is:

[0172] GRAY_NROI_weight=1-GRAY_ROI_weight

[0173] According to the brightness value of each sub-block, the second proportion of each sub-block in the central area and in the non-central area is calculated. According to the second proportion, the central area weight and the non-central area weight, the spatial weight of each sub-block is allocated.

[0174] Specifically, the obtained central area weight and non-central area weight are normalized, and the entropy value weight expression of each sub-block in the central area is finally obtained as follows:

[0175]

[0176] The entropy weight expression of each sub-block in the non-central area is finally obtained as follows:

[0177]

[0178] Among them, GRAY_ROI_number is the number of sub-blocks in the central area; GRAY_NROI_number is the number of sub-blocks in the non-central area.

[0179] Through the above steps, each sub-block obtains two sets of weights, namely, entropy weight and spatial weight, which are respectively denoted as sub_block_weight_enp and sub_block_weight_gray.

[0180] Optionally, according to the entropy weight of each sub-block and the spatial weight of each sub-block, the target brightness value of the image to be processed is calculated, including: obtaining the target weight based on a preset proportional relationship, the entropy weight and the spatial weight. Based on the target weight, weighted summing is performed on the brightness mean of each sub-block to obtain the target brightness value of the image to be processed.

[0181] Specifically, the preset proportional relationship can be set as needed. For example, in the embodiment of the present application, an average weighted method is adopted to calculate the target weight of each sub-block, and its expression is:

[0182] sub_blcok_weight[i]=

[0183] 0.5×sub_block_weight_enp[i]+0.5×sub_block_weight_gray[i]

[0184] Then, the adjusted target brightness value is obtained by the weighted brightness value of each sub-block and the respective target weights, and its expression is:

[0185]

[0186] The above automatic exposure control method calculates the target weight according to the entropy weight and spatial weight of each sub-block; and then obtains the target brightness value of the image to be processed according to the target weight and the brightness mean. The target brightness value is an expected value used to guide the adjustment of the image brightness. By adjusting the brightness value of each sub-block and thus adjusting the brightness value of the entire image, the brightness of the image to be processed can be adjusted more accurately, so that the details and contrast of the image are improved, thereby improving the overall quality of the image to be processed.

[0187] Optionally, adjusting the camera gain according to the target brightness value and a preset target brightness range includes:

[0188] When the target brightness value is less than the preset target brightness range, the camera gain is increased.

[0189] When the target brightness value is greater than the preset target brightness range, the camera gain is reduced.

[0190] Specifically, the preset target brightness range represents the tolerance range of the target brightness, which can be adjusted dynamically according to the actual situation. If it is within the tolerance range, the exposure is considered appropriate. When the target brightness value is within the preset target brightness range, it means that the calculated brightness value meets the requirements, and there is no need to adjust the camera gain. If the target brightness value is less than the preset target brightness range, it means that the calculated brightness value is dark, and the camera gain needs to be increased. If the target brightness value is greater than the preset target brightness range, it means that the calculated brightness value is bright, and the camera gain needs to be reduced.

[0191] The automatic exposure control method adjusts the camera gain based on the target brightness value so that the camera selects appropriate exposure parameters to obtain a high-quality image.

[0192] Optionally, the image to be processed also carries a global average brightness value, and the automatic exposure control method of the present application further includes:

[0193] When the global information entropy is not within the preset threshold range, the global average brightness value is used as the target brightness value.

[0194] Specifically, the global average brightness value of an image refers to the average brightness value of all pixels in the entire image, which reflects the overall brightness level of the image. The method of obtaining it includes: calculating the sum of the brightness values ​​of all pixels in the image and the number of pixels in the image, and dividing the sum of the pixel brightness by the number of pixels to obtain the global average brightness value.

[0195] Further, continuing to take the above preset threshold range as 0 to 2.8 as an example, if the global information entropy is not within the preset threshold range, it means that the global information entropy is greater than 2.8 or equal to 0. In this case, the global average brightness value is directly used as the target brightness value. If the global average brightness value is within the preset target brightness range, there is no need to adjust the camera gain. If the global average brightness value is less than the preset target brightness range, increase the camera gain. If the global average brightness value is greater than the preset target brightness range, reduce the camera gain.

[0196] The above automatic exposure control method proposes the traditional image region of interest method and the image block weighting method, which not only takes into account the situation where most of the photographed subjects are centered, but also is compatible with the situation where the subject position is uncertain or there are multiple subjects. It is suitable for various complex lighting scenes such as high contrast, low light, backlight, etc., and effectively improves the image quality.

[0197] See also Figure 8 , the following combination Figure 8 The steps of the automatic exposure control method of this application are described in detail:

[0198] Step S802: obtaining an image to be processed.

[0199] Step S804, calculating the global information entropy of the image to be processed, including: obtaining a global histogram of the image to be processed, performing non-uniform compression processing on the global histogram to obtain a compressed histogram; and calculating the global information entropy according to the compressed histogram.

[0200] Step S806, when the preset threshold range is set to 0 to 2.8, determine whether the global information entropy is greater than 2.8 or equal to 0, if so, jump to step S808, otherwise, jump to step S810.

[0201] Step S808, calculate the global average brightness value of the image to be processed, and use the global average brightness value as the target brightness value, and jump to step S818. Calculating the global average brightness value includes: calculating the sum of the brightness values ​​of all pixels in the image and the number of pixels in the image, and dividing the sum of the pixel brightness by the number of pixels to obtain the global average brightness value.

[0202] Step S810, dividing the image to be processed into blocks to obtain a plurality of sub-blocks; calculating the histogram of each sub-block, and then performing non-uniform compression on the histogram of each sub-block.

[0203] Step S812, calculating the entropy weight of each sub-block, including: obtaining the sub-block entropy mean and the information entropy of each sub-block, comparing the sub-block entropy mean and the information entropy of each sub-block, dividing the sub-blocks with information entropy greater than or equal to the sub-block entropy mean into the first information block, and dividing the sub-blocks with information entropy less than the sub-block entropy mean into the second information block. Counting the information entropy mean of each first information block and the information entropy mean of the second information block, and calculating the difference between the information entropy mean of the first information block and the information entropy mean of the second information block, to obtain the mean entropy difference. Through the first preset mapping relationship, the first information block weight and the second information block weight corresponding to the mean entropy difference are obtained, and according to the information entropy of each sub-block, the first proportion of each sub-block in the first information block and the second information block is calculated. According to the first proportion, the weight of the first information block and the weight of the second information block, the entropy weight of each sub-block is allocated.

[0204] Step S814, calculating the spatial weight of each sub-block, including: dividing each sub-block into a central area and a non-central area according to the position of each sub-block in the image to be processed. Based on the brightness mean of each sub-block, the brightness mean of the central area and the brightness mean of the non-central area are counted. The brightness mean difference between the brightness mean of the central area and the brightness mean of the non-central area is calculated. Through the second preset mapping relationship, the central area weight and the non-central area weight corresponding to the brightness mean difference are obtained, and according to the brightness value of each sub-block, the second proportion of each sub-block in the central area and in the non-central area is calculated. According to the second proportion, the central area weight and the non-central area weight, the spatial weight of each sub-block is allocated.

[0205] Step S816, calculating the target brightness value of the image to be processed, including: obtaining the target weight based on a preset proportional relationship, entropy weight and spatial weight; based on the target weight, performing weighted summation on the brightness mean of each sub-block to obtain the target brightness value of the image to be processed.

[0206] Step S818, adjusting the camera gain according to the target brightness value and the preset target brightness range, including: when the target brightness value is within the preset target brightness range, there is no need to adjust the camera gain; when the target brightness value is less than the preset target brightness range, increasing the camera gain; when the target brightness value is greater than the preset target brightness range, reducing the camera gain.

[0207] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0208] Based on the same inventive concept, the embodiment of the present application also provides an automatic exposure control device for implementing the automatic exposure control method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more automatic exposure control device embodiments provided below can refer to the limitations of the automatic exposure control method above, and will not be repeated here.

[0209] See also Fig. 9 In an exemplary embodiment, an automatic exposure control device is provided, comprising: an acquisition module 100, a weight calculation module 200, a brightness calculation module 300 and an adjustment module 400, wherein:

[0210] The acquisition module 100 is used to acquire the image to be processed; the image to be processed carries global information entropy.

[0211] The weight calculation module 200 is used to divide the image to be processed into blocks to obtain multiple sub-blocks when the global information entropy is within a preset threshold range, and calculate the entropy value weight and spatial weight of each sub-block.

[0212] The brightness calculation module 300 is used to calculate the target brightness value of the image to be processed according to the entropy weight of each sub-block and the spatial weight of each sub-block.

[0213] The adjustment module 400 is used to adjust the camera gain according to the target brightness value and the preset target brightness range; the camera gain is used to control the automatic exposure.

[0214] Optionally, the automatic exposure control device of the present application further includes:

[0215] The entropy calculation module is used to obtain a global histogram; the global histogram is generated by the camera according to the grayscale value of the image to be processed; the global histogram is subjected to non-uniform compression processing to obtain a compressed histogram; and the global information entropy is calculated based on the compressed histogram.

[0216] Optionally, the entropy calculation module includes:

[0217] The compression unit is used to merge the partitions in the global histogram according to the grayscale area to obtain a compressed histogram.

[0218] The first calculation unit is used to calculate the pixel ratio of each partition according to the ratio of the number of pixels included in each partition in the compressed histogram to the number of pixels in the image to be processed; and calculate the global information entropy according to the pixel ratio.

[0219] Optionally, the weight calculation module 200 includes:

[0220] The second calculation unit is used to obtain the information entropy of each sub-block and calculate the entropy value weight according to the information entropy of the sub-block.

[0221] Optionally, the second calculation unit includes:

[0222] The second calculation subunit is used to divide each sub-block into a first information block and a second information block according to information entropy, wherein the amount of information in the first information block is greater than that in the second information block; to count the mean information entropy of each first information block and the mean information entropy of the second information block; and to calculate the mean entropy difference according to the mean information entropy of the first information block and the mean information entropy of the second information block; and to allocate the entropy value weight of each sub-block according to the mean entropy difference.

[0223] Optionally, the compression unit is further configured to perform non-uniform compression on the histogram of each sub-block.

[0224] Optionally, the weight calculation module 200 further includes:

[0225] The third calculation unit is used to obtain the brightness mean of each sub-block and calculate the spatial weight according to the brightness mean of the sub-block.

[0226] Optionally, the third calculation unit includes:

[0227] The third calculation subunit is used to divide each sub-block into a central area and a non-central area according to the position of each sub-block in the image to be processed; based on the brightness mean of each sub-block, calculate the brightness mean of the central area and the brightness mean of the non-central area; calculate the brightness mean difference between the brightness mean of the central area and the brightness mean of the non-central area; and calculate the spatial weight of each sub-block according to the brightness mean difference.

[0228] Optionally, the brightness calculation module 300 includes:

[0229] The fourth calculation unit is used to obtain the target weight based on the preset proportional relationship, the entropy value weight and the spatial weight; based on the target weight, the brightness mean of each sub-block is weighted summed to obtain the target brightness value of the image to be processed.

[0230] Each module in the automatic exposure control device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0231] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Fig.10 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store texture data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, an automatic exposure control method is implemented.

[0232] Those skilled in the art will understand that Fig.10 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0233] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the method of the steps in any one of the above embodiments when executing the computer program.

[0234] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method of implementing the steps in any one of the above embodiments is implemented.

[0235] In one embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the method of implementing the steps in any one of the above embodiments is implemented.

[0236] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, an image processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0237] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0238] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. An automatic exposure control method, characterized in that: The method comprises: Acquire an image to be processed; the image to be processed carries global information entropy; When the global information entropy is within a preset threshold range, the image to be processed is divided into blocks to obtain a plurality of sub-blocks, and the entropy value weight and spatial weight of each of the sub-blocks are calculated; Calculating a target brightness value of the image to be processed according to the entropy weight of each sub-block and the spatial weight of each sub-block; The camera gain is adjusted according to the target brightness value and the preset target brightness range; the camera gain is used to control the camera to perform automatic exposure.

2. The method according to claim 1, characterized in that The calculating the entropy weight and the spatial weight of each sub-block includes: Obtaining information entropy of each of the sub-blocks and a brightness mean of each of the sub-blocks; The entropy value weight is calculated according to the information entropy of the sub-blocks, and the spatial weight is calculated according to the brightness mean of each sub-block.

3. The method according to claim 2, characterized in that The calculating the entropy value weight according to the information entropy of the sub-block comprises: According to the information entropy, each of the sub-blocks is divided into a first information block and a second information block, wherein the information amount of the first information block is greater than the information amount of the second information block; Counting the information entropy mean value of each of the first information blocks and the information entropy mean value of the second information blocks; and calculating a mean entropy difference according to the mean information entropy of the first information block and the mean information entropy of the second information block; The entropy weight of each of the sub-blocks is allocated according to the mean entropy difference.

4. The method according to claim 3, characterized in that The allocating entropy weights of the sub-blocks according to the mean entropy difference comprises: Obtaining a first information block weight and a second information block weight corresponding to the mean entropy difference through a first preset mapping relationship; Calculating, according to the information entropy of each of the sub-blocks, a first proportion of each of the sub-blocks in the first information amount block and in the second information amount block; The entropy value weight of each of the sub-blocks is allocated according to the first proportion, the first information block weight and the second information block weight.

5. The method according to claim 2, characterized in that: The calculating the spatial weight according to the brightness mean of each sub-block comprises: According to the position of each sub-block in the image to be processed, each sub-block is divided into a central area and a non-central area; Based on the brightness mean values ​​of the sub-blocks, calculating the brightness mean value of the central area and the brightness mean value of the non-central area; Calculating a brightness mean difference between a brightness mean of the central area and a brightness mean of the non-central area; The spatial weight of each of the sub-blocks is calculated according to the brightness mean difference.

6. The method according to claim 5, characterized in that The calculating the spatial weight of each of the sub-blocks according to the brightness mean difference comprises: Obtaining a central area weight and a non-central area weight corresponding to the brightness mean difference through a second preset mapping relationship; Calculating, according to the brightness value of each of the sub-blocks, a second proportion of each of the sub-blocks in the central area and in the non-central area; The spatial weight of each of the sub-blocks is allocated according to the second proportion, the central area weight, and the non-central area weight.

7. The method according to claim 2, characterized in that The calculating the target brightness value of the image to be processed according to the entropy value weight of each sub-block and the spatial weight of each sub-block includes: Obtaining a target weight based on a preset proportional relationship, the entropy value weight, and the spatial weight; Based on the target weight, a weighted sum is performed on the brightness mean values ​​of the sub-blocks to obtain a target brightness value of the image to be processed.

8. The method according to claim 1, characterized in that The image to be processed carries a global average brightness value, and the method further comprises: When the global information entropy is not within the preset threshold range, the global average brightness value is used as the target brightness value.

9. The method according to claim 1, characterized in that: The adjusting the camera gain according to the target brightness value and the preset target brightness range includes: When the target brightness value is less than the preset target brightness range, increasing the camera gain; When the target brightness value is greater than the preset target brightness range, the camera gain is reduced.

10. The method according to claim 1, characterized in that The calculation process of the global information entropy includes: Acquire a global histogram; the global histogram is generated by the camera according to the grayscale value of the image to be processed; Performing non-uniform compression processing on the global histogram to obtain a compressed histogram; The global information entropy is calculated based on the compressed histogram.

11. The method according to claim 10, characterized in that The non-uniform compression processing is performed on the global histogram to obtain a compressed histogram, including: The partitions in the global histogram are merged according to the grayscale areas to obtain the compressed histogram.

12. The method according to claim 10, characterized in that The calculating the global information entropy according to the compressed histogram includes: Calculating the pixel ratio of each partition according to the ratio of the number of pixels included in each partition in the compressed histogram to the number of pixels in the image to be processed; The global information entropy is calculated according to the pixel ratio.

13. An automatic exposure control device, characterized in that: The device comprises: An acquisition module, used for acquiring an image to be processed; the image to be processed carries global information entropy; A weight calculation module, used for dividing the image to be processed into blocks to obtain a plurality of sub-blocks when the global information entropy is within a preset threshold range, and calculating the entropy value weight and spatial weight of each sub-block; A brightness calculation module, used for calculating a target brightness value of the image to be processed according to the entropy weight of each sub-block and the spatial weight of each sub-block; The adjustment module is used to adjust the camera gain according to the target brightness value and a preset target brightness range; the camera gain is used to control automatic exposure.

14. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 12 are implemented.

15. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.

16. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.