An automatic exposure method based on FPGA space dynamic target adaptive weight
By using an FPGA-based adaptive weighting method to segment the image, calculate weights, and adjust the exposure time, the problem of poor performance of traditional exposure methods under dynamic targets is solved, achieving higher precision and speed exposure control.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- XIAN INST OF OPTICS & PRECISION MECHANICS CHINESE ACAD OF SCI
- Filing Date
- 2023-03-30
- Publication Date
- 2026-05-15
AI Technical Summary
Traditional exposure methods cannot lock the target in a high-weight area when dealing with dynamic targets, resulting in poor automatic exposure adjustment, and the step size setting affects the exposure parameters.
An FPGA-based adaptive weighting method is used to divide the image into multiple sub-regions. The target and background are segmented by the maximum inter-class variance method. The pixel weight of the target part is calculated and assigned a weight. The exposure time is adjusted according to the deviation between the average gray level and the preset expected gray level to achieve adaptive exposure adjustment.
It improves the accuracy and speed of exposure adjustment, ensuring that the average gray level of the image approaches the preset expected value, and adapts to the shooting environment of dynamic targets.
Smart Images

Figure CN116320767B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to image processing methods, specifically to an automatic exposure method based on FPGA spatial dynamic target adaptive weights. Background Technology
[0002] In the field of aviation, due to the complex lighting environment in space, insufficient lighting caused by meteorites and satellites blocking the light, and the fact that space targets are dynamic, it is difficult to keep the target in the same position in the frame during the shooting process. The space image acquisition process needs an exposure method that is highly adaptable to dynamic targets and changing environments to solve the problem of inaccurate exposure of the target area in the image.
[0003] With the rapid development of digital technology, more and more functions are being ported to ISP (Image Signal Processor) systems, such as automatic exposure, automatic white balance, image segmentation, and noise reduction. Automatic exposure is one of the most important factors affecting spatial image acquisition; appropriate exposure parameters are crucial for determining whether target details can be displayed. Automatic exposure adjustment is jointly controlled by three parameters: luminous flux, exposure time, and image gain. Luminous flux is determined by the camera lens aperture, the exposure time determines the photoelectric conversion time for one frame, and image gain controls the amplification factor of the electrical signal.
[0004] Traditional exposure methods associate pixel positions with grayscale values based on fixed-weight partitioning. A weight coefficient is assigned to the grayscale of each partitioned region to calculate the weighted grayscale mean of the image. The deviation between the weighted grayscale mean and the desired value is used to determine the fixed step size, thereby deriving a new exposure time. However, this exposure method cannot keep the target locked in a high-weight region when facing a dynamic target. When the target is not in the set weight region, automatic exposure adjustment cannot achieve a good exposure effect. In addition, the step size setting also affects the exposure parameters and its exposure effect. Summary of the Invention
[0005] The purpose of this invention is to address the shortcomings of traditional exposure methods in that they cannot keep the target locked in a high-weight region when facing dynamic targets, and the automatic exposure adjustment cannot achieve a good exposure effect when the target is not in the set weight region. Instead, this invention provides an automatic exposure method based on adaptive weights for dynamic targets in FPGA space.
[0006] To address the shortcomings of the existing technology, the present invention provides the following technical solution:
[0007] An automatic exposure method based on FPGA spatial dynamic target adaptive weights, characterized by the following steps:
[0008] Step 1: Power on the camera, and the automatic exposure method in the FPGA on the camera is automatically loaded and run; the automatic exposure method includes a grayscale statistics module and an exposure parameter control module;
[0009] Step 2: Divide the image to be processed into multiple sub-regions of equal size, and use the grayscale statistics module to divide the image to be processed into the target part and the background part;
[0010] Step 3: Calculate the proportion of the target pixels in each sub-region, and assign weights according to the proportions to calculate the average gray level of the image to be processed.
[0011] Step 4: Calculate the exposure adjustment amount based on the deviation δ between the average gray level obtained in Step 3 and the preset desired gray level to adjust the exposure time, so that the average gray level continuously approaches the preset desired gray level, and obtain the optimal exposure time. The exposure parameter control module automatically exposes the image to be processed.
[0012] Furthermore, in step 2, the grayscale statistics module uses the maximum inter-class variance method to divide the image to be processed into a target part and a background part. The specific process is as follows:
[0013] The image to be processed is divided into target and background parts based on a global threshold.
[0014] Calculate the optimal threshold to distinguish between target pixels and background pixels, maximizing the distinction between them.
[0015] Furthermore, step 3 specifically includes:
[0016] Step 3.1: Calculate the proportion Y of the target pixels in each sub-region according to the following formula;
[0017]
[0018] Where M×N is the total number of pixels in each sub-region. S represents the number of pixels in the target portion of the sub-region; 'a' is the 'a'-th pixel in the sub-region. When the 'a'-th pixel is a pixel in the target portion, S... a =1, otherwise S a =0;
[0019] Step 3.2: Sort each sub-region according to the proportion of pixels in the target area from largest to smallest, and assign different weights to each sub-region according to the ordinal number;
[0020] Step 3.3: Calculate the average gray level of the image to be processed based on the weights assigned to each sub-region.
[0021] Furthermore, in step 2, the image to be processed is divided into nine sub-regions of equal size.
[0022] Further, step 3.2 specifically involves: sorting each sub-region according to the proportion of the target part pixels from largest to smallest, assigning a weight of 60% to the first-ranked sub-region, assigning a weight of 25% to the second to fourth-ranked sub-regions, and assigning a weight of 15% to the fifth to ninth-ranked sub-regions.
[0023] Furthermore, step 4 specifically includes:
[0024] Step 4.1: Calculate the deviation δ between the average gray level obtained in Step 3 and the preset desired gray level according to the following formula:
[0025]
[0026] Among them, G (i,j) W represents the grayscale value of the sub-region with coordinates (i,j). (i,j) G represents the weight of the subregion with coordinates (i,j). ex To preset the desired grayscale;
[0027] Step 4.2: If |δ| < 10, then the exposure adjustment amount S of the current frame is... t Select 1, adjust the exposure time, and then proceed to step 4.3;
[0028] Otherwise, calculate the exposure adjustment S for the current frame according to the following formula. t After adjusting the exposure time, return to step 3.3;
[0029]
[0030] Where K is the highest grayscale value of the pixel in the image to be processed;
[0031] The larger the grayscale deviation δ, the larger the exposure adjustment. Fine-tuning is performed when the measured average grayscale gradually approaches the preset desired grayscale, ultimately achieving automatic exposure control of the camera. Compared with the fixed step size method, the adaptive exposure adjustment method requires fewer adjustments, and the fine-tuning in the final stage makes the adjustment of the exposure time more precise.
[0032] Step 4.3: Obtain the optimal exposure time and automatically expose the image to be processed through the exposure parameter control module.
[0033] Further, in step 4.1, the preset desired grayscale G ex It is 100.
[0034] Compared with the prior art, the beneficial effects of the present invention are:
[0035] (1) The present invention provides an automatic exposure method based on adaptive weights for dynamic targets in FPGA space. The method divides the image to be processed into multiple sub-regions of equal size and preprocesses to segment the target part and the background part. Then, adaptive weights are set according to the weight of the target part in each sub-region, and the average gray level of the image to be processed is calculated. Then, the exposure adjustment amount is calculated according to the deviation between the average gray level and the preset expected gray level to adjust the exposure time until the optimal image brightness is achieved. Finally, the image data is output. The present invention uses an adaptive weight method to process the average gray level of the image to be processed, which is more suitable for automatic exposure processing of images of dynamic targets than fixed partition weights.
[0036] (2) The present invention provides an automatic exposure method based on FPGA spatial dynamic target adaptive weights. The method of adaptive exposure adjustment is used to adjust the exposure time so that the average gray level continuously approaches the preset expected gray level, thereby optimizing both the adjustment accuracy and the adjustment speed. Attached Figure Description
[0037] Figure 1 This is a flowchart illustrating an embodiment of an automatic exposure method based on FPGA spatial dynamic target adaptive weights according to the present invention.
[0038] Figure 2 This is a schematic diagram of segmenting the image to be processed in step 2 of an embodiment of the present invention;
[0039] Figure 3 This is a flowchart of steps 3 and 4 in an embodiment of the present invention;
[0040] Figure 4 The figures show the adjustment time-average grayscale curves for automatic exposure testing of the same scene using the embodiments of the present invention and the fixed step size method, respectively. Detailed Implementation
[0041] The present invention will be further described below with reference to the accompanying drawings and exemplary embodiments.
[0042] Reference Figure 1 An automatic exposure method based on FPGA spatial dynamic target adaptive weights includes the following steps:
[0043] Step 1: Power on the camera, and the automatic exposure method in the FPGA on the camera is automatically loaded and run; the automatic exposure method includes a grayscale statistics module and an exposure parameter control module;
[0044] Step 2, as follows Figure 2As shown, the image to be processed is divided into nine sub-regions of equal size, and the image to be processed is divided into target part and background part by the maximum inter-class variance method through the gray-level statistics module; in other embodiments, one of the following methods can also be used: histogram segmentation method, image segmentation method combining K-Means and SVM, and two-dimensional Otsu image segmentation method;
[0045] Step 2.1: Divide the image to be processed into target and background parts based on the global threshold;
[0046] Step 2.2: Calculate the optimal threshold to distinguish between the target pixels and the background pixels, so that the distinction between the target pixels and the background pixels is maximized;
[0047] Step 3, as follows Figure 3 As shown, the proportion of the target pixels in each sub-region is calculated, and the weights are assigned according to the proportions to calculate the average gray level of the image to be processed.
[0048] Step 3.1: Calculate the proportion Y of the target pixels in each sub-region according to the following formula;
[0049]
[0050] Where M×N is the total number of pixels in each sub-region. S represents the number of pixels in the target portion of the sub-region; 'a' is the 'a'-th pixel in the sub-region. When the 'a'-th pixel is a pixel in the target portion, S... a =1, otherwise S a =0;
[0051] Step 3.2: Sort each sub-region according to the proportion of the target part pixels from largest to smallest, assign 60% weight to the first (R1) sub-region, 25% weight to the second (R2) to fourth (R4) sub-regions, and 15% weight to the fifth (R5) to ninth (R9) sub-regions.
[0052] Step 3.3: Calculate the average gray level of the image to be processed based on the weights assigned to each sub-region, specifically as follows:
[0053] The row counter is `line_cnt`, and the column counter is `col_cnt`. Taking a 1920×1080 resolution image as an example, if `line_cnt>=0&&line_cnt<=359&&col_cnt>=0&&col_cnt<=639`, then all gray values in the `block00` sub-region are summed. If `line_cnt>=0&&line_cnt<=359&&col_cnt>=640&&col_cnt<=1279`, then all gray values in the `block01` sub-region are summed, and so on, to calculate the gray value of each sub-region. The gray values of the nine sub-regions are multiplied by their respective weights and then summed to obtain the gray value of the image to be processed. The average gray value is calculated using division with the IP core.
[0054] Step 4: Calculate the exposure adjustment amount based on the deviation δ between the average gray level obtained in Step 3 and the preset desired gray level to adjust the exposure time, so that the average gray level continuously approaches the preset desired gray level, and obtain the optimal exposure time. The exposure parameter control module automatically exposes the image to be processed.
[0055] Step 4.1: Calculate the deviation δ between the average gray level obtained in Step 3 and the preset desired gray level according to the following formula:
[0056]
[0057] Among them, G (i,j) W represents the grayscale value of the sub-region with coordinates (i,j). (i,j) G represents the weight of the subregion with coordinates (i,j). ex To preset the desired grayscale, set it to 100;
[0058] Step 4.2: If |δ| < 10, then the exposure adjustment amount S of the current frame is... t Select 1, adjust the exposure time, and then proceed to step 4.3;
[0059] Otherwise, calculate the exposure adjustment S for the current frame according to the following formula. t After adjusting the exposure time, return to step 3.3;
[0060]
[0061] Where K is the highest grayscale value of the pixel in the image to be processed;
[0062] Step 4.3: Determine the optimal exposure time and automatically expose the image to be processed through the exposure parameter control module.
[0063] Reference Figure 4 Automatic exposure tests were conducted on the same scene using both the fixed step size method and the method of this invention. Figure 4 It is known that the average gray level of the fixed step size method approaches the desired gray level, while the method of this invention can adjust the average gray level to the desired gray level. Both methods achieve the same average gray level value, but the method of this invention takes less time than the fixed step size method. Therefore, the method of this invention improves both the accuracy and computation speed of the algorithm compared to the fixed step size method.
[0064] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit them. For those skilled in the art, modifications can be made to the specific technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. However, these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions protected by the present invention.
Claims
1. An automatic exposure method based on FPGA spatial dynamic target adaptive weights, characterized in that, Includes the following steps: Step 1: Power on the camera, and the automatic exposure method in the FPGA on the camera is automatically loaded and run; the automatic exposure method includes a grayscale statistics module and an exposure parameter control module; Step 2: Divide the image to be processed into multiple sub-regions of equal size, and use the grayscale statistics module to divide the image to be processed into the target part and the background part; Step 3: Calculate the proportion of the target pixels in each sub-region, and assign weights according to the proportions to calculate the average gray level of the image to be processed. Step 3.1: Calculate the proportion of the target pixels in each sub-region according to the following formula. ; ; in, The total number of pixels for each sub-region denoted as , where is the number of pixels in the target portion of the sub-region; 'a' is the th pixel in the sub-region. The pixel, when the first pixel When each pixel is a pixel in the target region ,otherwise ; Step 3.2: Sort each sub-region according to the proportion of the target part pixels from largest to smallest, assign 60% weight to the first sub-region, 25% weight to the second to fourth sub-regions, and 15% weight to the fifth to ninth sub-regions. Step 3.3: Calculate the average gray level of the image to be processed based on the weights assigned to each sub-region; Step 4: Based on the deviation between the average gray level obtained in Step 3 and the preset desired gray level. The exposure adjustment amount is calculated to adjust the exposure time so that the average gray level continuously approaches the preset desired gray level, and the optimal exposure time is obtained. The exposure parameter control module automatically exposes the image to be processed. Step 4.1: Calculate the deviation between the average gray level obtained in Step 3 and the preset desired gray level according to the following formula. : ; in, Coordinates are The grayscale value of the sub-region, Coordinates are The corresponding weights of the sub-regions, To preset the desired grayscale; Step 4.2, if The exposure adjustment amount for the current frame. Select 1, adjust the exposure time, and then proceed to step 4.3; Otherwise, calculate the exposure adjustment for the current frame using the following formula. After adjusting the exposure time, return to step 3.3; ; in, The highest grayscale value of the pixel in the image to be processed; Step 4.3: Obtain the optimal exposure time and automatically expose the image to be processed through the exposure parameter control module.
2. The automatic exposure method based on FPGA spatial dynamic target adaptive weights according to claim 1, characterized in that: In step 2, the grayscale statistics module uses the maximum inter-class variance method to divide the image to be processed into a target part and a background part. The specific process is as follows: The image to be processed is divided into target and background parts based on a global threshold. Calculate the optimal threshold to distinguish between target pixels and background pixels, maximizing the distinction between them.
3. The automatic exposure method based on FPGA spatial dynamic target adaptive weights according to claim 2, characterized in that: In step 2, the image to be processed is divided into nine sub-regions of equal size.
4. The automatic exposure method based on FPGA spatial dynamic target adaptive weights according to claim 3, characterized in that: In step 4.1, the preset desired grayscale It is 100.