Image exposure processing method, device, apparatus, medium
By segmenting the target image and calculating the brightness standard deviation and ROI difference value, combined with the exposure tolerance value and threshold, the problem of inaccurate exposure detection in the existing technology is solved, and more accurate exposure processing and imaging effects are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ALLWINNER TECH CO LTD
- Filing Date
- 2025-05-22
- Publication Date
- 2026-08-04
AI Technical Summary
Existing exposure detection methods are based on pixel-level judgment, which cannot accurately determine whether an image is overexposed or underexposed due to scattered pixels, thus affecting the imaging effect of exposure processing.
By dividing the target image acquired by the imaging sensor into segments, calculating the brightness standard deviation and ROI difference value of the image blocks, and combining the exposure tolerance value and ROI difference threshold, the exposure detection result is determined, and the exposure parameters are adjusted based on the detection result.
This improves the accuracy of exposure detection results, ensures the imaging effect of exposure processing, and reduces computational complexity and equipment computing power requirements.
Smart Images

Figure CN120730184B_ABST
Abstract
Description
Technical Field
[0001] This application relates to, but is not limited to, the field of image processing technology, and in particular to an image exposure processing method, apparatus, device, and medium. Background Technology
[0002] During photography and videography, exposure detection of the current scene is necessary to determine whether it is overexposed or underexposed. Based on the detection results, the exposure parameters of the shooting equipment are adjusted to suppress overexposure or underexposure caused by front lighting, backlighting, or other lighting conditions, ensuring image quality. Most existing exposure detection methods are pixel-based, comparing pixel values to thresholds to identify overexposed or underexposed pixels. Weighting overexposed and underexposed pixels in the scene determines whether it is overexposed or underexposed. However, this method cannot guarantee the accuracy of exposure detection results in scenes where overexposed or underexposed pixels are scattered, thus affecting the subsequent exposure processing of the image. Summary of the Invention
[0003] This application provides an image exposure processing method, apparatus, device, and medium that can effectively improve the accuracy of exposure detection results, thereby ensuring the imaging effect of exposure processing.
[0004] In a first aspect, embodiments of this application provide an image exposure processing method, including:
[0005] The target image acquired by the imaging sensor is divided into multiple image blocks, each of which has a weight value and a brightness value.
[0006] A first average brightness value of the target image is calculated based on all of the brightness values, and the brightness standard deviation of the target image is calculated based on each of the brightness values and the first average brightness value.
[0007] Based on the weight values, a first image block belonging to the region of interest and a second image block belonging to the region of non-interest are determined in the target image. A second average brightness value of the first image block is calculated, and a third average brightness value of the second image block is calculated. The difference between the second average brightness and the third average brightness is determined as the ROI difference value.
[0008] Obtain a preset exposure tolerance value and ROI difference threshold, determine a first comparison relationship between the brightness standard deviation and the exposure tolerance value, determine a second comparison relationship between the ROI difference value and the ROI difference threshold, and determine the exposure detection result of the target image based on the first comparison relationship and the second comparison relationship;
[0009] The target image is subjected to exposure processing based on the exposure detection results.
[0010] In some embodiments, determining a first image patch belonging to a region of interest and a second image patch belonging to a region of non-interest in the target image based on the weight values includes:
[0011] All the image blocks are normalized to obtain multiple new image blocks, each of which corresponds to a new weight value, and each new weight value is obtained by normalizing the weight value.
[0012] The new image block corresponding to the new weight value that is greater than 1 is determined as the first image block;
[0013] The new image block corresponding to the new weight value that is less than or equal to 1 is determined as the second image block.
[0014] In some embodiments, determining the exposure detection result of the target image based on the first comparison relationship and the second comparison relationship includes:
[0015] When the brightness standard deviation is greater than the exposure tolerance value, the ROI difference value is greater than the ROI difference threshold, and the first average brightness value is greater than the preset brightness threshold, the exposure detection result indicates that the target image is in an overexposed scene.
[0016] When the brightness standard deviation is greater than the exposure tolerance value, and the negative number of the ROI difference value is greater than the ROI difference threshold, the exposure detection result indicates that the target image is in an underexposed scene.
[0017] In some embodiments, each of the new image blocks also corresponds to a brightness weight value, and exposure processing of the target image is performed based on the exposure detection result, including:
[0018] Summing all the brightness weight values yields the first weighted sum;
[0019] Summing all the new weight values yields the second weight sum;
[0020] An exposure resistance weight value is determined based on the exposure detection result, and the second weight sum is adjusted based on the brightness standard deviation and the exposure resistance weight value. The exposure resistance weight value is either an underexposure resistance weight value or an overexposure resistance weight value. When the exposure detection result indicates that the target image is in an underexposure scene, the exposure resistance weight value is determined as the underexposure resistance weight value. When the exposure detection result indicates that the target image is in an overexposure scene, the exposure resistance weight value is determined as the overexposure resistance weight value.
[0021] Divide the first weighted sum by the adjusted second weighted sum to obtain the desired brightness value;
[0022] The current exposure parameters of the imaging sensor are adjusted based on the desired brightness value.
[0023] In some embodiments, adjusting the second weighted sum based on the brightness standard deviation and the exposure resistance weight value includes:
[0024] The second weight is adjusted based on the comparison between the brightness standard deviation and the preset standard deviation threshold;
[0025] The second weight is adjusted based on the comparison between the anti-exposure weight value and the preset weight threshold.
[0026] In some embodiments, adjusting the second weighted sum based on the comparison between the brightness standard deviation and a preset standard deviation threshold includes:
[0027] When the exposure detection result indicates that the target image is in an overexposed scene, and the brightness standard deviation is greater than the standard deviation threshold, the product of the second weight and the brightness standard deviation is calculated, and the product of the second weight and the brightness standard deviation is divided by the standard deviation threshold to obtain the adjusted second weight.
[0028] When the exposure detection result indicates that the target image is in an underexposed scene, if the brightness standard deviation is greater than the standard deviation threshold, the second weight sum is limited to a third value range. The larger the value of the brightness standard deviation, the smaller the value of the second weight sum.
[0029] In some embodiments, adjusting the second weight based on a comparison between the anti-exposure weight value and a preset weight threshold includes:
[0030] When the exposure detection result indicates that the target image is in an overexposed scene, if the anti-exposure weight value is less than the weight threshold, the second weight is limited to a first value range by interpolation. If the anti-exposure weight value is greater than or equal to the weight threshold, the second weight is limited to a second value range by interpolation. In this case, the larger boundary threshold in the first value range is less than or equal to the smaller boundary threshold in the second value range.
[0031] When the exposure detection result indicates that the target image is in an underexposed scene, if the anti-exposure weight value is less than the weight threshold, the second weight sum is limited to the second value range by interpolation. If the anti-exposure weight value is greater than or equal to the weight threshold, the second weight sum is limited to the first value range by interpolation.
[0032] In a second aspect, embodiments of this application provide a control device, including at least one control processor and a memory for communicatively connecting to the at least one control processor; the memory stores instructions executable by the at least one control processor, which, when executed by the at least one control processor, enable the at least one control processor to perform the image exposure processing method as described in the first aspect.
[0033] Thirdly, embodiments of this application also provide an electronic device, including the control device of the second aspect.
[0034] Fourthly, embodiments of this application also provide a computer-readable storage medium storing computer-executable instructions for performing the image exposure processing method as described in the first aspect.
[0035] This application provides an image exposure processing method, apparatus, device, and medium. The method includes: dividing a target image acquired by an imaging sensor into multiple image blocks, wherein each image block corresponds to a weight value and a brightness value; calculating a first average brightness value of the target image based on all the brightness values, and calculating a brightness standard deviation of the target image based on each brightness value and the first average brightness value; determining a first image block belonging to a region of interest (ROI) and a second image block belonging to a region of non-interest (ROI) in the target image based on the weight values, calculating a second average brightness value of the first image block, and calculating a third average brightness value of the second image block, and determining the difference between the second average brightness and the third average brightness as an ROI difference value; obtaining a preset exposure tolerance value and an ROI difference threshold, determining a first comparison relationship between the brightness standard deviation and the exposure tolerance value, determining a second comparison relationship between the ROI difference value and the ROI difference threshold, determining an exposure detection result of the target image based on the first comparison relationship and the second comparison relationship; and performing exposure processing on the target image based on the exposure detection result. According to the solution provided in the embodiments of this application, the global exposure state of the target image is determined by comparing the brightness standard deviation with the exposure tolerance value and the ROI difference value with the ROI difference threshold. That is, by combining the two reference factors of the brightness distribution dispersion and the judgment of whether there is regional imbalance in exposure, the global exposure state of the target image is determined. Compared with the existing method of exposure detection by pixel value which is not sensitive to the dispersion of exposure pixels, the accuracy of exposure detection results is effectively improved, thereby ensuring the imaging effect of exposure processing. Attached Figure Description
[0036] Figure 1 This is a flowchart of the steps of an image exposure processing method provided in one embodiment of this application;
[0037] Figure 2 This is a schematic diagram of an image exposure processing method provided in another embodiment of this application;
[0038] Figure 3 This is a structural diagram of a control device provided in another embodiment of this application. Detailed Implementation
[0039] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0040] It is understandable that although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first," "second," etc., in the specification, claims, or the aforementioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0041] During photography and videography, exposure detection of the current scene is necessary to determine whether it is overexposed or underexposed. Based on the detection results, the exposure parameters of the shooting equipment are adjusted to suppress overexposure or underexposure caused by front lighting, backlighting, or other lighting conditions, ensuring image quality. Most existing exposure detection methods are pixel-based, comparing pixel values to thresholds to identify overexposed or underexposed pixels. Weighting overexposed and underexposed pixels in the scene determines whether it is overexposed or underexposed. However, this method cannot guarantee the accuracy of exposure detection results in scenes where overexposed or underexposed pixels are scattered, thus affecting the subsequent exposure processing of the image.
[0042] To address the aforementioned problems, embodiments of this application provide an image exposure processing method, apparatus, device, and medium. The method includes: dividing a target image acquired by an imaging sensor into multiple image blocks, wherein each image block corresponds to a weight value and a brightness value; calculating a first average brightness value of the target image based on all the brightness values, and calculating a brightness standard deviation of the target image based on each brightness value and the first average brightness value; determining a first image block belonging to a region of interest (ROI) and a second image block belonging to a region of non-interest (ROI) in the target image based on the weight values, calculating a second average brightness value of the first image block, and calculating a third average brightness value of the second image block, and determining the difference between the second average brightness and the third average brightness as an ROI difference value; obtaining a preset exposure tolerance value and an ROI difference threshold, determining a first comparison relationship between the brightness standard deviation and the exposure tolerance value, determining a second comparison relationship between the ROI difference value and the ROI difference threshold, determining an exposure detection result of the target image based on the first comparison relationship and the second comparison relationship; and performing exposure processing on the target image based on the exposure detection result. According to the solution provided in the embodiments of this application, the global exposure state of the target image is determined by comparing the brightness standard deviation with the exposure tolerance value and the ROI difference value with the ROI difference threshold. That is, by combining the two reference factors of the brightness distribution dispersion and the judgment of whether there is regional imbalance in exposure, the global exposure state of the target image is determined. Compared with the existing method of exposure detection by pixel value which is not sensitive to the dispersion of exposure pixels, the accuracy of exposure detection results is effectively improved, thereby ensuring the imaging effect of exposure processing.
[0043] The embodiments of this application will be further described below with reference to the accompanying drawings.
[0044] refer to Figure 1 , Figure 1 This is a flowchart illustrating the steps of an image exposure processing method according to an embodiment of this application. This application provides an image exposure processing method, which includes, but is not limited to, the following steps:
[0045] Step S10: Divide the target image acquired by the imaging sensor into multiple image blocks, where each image block has a weight value and a brightness value.
[0046] Specifically, the image exposure processing method of this embodiment is applied in an electronic device with an imaging sensor and an image signal processor. It should be noted that this embodiment does not limit the specific number of image blocks into which the target image is divided; those skilled in the art can determine the number based on the hardware performance of the electronic device. In this embodiment, it can be divided into 18*24 blocks, i.e., 432 image blocks.
[0047] It is understood that, after dividing the target image into image blocks, this embodiment assigns weight values and brightness values to each image block, providing an effective data foundation for subsequent exposure detection and exposure processing.
[0048] Step S20: Calculate the first average brightness value of the target image based on all brightness values, and calculate the brightness standard deviation of the target image based on each brightness value and the first average brightness value.
[0049] It is understandable that the standard deviation of brightness can characterize the dispersion of the brightness distribution of the target image. In this embodiment, the first average brightness value of the target image is calculated based on all brightness values, and the standard deviation of brightness of the target image is calculated based on each brightness value and the first average brightness value, so as to provide an effective data basis for subsequent exposure detection and exposure processing.
[0050] Specifically, when the number of image patches is 432, the standard deviation of the target image's brightness, std_devi, is obtained according to the following formula:
[0051]
[0052] Where avg_lum is the first average brightness value, lum[i] is each brightness value, and i is the sequence number of each image block in the target image.
[0053] Step S30: Based on the weight values, determine the first image block belonging to the region of interest and the second image block belonging to the non-region of interest in the target image. Calculate the second average brightness value of the first image block and the third average brightness value of the second image block. Determine the difference between the second average brightness and the third average brightness as the ROI difference value.
[0054] Specifically, in some embodiments, Figure 1 Step S30, which determines the first image patch belonging to the region of interest and the second image patch belonging to the non-region of interest in the target image based on weight values, includes, but is not limited to, the following steps:
[0055] Step S31: Normalize all image blocks to obtain multiple new image blocks, where each new image block corresponds to a new weight value, and each new weight value is obtained by normalizing the weight value.
[0056] Step S32: Determine the new image block corresponding to the new weight value that is greater than 1 as the first image block;
[0057] Step S33: The new image block corresponding to the new weight value with a value less than or equal to 1 is determined as the second image block.
[0058] Specifically, in this embodiment, the region of interest is the region corresponding to a person or object in the target image, while the region of non-interest is the background, sky, etc. The new weight value used to distinguish between the region of interest and the region of non-interest is calculated from the weight values of the image blocks divided before the original unnormalized processing. The weight value can be assigned based on the image content recognition result, and the weight value of the image block corresponding to the region of interest is higher than the weight value of the image block of the region of non-interest.
[0059] It is understandable that this embodiment performs normalization processing on the currently divided image blocks before dividing them into regions of interest and non-regions of interest. This normalization process standardizes the statistical values (e.g., weight values, brightness values) of each image block, eliminating the differences in absolute values between different image blocks. The new image blocks after normalization are fewer than the original image blocks. For example, in this embodiment, 432 image blocks are normalized to obtain 64 new image blocks. After normalization, the feature values of all blocks are on the same scale, avoiding the dominance of certain extreme values in weight allocation. Then, based on the new weight values of the normalized image blocks, the regions of interest and non-regions of interest are divided. This operation can provide effective support for achieving accurate exposure detection in the future. Furthermore, after dividing the region of interest (ROI) into regions of non-interest (ROI), the second average brightness value of the first image block corresponding to the ROI is calculated, and the third average brightness value of the second image block corresponding to the ROI is calculated. The difference between the second and third average brightness values is determined as the ROI difference value. That is, the ROI difference value represents the brightness difference between the ROI and the ROI, which can be used to determine whether there is regional exposure imbalance in the target image (such as partial overexposure or partial underexposure). If the ROI difference value is greater than the ROI difference threshold, it indicates that the overexposed / underexposed pixels are concentrated in a specific area rather than being uniformly distributed. If the ROI difference value is less than or equal to the ROI difference threshold, it indicates that the exposure of the target image is relatively uniform.
[0060] Step S40: Obtain the preset exposure tolerance value and ROI difference threshold, determine the first comparison relationship between the brightness standard deviation and the exposure tolerance value, determine the second comparison relationship between the ROI difference value and the ROI difference threshold, and determine the exposure detection result of the target image based on the first comparison relationship and the second comparison relationship.
[0061] Specifically, in some embodiments, Figure 1 Step S40, which determines the exposure detection result of the target image based on the first comparison relationship and the second comparison relationship, includes, but is not limited to, the following steps:
[0062] Step S41: When the brightness standard deviation is greater than the exposure tolerance value, the ROI difference value is greater than the ROI difference threshold, and the first average brightness value is greater than the preset brightness threshold, the exposure detection result is determined to indicate that the target image is in an overexposed scene.
[0063] Step S42: When the brightness standard deviation is greater than the exposure tolerance value and the negative number of the ROI difference value is greater than the ROI difference threshold, the exposure detection result is determined to indicate that the target image is in an underexposed scene.
[0064] Specifically, the exposure tolerance value is the tolerance for overexposure / underexposure, and the value range is [0, 255]. In this embodiment, the exposure tolerance value can be 100. The smaller the value, the easier it is to be judged as overexposure or underexposure. The exposure tolerance value can be dynamically adjusted according to the actual situation.
[0065] Specifically, the ROI difference threshold in this embodiment is defined as the absolute value of the average brightness of the region of interest minus the average brightness of the region of non-interest, and the value range is [0, 255]. In this embodiment, the ROI difference threshold can be 40. The smaller the value, the easier it is to be judged as overexposed or underexposed. The ROI difference threshold can be dynamically adjusted according to the actual situation.
[0066] Understandably, in this embodiment, when the brightness standard deviation is greater than the exposure tolerance value, the ROI difference value is greater than the ROI difference threshold, and the first average brightness value is greater than the preset brightness threshold (the preset brightness threshold value in this embodiment is 30), the exposure detection result indicates that the target image is in an overexposed scene. When the brightness standard deviation is greater than the exposure tolerance value, and the negative of the ROI difference value (i.e., the difference between the third average brightness corresponding to the second image block corresponding to the non-interest region and the second average brightness of the first image block of the interest region) is greater than the ROI difference threshold, the exposure detection result indicates that the target image is in an underexposed scene. Thus, after calculating the brightness standard deviation and the ROI difference value, this embodiment determines the exposure detection result of the target image by combining the first comparison relationship between the brightness standard deviation and the exposure tolerance value, and the second comparison relationship between the ROI difference value and the ROI difference threshold. That is, it combines the dispersion of the brightness distribution in the target image and whether there is a regional imbalance in the exposure to determine the global exposure state of the target image. Compared with the existing method of exposure detection by pixel value, which is not sensitive to the dispersion of exposure pixels, this effectively improves the accuracy of the exposure detection result, thereby ensuring the imaging effect of the exposure processing.
[0067] It should be noted that while existing technologies have proposed using deep learning to accurately determine and adjust overexposed or underexposed scenes, the application of deep learning consumes significant computing power. In contrast, the embodiments of this application determine the global exposure state of the target image by combining two reference factors: the dispersion of brightness distribution in the target image and whether there is regional exposure imbalance. This method significantly reduces computational load and complexity compared to deep learning, while ensuring better exposure detection results.
[0068] Step S50: Perform exposure processing on the target image based on the exposure detection results.
[0069] Specifically, in some embodiments, each new image block also corresponds to a brightness weight value. Figure 1 Step S50 includes, but is not limited to, the following steps:
[0070] Step S51: Sum all the brightness weight values to obtain the first weighted sum;
[0071] Step S52: Sum all the new weight values to obtain the second weight sum;
[0072] Step S53: Determine the exposure resistance weight value based on the exposure detection result, and adjust the second weight sum based on the brightness standard deviation and the exposure resistance weight value. The exposure resistance weight value is either the underexposure resistance weight value or the overexposure resistance weight value. When the exposure detection result indicates that the target image is in an underexposure scene, the exposure resistance weight value is determined as the underexposure resistance weight value. When the exposure detection result indicates that the target image is in an overexposure scene, the exposure resistance weight value is determined as the overexposure resistance weight value.
[0073] Step S54: Divide the first weighted sum by the adjusted second weighted sum to obtain the desired brightness value;
[0074] Step S55: Adjust the current exposure parameters of the imaging sensor based on the desired brightness value.
[0075] Specifically, in this embodiment, the range of the anti-overexposure weight value is [0, 1024], and the range of the anti-underexposure weight value is [0, 1024].
[0076] Specifically, in some embodiments, step S53, which adjusts the second weight sum based on the brightness standard deviation and the anti-exposure weight value, includes, but is not limited to, the following steps:
[0077] Step S531: Adjust the second weight sum based on the comparison relationship between the brightness standard deviation and the preset standard deviation threshold.
[0078] Specifically, in some embodiments, step S531 includes, but is not limited to, the following steps:
[0079] Step S5311: When the exposure detection result indicates that the target image is in an overexposed scene, if the brightness standard deviation is greater than the standard deviation threshold, calculate the product of the second weight sum and the brightness standard deviation, divide the product of the second weight sum and the brightness standard deviation by the standard deviation threshold, and obtain the adjusted second weight sum.
[0080] Step S5312: When the exposure detection result indicates that the target image is in an underexposed scene, if the brightness standard deviation is greater than the standard deviation threshold, the second weight sum is limited to the range of the third value. The larger the value of the brightness standard deviation, the smaller the value of the second weight sum.
[0081] Specifically, when the exposure detection result indicates that the target image is in an overexposed scene, the adjustment formula for the second weighted sum is as follows: sum_weighted1 = sum_weighted0 * std_devi / 100, where sum_weighted0 is the second weighted sum before adjustment based on the comparison between the brightness standard deviation and the preset standard deviation threshold, and sum_weighted1 is the second weighted sum after adjustment based on the comparison between the brightness standard deviation and the preset standard deviation threshold; when the exposure detection result indicates that the target image is in an underexposed scene, and the brightness standard deviation is greater than the standard deviation threshold, the adjustment formula for the second weighted sum is as follows:
[0082] sum_weighted1=sum_weighted0*(100-((std_devi-100-0)*(100-40) / (200 -0)) / 100;
[0083] This means that the larger the calculated standard deviation of brightness std_devi is, the smaller the value of the second weight and sum_weighted1 is. The second weight and sum_weighted1 decrease between 1 and 0.4 times sum_weighted0. That is, the third value range of the adjusted second weight sum is between 1 and 0.4 times the original second weight sum.
[0084] Step S532: Adjust the second weight sum based on the comparison relationship between the anti-exposure weight value and the preset weight threshold.
[0085] Specifically, in some embodiments, step S532 includes, but is not limited to, the following steps:
[0086] Step S5321: When the exposure detection result indicates that the target image is in an overexposed scene, when the anti-exposure weight value is less than the weight threshold, the second weight is limited to the first value range by interpolation. When the anti-exposure weight value is greater than or equal to the weight threshold, the second weight is limited to the second value range by interpolation. Wherein, the larger boundary threshold in the first value range is less than or equal to the smaller boundary threshold in the second value range.
[0087] Step S5322: When the exposure detection result indicates that the target image is in an underexposed scene, if the anti-exposure weight value is less than the weight threshold, the second weight is limited to a second value range by interpolation. If the anti-exposure weight value is greater than or equal to the weight threshold, the second weight is limited to a first value range by interpolation.
[0088] Specifically, this embodiment does not limit the specific weight threshold, which can be determined by those skilled in the art based on the actual situation. When the exposure detection result indicates that the target image is in an overexposed scene, the weight threshold corresponding to the anti-exposure weight value anti_over_exp is 256. The smaller the weight threshold is set, the higher the expected brightness value of the imaging sensor exposure will be than the target brightness. When the exposure detection result indicates that the target image is in an underexposed scene, the weight threshold corresponding to the anti-exposure weight value anti_under_exp is 256. The smaller the weight threshold is set, the lower the expected brightness value of the imaging sensor exposure will be than the target brightness.
[0089] It should be noted that when the exposure detection result indicates that the target image is in an overexposed scene, if the anti-overexp weight value is less than the weight threshold, the second weight is limited to the first value range through interpolation; if the anti-overexp weight value is greater than or equal to the weight threshold, the second weight is limited to the second value range through interpolation.
[0090] Specifically, in this embodiment, the first value range is between 0.3 times and 1 times the original second weight sum. The second weight sum is limited to the first value range by interpolation according to the following formula:
[0091] sum_weighted3=sum_weighted2*(300+(anti_over_exp-0)*(1000-300) / (256-0)) / 1000;
[0092] In this embodiment, the second value range is between 1 times and 3 times the original second weight sum. The second weight sum is restricted to this range by interpolation according to the following formula:
[0093] sum_weighted3=sum_weighted2*(3000-(anti_under_exp-0)*(3000-1000) / (256-0)) / 1000;
[0094] Wherein, sum_weighted2 is the second weighted sum before adjustment based on the comparison relationship between the anti-exposure weight value and the preset weight threshold, and sum_weighted3 is the second weighted sum after adjustment based on the comparison relationship between the anti-exposure weight value and the preset weight threshold.
[0095] It is understandable that, after performing exposure detection on the target image by combining two reference factors—the degree of dispersion of brightness distribution and the determination of whether there is regional imbalance in exposure—this invention further uses the calculation of sample standard deviation combined with the set exposure adjustment ratio and the differentiation of regions of interest and regions of non-interest to achieve more accurate and delicate control over the exposure adjustment amount. Compared with the traditional existing technology that adjusts the preset exposure value based on a single weight configuration and exposure adjustment ratio, this invention can more reasonably control the imaging sensor, output appropriate exposure, suppress overexposure and underexposure, and improve imaging effect.
[0096] In addition, to provide a more detailed explanation of the image exposure processing method provided by the present invention, the technical solution of the present invention will be described below with a specific example.
[0097] refer to Figure 2 , Figure 2 This is a schematic diagram of an image exposure processing method provided in another embodiment of this application, which includes the following steps:
[0098] Step S210: Acquire the target image through the imaging sensor and divide the target image into 18*24 image blocks;
[0099] Step S220: Normalize the regions of 18*24 image blocks into 64 new image blocks, and assign new weight values to the 64 new image blocks.
[0100] Step S230: Calculate the first average brightness value based on the brightness values of 18*24 image blocks, and calculate the brightness standard deviation corresponding to 18*24 image blocks.
[0101] Step S240: Calculate the second average brightness value of the new image block in the region of interest and the third average brightness value of the new image block in the non-region of interest. The difference between the second average brightness and the third average brightness is determined as the ROI difference value.
[0102] Step S250: Determine the first comparison relationship between the brightness standard deviation and the exposure tolerance value, determine the second comparison relationship between the ROI difference value and the ROI difference threshold, and determine the exposure detection result of the target image based on the first comparison relationship and the second comparison relationship;
[0103] In step S260, the brightness weights of 64 new image blocks are summed to obtain the first weighted sum, and the new weights of 64 new image blocks are summed to obtain the second weighted sum.
[0104] Step S271: When the brightness standard deviation is greater than the exposure tolerance value of 100, and the difference between the second average brightness value and the third average brightness value is greater than the ROI difference threshold of 40, and the first average brightness value is greater than 30, the exposure detection result indicates that the target image is in an overexposed scene.
[0105] Step S272: When the target image is in an overexposed scene, the second weighted sum is adjusted sequentially based on the brightness standard deviation and the anti-overexposure weight value. Specifically, when the brightness standard deviation is greater than the standard deviation threshold of 100, the second weighted sum is adjusted according to the formula sum_weighted1=sum_weighted0*std_devi / 100; when the anti-overexposure weight value is less than the weight threshold of 256, the second weighted sum is adjusted according to the formula sum_weighted3=sum_weighted2*(300+(anti_over_exp-0)*(1000-300) / (256-0)). / 1000, the second weight is limited by interpolation to between 0.3 times and 1 times the original second weight, i.e., within the first value range; when the anti-exposure weight value is greater than or equal to the weight threshold 256, according to the formula sum_weighted3=sum_weighted2*(3000-(anti_under_exp-0)*(3000-1000) / (256-0)) / 1000, the second weight is limited by interpolation to between 1 times and 3 times the original second weight, i.e., within the second value range;
[0106] Step S273: Divide the first weighted sum by the adjusted second weighted sum to obtain the desired brightness value;
[0107] Step S274: Adjust the current exposure parameters of the imaging sensor based on the desired brightness value so that the exposure and gain of the imaging sensor transition from the current target brightness value to the desired brightness value.
[0108] Step S275: When the standard deviation of brightness is greater than the exposure tolerance value of 100, and the difference between the third average brightness value and the second average brightness value is greater than the ROI difference threshold of 40, the exposure detection result indicates that the target image is in an underexposed scene.
[0109] Step S276: When the target image is in an underexposed scene, the second weight is adjusted sequentially based on the brightness standard deviation and the anti-overexposure weight value. Specifically, when the brightness standard deviation is greater than the standard deviation threshold of 100, the weight is adjusted according to the formula sum_weighted1=sum_weighted0*(100-((std_devi-100-0)*(100-40) / (200). -0)) / 100, adjust the second weight sum; when the anti-exposure weight value is less than the weight threshold 256, according to the formula sum_weighted3=sum_weighted2*(3000-(anti_under_exp-0)*(3000-1000) / (256-0)) / 1000, the second weight sum is limited to between 1 times and 3 times the second weight sum before adjustment by interpolation, that is, within the second value range; when the anti-exposure weight value is greater than or equal to the weight threshold 256, according to the formula sum_weighted3=sum_weighted2*(300+(anti_over_exp-0)*(1000-300) / (256-0)) / 1000, the second weight sum is limited to between 0.3 times and 1 times the second weight sum before adjustment by interpolation, that is, within the first value range;
[0110] Step S277: Divide the first weighted sum by the adjusted second weighted sum to obtain the desired brightness value;
[0111] Step S278: Adjust the current exposure parameters of the imaging sensor based on the desired brightness value so that the exposure and gain of the imaging sensor transition from the current target brightness value to the desired brightness value.
[0112] like Figure 3 As shown, Figure 3 This is a structural diagram of a control device provided in one embodiment of this application. The present invention also provides a control device 300, comprising:
[0113] The processor 310 can be implemented using a general-purpose central processing unit (CPU), microprocessor, application specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application.
[0114] The memory 320 can be implemented as a read-only memory (ROM), static storage device, dynamic storage device, or random access memory (RAM). The memory 320 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 320 and called by the processor 310 to execute the image exposure processing method of the embodiments of this application.
[0115] Input / output interface 330 is used to realize information input and output;
[0116] The communication interface 340 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0117] Bus 350 transmits information between various components of the device (e.g., processor 310, memory 320, input / output interface 330, and communication interface 340);
[0118] The processor 310, memory 320, input / output interface 330 and communication interface 340 are connected to each other within the device via bus 350.
[0119] In addition, this application also provides an electronic device, including the control device 300 described in the above embodiments.
[0120] In addition, this application embodiment also provides a storage medium, which is a computer-readable storage medium, storing a computer program that, when executed by a processor, implements the above-described image exposure processing method.
[0121] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof. The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separate, and may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0122] It will be understood by those skilled in the art that all or some of the steps and systems in the methods disclosed above can be implemented as software, firmware, hardware, and suitable combinations thereof. Some or all of the physical components can be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software can be distributed on a computer-readable medium, which can include computer storage media (or non-transitory media) and communication media (or transient media). As is known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, as is known to those skilled in the art, communication media typically include computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.
[0123] The above provides a detailed description of the preferred embodiments of the present invention. However, the present invention is not limited to the above embodiments. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present invention. All such equivalent modifications or substitutions are included within the scope defined by the claims of the present invention.
Claims
1. An image exposure processing method, characterized in that, include: The target image acquired by the imaging sensor is divided into multiple image blocks, each of which has a weight value and a brightness value. A first average brightness value of the target image is calculated based on all of the brightness values, and the brightness standard deviation of the target image is calculated based on each of the brightness values and the first average brightness value. Based on the weight values, a first image block belonging to the region of interest and a second image block belonging to the region of non-interest are determined in the target image. A second average brightness value of the first image block is calculated, and a third average brightness value of the second image block is calculated. The difference between the second average brightness and the third average brightness is determined as the ROI difference value. Obtain a preset exposure tolerance value and ROI difference threshold, determine a first comparison relationship between the brightness standard deviation and the exposure tolerance value, determine a second comparison relationship between the ROI difference value and the ROI difference threshold, and determine the exposure detection result of the target image based on the first comparison relationship and the second comparison relationship; The target image is subjected to exposure processing based on the exposure detection results.
2. The image exposure processing method according to claim 1, characterized by, Determining a first image block belonging to the region of interest and a second image block belonging to the region of non-interest in the target image based on the weight values includes: All the image blocks are normalized to obtain multiple new image blocks, each of which corresponds to a new weight value, and each new weight value is obtained by normalizing the weight value. The new image block corresponding to the new weight value that is greater than 1 is determined as the first image block; The new image block corresponding to the new weight value that is less than or equal to 1 is determined as the second image block.
3. The image exposure processing method according to claim 1, characterized by, Determining the exposure detection result of the target image based on the first comparison relationship and the second comparison relationship includes: When the brightness standard deviation is greater than the exposure tolerance value, the ROI difference value is greater than the ROI difference threshold, and the first average brightness value is greater than the preset brightness threshold, the exposure detection result indicates that the target image is in an overexposed scene. When the brightness standard deviation is greater than the exposure tolerance value, and the negative number of the ROI difference value is greater than the ROI difference threshold, the exposure detection result indicates that the target image is in an underexposed scene.
4. The image exposure processing method according to claim 2, characterized by, Each of the new image blocks also corresponds to a brightness weight value. Based on the exposure detection results, exposure processing is performed on the target image, including: Summing all the brightness weight values yields the first weighted sum; Summing all the new weight values yields the second weight sum; An exposure resistance weight value is determined based on the exposure detection result, and the second weight sum is adjusted based on the brightness standard deviation and the exposure resistance weight value. The exposure resistance weight value is either an underexposure resistance weight value or an overexposure resistance weight value. When the exposure detection result indicates that the target image is in an underexposure scene, the exposure resistance weight value is determined as the underexposure resistance weight value. When the exposure detection result indicates that the target image is in an overexposure scene, the exposure resistance weight value is determined as the overexposure resistance weight value. Divide the first weighted sum by the adjusted second weighted sum to obtain the desired brightness value; The current exposure parameters of the imaging sensor are adjusted based on the desired brightness value.
5. The image exposure processing method according to claim 4, characterized by, Adjusting the second weighted sum based on the brightness standard deviation and the exposure resistance weight value includes: The second weight is adjusted based on the comparison between the brightness standard deviation and the preset standard deviation threshold; The second weight is adjusted based on the comparison between the anti-exposure weight value and the preset weight threshold.
6. The image exposure processing method according to claim 5, characterized by, Adjusting the second weighted sum based on the comparison between the brightness standard deviation and a preset standard deviation threshold includes: When the exposure detection result indicates that the target image is in an overexposed scene, and the brightness standard deviation is greater than the standard deviation threshold, the product of the second weight and the brightness standard deviation is calculated, and the product of the second weight and the brightness standard deviation is divided by the standard deviation threshold to obtain the adjusted second weight. When the exposure detection result indicates that the target image is in an underexposed scene, if the brightness standard deviation is greater than the standard deviation threshold, the second weight sum is limited to a third value range. The larger the value of the brightness standard deviation, the smaller the value of the second weight sum.
7. The image exposure processing method according to claim 5, wherein The second weight is adjusted based on the comparison between the anti-exposure weight value and the preset weight threshold, including: When the exposure detection result indicates that the target image is in an overexposed scene, if the anti-exposure weight value is less than the weight threshold, the second weight is limited to a first value range by interpolation. If the anti-exposure weight value is greater than or equal to the weight threshold, the second weight is limited to a second value range by interpolation. In this case, the larger boundary threshold in the first value range is less than or equal to the smaller boundary threshold in the second value range. When the exposure detection result indicates that the target image is in an underexposed scene, if the anti-exposure weight value is less than the weight threshold, the second weight sum is limited to the second value range by interpolation. If the anti-exposure weight value is greater than or equal to the weight threshold, the second weight sum is limited to the first value range by interpolation.
8. A control device characterized by comprising: It includes at least one control processor and a memory for communicatively connecting to the at least one control processor; the memory stores instructions executable by the at least one control processor, which, when executed by the at least one control processor, enable the at least one control processor to perform the image exposure processing method as described in any one of claims 1 to 7.
9. An electronic device, comprising: Includes the control device as described in claim 8.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions for causing a computer to perform the image exposure processing method as described in any one of claims 1 to 7.