Exposure time determination method, apparatus and device
By modeling the grayscale distribution characteristics within the target area of the checkerboard image, determining the image contrast, and combining this with the exposure time relationship, the image quality problem caused by improper exposure settings in checkerboard images was solved. This enabled rapid and stable determination of exposure time, improving calibration accuracy and efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING XIAOYU INTELLISYS CO LTD
- Filing Date
- 2026-01-06
- Publication Date
- 2026-04-21
AI Technical Summary
In computer vision tasks such as industrial automation, 3D measurement, and camera calibration, improper exposure settings for checkerboard images can lead to inconsistent image quality, resulting in problems such as corner recognition failure, insufficient brightness and contrast, and overexposure or underexposure, which affect calibration accuracy and efficiency.
By modeling the gray-level distribution characteristics within the target area of the calibrated image, the image contrast is determined. Combined with the relationship between exposure time and contrast, the optimal exposure time is determined quickly and stably. Gray-level histogram statistics, Gaussian filtering, and mean shift algorithms are used to extract the range of the gray-level main peak and predict the target exposure time.
It achieves stable exposure time determination under different lighting conditions and camera models, improves image acquisition quality and calibration accuracy, reduces the time cost of exposure parameter adjustment, and enhances the robustness and adaptability of image acquisition equipment.
Smart Images

Figure CN121462888B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a method, apparatus, and device for determining exposure time. Background Technology
[0002] In computer vision tasks such as industrial automation, 3D measurement, and camera calibration, checkerboard images are widely used in camera calibration and hand-eye calibration processes due to their regular geometric structure and stable features. These processes have extremely high requirements for image quality, especially relying on clearly identifiable checkerboard corners.
[0003] However, in actual calibration, due to differences in the angle of light reflection when acquiring calibration images from different angles, even with the same exposure, the image quality acquired from each angle will be inconsistent. If the exposure settings are inappropriate, problems such as failure to recognize checkerboard corner points, insufficient brightness contrast of black and white squares, overexposure or underexposure of the image, leading to large calibration errors or even failure can easily occur. Therefore, how to quickly and stably determine the optimal exposure time suitable for the current scene becomes the key to improving calibration efficiency and accuracy. Summary of the Invention
[0004] The present invention aims to at least partially solve one of the technical problems in the related art.
[0005] Therefore, the first objective of this invention is to propose an exposure time determination method, which determines the image contrast by modeling the gray-scale distribution characteristics of the target area of the calibration image, and determines the target exposure time by combining the relationship between exposure time and contrast, thereby quickly and stably determining the optimal exposure time suitable for the current scene, and thus obtaining a clear target calibration image with good contrast.
[0006] The second objective of this invention is to provide an exposure time determination device.
[0007] The third objective of this invention is to provide an electronic device.
[0008] The fourth objective of this invention is to provide a computer-readable storage medium.
[0009] The fifth objective of this invention is to provide a computer program product.
[0010] To achieve the above objectives, a first aspect of the present invention provides a method for determining exposure time, comprising:
[0011] Acquire a calibration image based on the initial exposure time value;
[0012] Histogram statistics are performed on the gray values of pixels located within the target region in the calibration image to obtain the gray-level histogram of the target region;
[0013] Based on the grayscale histogram, determine the current image contrast of the target region;
[0014] The target exposure time is determined based on the relationship between the initial exposure time and the current image contrast, as well as the set target image contrast.
[0015] To achieve the above objectives, a second aspect of the present invention provides an exposure time determination device, comprising:
[0016] The acquisition module is used to acquire calibration images based on the initial exposure time value;
[0017] The first processing module is used to perform histogram statistics on the gray values of pixels located in the target region in the calibration image to obtain the gray value histogram of the target region;
[0018] The first determining module is used to determine the current image contrast of the target region based on the grayscale histogram;
[0019] The second determining module is used to determine the target exposure time based on the relationship between the initial exposure time value and the current image contrast, as well as the set target image contrast.
[0020] To achieve the above objectives, a third aspect of the present invention provides an electronic device comprising:
[0021] At least one processor; and
[0022] A memory communicatively connected to the at least one processor; wherein,
[0023] The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method described in the first aspect.
[0024] To achieve the above objectives, a fourth aspect of the present invention provides a computer-readable storage medium storing computer instructions, wherein the computer instructions are configured to cause the computer to perform the method described in the first aspect.
[0025] To achieve the above objectives, a fifth aspect of the present invention provides a computer program product comprising a computer program that, when executed by a processor, implements the method described in the first aspect.
[0026] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description
[0027] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein:
[0028] Figure 1 This is a flowchart illustrating a method for determining exposure time provided in an embodiment of the present invention.
[0029] Figure 2 This is a flowchart illustrating another method for determining exposure time provided in an embodiment of the present invention;
[0030] Figure 3 This is a schematic diagram of an exposure time determination device provided in an embodiment of the present invention;
[0031] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0032] Embodiments of the present invention are described in detail below, examples of which are illustrated in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain the present invention, and should not be construed as limiting the present invention.
[0033] In related technologies, the following method is used to determine the exposure time:
[0034] 1. An AE (Auto-Encoder) method based on image statistical feedback
[0035] This method uses the image's average grayscale, weighted region brightness, or histogram information to continuously adjust the exposure time to within the error range by comparing it with a preset target brightness value. For example, the automatic exposure control built into an industrial camera SDK (Software Development Kit) is typically controlled by a "brightness target value" parameter.
[0036] This method can only converge gradually through trial and error, cannot directly predict the target exposure value, has a long response time, and is only applicable to scenes with relatively uniform backgrounds.
[0037] 2. Adaptive control methods based on control theory (such as PID (Proportional-Integral-Derivative) control)
[0038] This method takes image grayscale error as input and uses a proportional-integral-derivative (PID) controller to dynamically adjust exposure parameters, thereby stabilizing image brightness. Some vision systems or embedded platforms integrate such controllers to achieve brightness stability.
[0039] This method is sensitive to initial values, has complex parameter tuning, is not suitable for dynamic or new scenarios, and is difficult to obtain target exposure with one click.
[0040] 3. Prediction methods based on image features or deep learning
[0041] This method uses deep learning models (such as CNN (Convolutional Neural Network) and SVR (Support Vector Regression)) to model the brightness or feature distribution of images and predict appropriate exposure times. For example, a non-linear mapping between exposure time and image features can be established using a training set.
[0042] This method relies on a large amount of training data, has a complex model, is not conducive to deployment in embedded systems, and lacks targeted optimization for chessboard images.
[0043] Although the above methods have solved the image brightness control problem to some extent, the following prominent problems still exist in high-precision vision tasks targeting checkerboard images:
[0044] (1) Insufficient predictive ability, relying on multiple rounds of trial and error
[0045] All feedback-based exposure control methods (such as brightness mean adjustment) are a posteriori adjustment mechanisms and cannot directly predict the target exposure time.
[0046] After Effects (AE) requires multiple image acquisitions and iterative judgments, which is inefficient and has a large latency. Furthermore, AE is not suitable for scenarios that require rapid batch acquisition of checkerboard images (such as pipeline calibration).
[0047] (2) Lack of modeling of the characteristics of checkerboard images
[0048] The grayscale distribution of checkerboard images differs from other images, with clear light and dark zones. After Effects only considers the average brightness of the entire image and does not take into account the grayscale contrast of black and white squares or the sharpness of corner points. Therefore, even when the overall brightness is "appropriate", the corner points may still be blurry.
[0049] (3) Unable to adapt to diverse ambient light conditions
[0050] In situations with high reflectivity, complex backgrounds, and uneven lighting, AE control is prone to failure, requiring parameter readjustment and lacking cross-scene adaptability and consistency.
[0051] (4) The control granularity is coarse and lacks mathematical modeling support.
[0052] Instead of establishing a quantitative functional relationship between grayscale value and exposure time, the exposure time selection relies on human experience, resulting in low accuracy and a lack of interpretability.
[0053] To address the aforementioned problems, this invention proposes a method, apparatus, and device for determining exposure time. By modeling the grayscale distribution characteristics within the target area of the calibration image, the image contrast is determined, and the target exposure time is determined by combining the relationship between exposure time and contrast. This allows for the rapid and stable determination of the optimal exposure time suitable for the current scene, thereby obtaining a clear target calibration image with good contrast.
[0054] The method, apparatus, and device for determining exposure time according to embodiments of the present invention are described below with reference to the accompanying drawings.
[0055] Figure 1 This is a schematic diagram of a process for determining exposure time according to an embodiment of the present invention.
[0056] like Figure 1 As shown, determining the exposure time includes the following steps:
[0057] Step 101: Obtain the calibration image based on the initial exposure time value.
[0058] In this embodiment, in order to quickly and stably determine the optimal exposure time suitable for the current scene, it is necessary to predetermine a reasonable initial exposure time value and obtain a calibration image based on the initial exposure time value.
[0059] The initial exposure time is a base exposure time that is quickly determined in advance under the current environmental conditions through a limited number of image acquisitions.
[0060] As one possible implementation, the process of determining the initial exposure time includes: acquiring a checkerboard image based on a set reference exposure time; determining the reference exposure time as the initial exposure time in response to the detection of a checkerboard region in the checkerboard image; and updating the reference exposure time until a checkerboard region is detected in a reference image acquired based on the updated reference exposure time, and then determining the updated reference exposure time as the initial exposure time.
[0061] In order to balance the robustness and efficiency of detection in real-world scenarios with complex lighting and diverse camera models, and to ensure the rapid and stable locking of the initial value of usable exposure time, the detected checkerboard area in the checkerboard image is allowed to have some missing checkerboard corners (as long as some corners can be detected, it means that the key area (checkerboard) of the image under the current exposure has basic sharpness, which is sufficient to serve as a benchmark for subsequent exposure adjustment). Alternatively, the detected checkerboard area in the checkerboard image can be a partial area (if a partial area can be detected, it means that the area where the checkerboard is located in the image under the current exposure has basic sharpness and contrast, which is sufficient to serve as a benchmark for subsequent exposure adjustment).
[0062] As an example, considering the significant differences in camera models and ambient lighting conditions (different camera models have different light sensitivity, and the same camera requires different exposure times in strong light and low light environments (for example, a short exposure is sufficient in strong light, while a long exposure is needed to see objects clearly in low light), the image acquisition process using the first calibration pose and the initial exposure settings can be as follows:
[0063] The initial exposure time was set to 50 ms, and a checkerboard image was acquired (a checkerboard image is a standard pattern image composed of alternating black and white squares, which is a commonly used reference in machine vision, camera calibration, image processing and other fields).
[0064] If the checkerboard area is not detected in the checkerboard image (partial corner missing is allowed), the exposure time will be increased by a factor of two (e.g., doubled, changed to 100 ms, 200 ms, etc.), and the checkerboard image will be re-acquired and detected.
[0065] Once a checkerboard region (which may be a partial region) is detected in the acquired checkerboard image at a certain exposure time (which may be 50 ms, or an adjusted 100 ms, 200 ms, etc.), the exposure time at this time is recorded as the initial exposure time value and reused in all subsequent image acquisitions for calibration poses.
[0066] Therefore, by acquiring images a limited number of times, the basic exposure time suitable for the current environmental conditions can be quickly determined, avoiding a large number of trial and error attempts and improving initialization efficiency.
[0067] Step 102: Perform histogram statistics on the gray values of pixels located in the target region in the calibration image to obtain the gray-level histogram of the target region.
[0068] The target region can be a Region of Interest (ROI) in the calibration image used for exposure prediction. For example, if the calibration image is a checkerboard image, the target region can be an ROI in the checkerboard image that contains the checkerboard region.
[0069] As one possible implementation, the image is labeled as a checkerboard image; the process of determining the target region includes: detecting the checkerboard corner points in the checkerboard image; and determining the target region based on the detected checkerboard corner points.
[0070] The process of detecting checkerboard corners in a checkerboard image can be, for example, by performing a corner detection algorithm on the checkerboard image to detect the checkerboard corners. Checkerboard corners are the vertices where black and white squares intersect (e.g., the intersections of the four corners of each black square). These points are easily identified by the algorithm due to their significant contrast changes.
[0071] The process of determining the target region based on the detected chessboard corner points can be, for example, by determining the candidate region surrounding the detected chessboard corner points based on their positions; and by expanding the candidate region or the boundary by a set distance to determine the target region.
[0072] The candidate region can be a regular region, such as a quadrilateral, or an irregular region, which will not be elaborated here.
[0073] As an example, a corner detection algorithm is performed on a checkerboard image acquired based on the initial exposure time. After detecting checkerboard corners, the circumscribed quadrilateral region is calculated and expanded by a certain margin. This region in the image is then used as the ROI (i.e., the target region) for exposure prediction. Specifically, for a checkerboard image acquired based on the initial exposure time, a corner detection algorithm is performed. Once enough checkerboard corners are detected, the smallest quadrilateral (usually a rectangle or parallelogram, as the checkerboard is a planar pattern and the shooting angle may cause it to appear as a quadrilateral rather than a regular rectangle in the image) that can enclose all (or the main) checkerboard corners is found. This smallest quadrilateral represents the approximate outline of the checkerboard in the image. Then, to avoid missing details of the checkerboard edges or edge loss due to detection errors, the boundary of this smallest quadrilateral is expanded outward by a certain "margin" (e.g., each side is expanded outward by 5-10 pixels), and this expanded region is then used as the target region.
[0074] In a grayscale image, the brightness of each pixel is represented by a grayscale value, which is usually in the range of 0-255 (0 represents pure black, 255 represents pure white, and the intermediate values are different shades of gray).
[0075] Among them, the grayscale histogram is a visual statistical tool. In the grayscale histogram of the target area, the horizontal axis is the "grayscale level" and the vertical axis is the "number of pixels of that grayscale level in the target area", which is used to intuitively show the distribution pattern of grayscale values in the target area (such as being too dark, too bright, or concentrated in a certain brightness range).
[0076] This involves dividing grayscale values into several "intervals," each interval being called a "grayscale level." For example, by default, 0-255 is divided into 256 levels (each grayscale value corresponds to 1 level), but it can also be customized to 32 levels (every 8 grayscale values are combined into 1 level).
[0077] In this embodiment, the process of performing histogram statistics on the gray values of pixels located in the target area in the calibration image to obtain the gray-level histogram of the target area can be, for example, by traversing all pixels located in the target area in the calibration image and recording the gray value of each pixel; according to the set gray level, counting the number of pixels at each gray level to generate the gray-level histogram of the target area.
[0078] As an example, iterate through all pixels within the target region of the calibration image and record the grayscale value of each pixel. For instance, if there are 1000 pixels within the target region of the calibration image, record their grayscale values as 50, 120, 80, ..., 200, etc. Then, generate a histogram based on the set grayscale levels.
[0079] 1. Set the number of gray levels
[0080] Determine how many levels to divide the grayscale value into based on the requirements (e.g., 256 levels, 32 levels, 16 levels, etc.).
[0081] For example, if 32 levels are set, then every 8 grayscale values are merged into 1 level (0-7 is level 1, 8-15 is level 2, ..., 248-255 is level 32).
[0082] 2. Count the number of pixels at each gray level.
[0083] Calculate which gray level each pixel in the target region of the calibrated image belongs to, and count the total number of pixels at each level.
[0084] For example: There are 1000 pixels in the target area of the calibration image, of which there are 50 pixels in level 1 (0-7), 80 pixels in level 2 (8-15), ..., and 30 pixels in level 32.
[0085] 3. Generate grayscale histogram
[0086] Plot a grayscale histogram with "grayscale level" on the horizontal axis and "corresponding number of pixels" on the vertical axis (to visually show which grayscale levels have more pixels and which grayscale levels have fewer pixels).
[0087] In this embodiment, histogram statistics are performed only on the grayscale values of pixels located within the target region in the calibration image. By focusing on the target region in the calibration image for grayscale analysis, invalid background information is eliminated, enhancing the stability and accuracy of contrast features. By generating a grayscale histogram of the target region, the grayscale distribution within the target region of the calibration image can be quantified, providing basic data support for subsequent processing.
[0088] Step 103: Determine the current image contrast of the target region based on the grayscale histogram.
[0089] In this embodiment, the process of determining the current image contrast of the target region based on the gray-level histogram can be, for example, as follows: determining at least one gray-level peak range based on the gray-level histogram; wherein, any gray-level peak range is composed of gray-level ranges containing the corresponding gray-level maxima; determining a target gray-level peak range from at least one gray-level peak range based on the number of pixels corresponding to the at least one gray-level peak range; and determining the current image contrast based on the gray-level values corresponding to the gray-level maxima in the target gray-level peak range.
[0090] In order to eliminate the influence of dimensions, the gray-level histogram can be normalized before determining at least one gray-level main peak range based on the gray-level histogram. And / or, in order to reduce the local fluctuations of the gray-level histogram, highlight the distribution of the gray-level main peak, and facilitate the identification of the gray-level main peak range, Gaussian filtering can be used to smooth the gray-level histogram before determining at least one gray-level main peak range based on the gray-level histogram.
[0091] Normalization is the process of converting the "number of pixels" in a grayscale histogram into "relative frequency". For example, the process can be to divide the number of pixels at each grayscale level by the total number of pixels in the target region of the calibrated image, so that the sum of the frequencies of all grayscale levels is 1 (i.e., 100%).
[0092] For example: if the total number of pixels in the target area of the calibrated image is 1000, and there are 50 pixels in level 1, then the normalized frequency of this level is 50 / 1000=0.05 (5%); there are 80 pixels in level 2, then the normalized frequency of this level is 80 / 1000=0.08 (8%), and so on, with the frequencies of all levels added together to be 1.
[0093] Gaussian filtering is a weighted smoothing method based on the Gaussian function. By utilizing the "local weighted averaging" property of the Gaussian function, it eliminates fluctuations in the gray-level histogram caused by local noise while preserving the overall gray-level distribution trend. Gaussian filtering can eliminate local noise by using a neighborhood weighted summation method. For example, the process can be to take the value of each gray level in the gray-level histogram and perform a weighted summation based on the values of its neighboring gray levels, with the weights following a Gaussian distribution (higher in the middle and lower on both sides).
[0094] For example: if a certain gray level is i, its neighborhood is i If 1, i, i+1, then the smoothed value is
[0095] ,
[0096] Where w is the Gaussian weight (satisfying...) (and the weights sum to 1).
[0097] This preserves the main information of the current gray level while "averaging" local fluctuations through neighborhood weighting, thereby suppressing noise.
[0098] The setting of the neighborhood range involved in the weighting (such as 3 gray levels, 5 gray levels, etc.) is related to the number of gray levels. For example, if there are few gray levels (such as 8 levels), the template length should not be too large (such as 3), otherwise it will be over-smoothed and cause loss of details; if there are many gray levels (such as 256 levels), the template length can be appropriately increased (such as 5, 7) to better suppress noise while preserving the distribution trend.
[0099] While the normalized grayscale histogram can reflect the grayscale distribution, it may exhibit "spiking" (historical fluctuations caused by local grayscale value jumps) due to local image noise (such as sensor noise and minor perturbations), affecting subsequent analysis. In order to eliminate the interference caused by these local noises and make the grayscale histogram more closely match the real grayscale distribution trend, the normalized grayscale histogram can be smoothed.
[0100] The process of determining at least one gray-level main peak range based on the gray-level histogram can be, for example, by using the Mean Shift algorithm to determine at least one gray-level main peak range based on the gray-level histogram.
[0101] Mean shift is a density-based clustering / modality (local maximum) detection algorithm that iteratively calculates the "drift direction" of data points in the density distribution and eventually converges to the point with the maximum local density (i.e., the modality).
[0102] In a grayscale histogram scenario (which can be viewed as a one-dimensional density distribution), the mean shift algorithm performs the following operation on each grayscale level:
[0103] A local window is defined centered on the current gray level (based on a kernel function, such as a Gaussian kernel, with the weight decreasing as the distance from the center decreases).
[0104] Calculate the "mean offset vector" of all gray levels within the window (i.e., the difference between the weighted average of the gray levels within the window and the center).
[0105] Move the center of the window along the vector and repeat the above process until the center of the window no longer changes (convergence).
[0106] The converged center is a "local maximum point" (i.e., the grayscale peak).
[0107] The convergence of all non-repeating centers represents the most concentrated gray values in the image. For example, in an image containing a "dark background" and a "bright object," the smoothed histogram may have two main peaks, corresponding to the core gray values of the background and the object, respectively.
[0108] All gray levels that converge to the same main peak together constitute a gray-level main peak range. For example, the main peak range of a dark background may cover gray levels [0, 50], while the main peak range of a bright object may cover gray levels [150, 255].
[0109] The process of determining the target grayscale peak range from at least one grayscale peak range based on the number of pixels corresponding to at least one grayscale peak range can be, for example, by determining a set number of grayscale peak ranges with the largest number of corresponding pixels in at least one grayscale peak range as the target grayscale peak range.
[0110] The process of determining the target grayscale peak range as the set number of grayscale peak ranges with the largest number of corresponding pixels in at least one grayscale peak range can be, for example, by sorting at least one grayscale peak range according to the number of pixels corresponding to at least one grayscale peak range; and determining the set number of grayscale peak ranges that are first or last in the sorted at least one grayscale peak range as the target grayscale peak range.
[0111] As an example, if the at least one grayscale peak range is sorted in descending order by the number of pixels corresponding to that at least one grayscale peak range, then the first set number of grayscale peak ranges in the sorted at least one grayscale peak range can be determined as the target grayscale peak range. Alternatively, if the at least one grayscale peak range is sorted in ascending order by the number of pixels corresponding to that at least one grayscale peak range, then the last set number of grayscale peak ranges in the sorted at least one grayscale peak range can be determined as the target grayscale peak range.
[0112] There are two target grayscale peak ranges. The process of determining the current image contrast based on the grayscale value corresponding to the maximum grayscale value in the target grayscale peak range can be, for example, by determining the difference between the grayscale values corresponding to the maximum grayscale values in the two target grayscale peak ranges as the current image contrast.
[0113] Step 104: Determine the target exposure time based on the relationship between the initial exposure time and the current image contrast, as well as the set target image contrast.
[0114] In this embodiment, the process of determining the target exposure time based on the relationship between the initial exposure time value and the current image contrast, as well as the set target image contrast, can be, for example, by determining the ratio between the initial exposure time value and the current image contrast; and then determining the target exposure time by multiplying the ratio by the target image contrast.
[0115] As an example, if the target image contrast is set to standard_contrast, the initial exposure time (i.e., the current exposure time) is current_exposure, and the current image contrast is current_contrast, then the formula for calculating the predicted target exposure time target_exposure is:
[0116] target_exposure = current_exposure * standard_contrast / current_contrast
[0117] Therefore, by using a linear approximation relationship between image contrast and exposure time, the optimal exposure time for the current pose can be predicted, thus avoiding the iterative debugging process.
[0118] It should be noted that in this embodiment, the determined target exposure time can be applied to the exposure settings in the image acquisition device to re-acquire the calibration image under the current pose. The re-acquired calibration image is used for the calibration of the image acquisition device.
[0119] By re-acquiring the calibration image under the current pose based on the determined target exposure time, the image contrast of the re-acquired calibration image can be ensured to meet the calibration requirements, thereby improving the image acquisition quality and enhancing calibration efficiency and accuracy.
[0120] The exposure time determination method of this invention involves acquiring a calibration image based on an initial exposure time value; performing histogram statistics on the grayscale values of pixels located within the target region in the calibration image to obtain a grayscale histogram of the target region; determining the current image contrast of the target region based on the grayscale histogram; and determining the target exposure time based on the relationship between the initial exposure time value and the current image contrast, as well as the set target image contrast. Therefore, by modeling the grayscale distribution characteristics within the target region of the calibration image to determine the image contrast, and combining the relationship between exposure time and contrast to determine the target exposure time, this method effectively avoids the problems of large brightness fluctuations and uncontrollable contrast in the exposure time determination process of related technologies. It can quickly and stably determine the optimal exposure time suitable for the current scene, thereby obtaining a clear target calibration image with good contrast.
[0121] To clearly illustrate the above embodiments, examples are given below.
[0122] Figure 2 This is a schematic flowchart illustrating another method for determining exposure time provided in an embodiment of the present invention. In this embodiment, the calibration image is a checkerboard image.
[0123] like Figure 2 As shown, determining the exposure time includes the following steps:
[0124] Step 201: Calculate the initial exposure time.
[0125] To quickly and reliably determine the optimal exposure time for the current scene, a reasonable initial exposure time value needs to be predetermined. Considering the significant differences between camera models and ambient lighting conditions, the following procedure can be used to acquire images using the first calibration pose and set the initial exposure:
[0126] The exposure time was initially set to 50 ms, and a checkerboard image was acquired.
[0127] If the checkerboard area is not detected in the checkerboard image (partial corner missing is allowed), the exposure time will be increased by a factor of two (e.g., doubled, changed to 100 ms, 200 ms, etc.), and the checkerboard image will be re-acquired and detected.
[0128] Once a checkerboard region (which may be a partial region) is detected in the acquired checkerboard image at a certain exposure time (which may be 50 ms, or an adjusted 100 ms, 200 ms, etc.), the exposure time at this time is recorded as the initial exposure time value and reused in all subsequent image acquisitions for calibration poses.
[0129] Therefore, by acquiring images a limited number of times, the basic exposure time suitable for the current environmental conditions can be quickly determined, avoiding a large number of trial and error attempts and improving initialization efficiency.
[0130] Step 202: Determine the target region in the checkerboard image acquired based on the initial exposure time value.
[0131] Based on the checkerboard image acquired with the initial exposure time, a corner detection algorithm is executed. After detecting a checkerboard corner, its circumscribed quadrilateral region is calculated and expanded by a certain boundary margin. This region in the image is then used as the ROI (i.e., the target region) for exposure prediction.
[0132] Therefore, focusing on the area where the checkerboard pattern is located for grayscale analysis and eliminating invalid background information can enhance the stability and accuracy of contrast features.
[0133] Step 203: Perform histogram statistics on the grayscale values of pixels located within the target area in the checkerboard image.
[0134] Histogram statistics are performed on the gray values of pixels located within the target area in the checkerboard image. Based on the set number of gray levels, the gray distribution histogram of the target area is obtained and normalized.
[0135] This allows for the quantification of grayscale distribution within an image region, providing fundamental data support for subsequent processing.
[0136] Step 204: Use Gaussian filtering to smooth the grayscale histogram.
[0137] Although the normalized grayscale histogram can reflect the grayscale distribution, it may produce "spiking" (historical fluctuations caused by local grayscale value jumps) due to local image noise (such as sensor noise and small perturbations), which will affect subsequent analysis. In order to eliminate the interference caused by these local noises and make the grayscale histogram more closely match the real grayscale distribution trend, Gaussian filtering can be used to smooth the normalized histogram.
[0138] The details regarding the smoothing of the normalized histogram using Gaussian filtering are provided in the above embodiments and will not be repeated here.
[0139] Therefore, by using Gaussian filtering to smooth the normalized histogram, the local fluctuations of the gray-level histogram can be reduced, the distribution of the main gray-level peak can be highlighted, and the range of the main gray-level peak can be easily identified.
[0140] Step 205: Using the mean shift algorithm, determine at least one gray-level main peak range based on the gray-level histogram.
[0141] The mean shift algorithm is applied to the smoothed histogram to extract all gray-level peaks (i.e., gray-level maxima) and their range of influence. A gray-level peak and its range of influence constitute a gray-level peak range.
[0142] Therefore, the range of the main grayscale peaks representing the black and white checkerboard pattern in the grayscale distribution can be accurately captured, providing a reference for subsequent contrast calculations.
[0143] Step 206: Determine the number of pixels corresponding to at least one grayscale main peak range, and sort the at least one grayscale main peak range in descending order.
[0144] Iterate through all grayscale peaks, count the number of pixels within their respective regions, and obtain the number of pixels corresponding to each grayscale peak range. Sort all grayscale peak ranges in descending order based on the number of pixels.
[0145] Step 207: Determine the top two grayscale peak ranges from the sorted at least one grayscale peak range, and determine the difference between the grayscale values corresponding to the grayscale maxima in the top two grayscale peak ranges as the current image contrast.
[0146] Take the two grayscale peak ranges with the most pixels, and calculate the grayscale value corresponding to their grayscale maxima. The difference between the grayscale values corresponding to the grayscale maxima in these two grayscale peak ranges is taken as the current image contrast (current_contrast).
[0147] Therefore, by identifying the two most prominent main grayscale regions (usually black and white squares) in a checkerboard image, the sharpness of the checkerboard image can be characterized by quantized image contrast.
[0148] Step 208: Determine the target exposure time based on the relationship between the initial exposure time and the current image contrast, as well as the set target image contrast.
[0149] If the target image contrast is set to standard_contrast, the initial exposure time (i.e., the current exposure time) is current_exposure, and the current image contrast is current_contrast, then the formula for calculating the predicted target exposure time target_exposure is:
[0150] target_exposure = current_exposure * standard_contrast / current_contrast
[0151] Therefore, by using a linear approximation relationship between image contrast and exposure time, the optimal exposure time for the current pose can be predicted, thus avoiding the iterative debugging process.
[0152] In this embodiment, the predicted target exposure time target_exposure can also be applied to the camera exposure settings to re-acquire the checkerboard image under the current pose for calibration.
[0153] Therefore, image acquisition is completed directly based on the prediction results, ensuring that the image contrast meets the calibration requirements and improving image quality and subsequent corner point recognition accuracy.
[0154] In summary, the technical solution provided in this embodiment has at least the following advantages:
[0155] 1. Improve the accuracy of exposure settings
[0156] By modeling the grayscale distribution characteristics within the target area of a checkerboard image, determining the image contrast, and combining the relationship between exposure time and contrast to determine the target exposure time, the problem of large fluctuations in brightness and uncontrollable contrast in the exposure time determination process of related technologies is effectively avoided, thereby significantly improving the image acquisition quality, and is especially suitable for visual calibration tasks of precise corner point extraction.
[0157] 2. Significantly reduces the time cost of adjusting exposure parameters.
[0158] Many related technologies rely on automatic exposure algorithms to perform multiple image acquisitions and adjustments. This technical solution constructs an exposure prediction model (target_exposure = current_exposure * standard_contrast / current_contrast) through the initial image acquisition. This model can directly calculate the optimal exposure time in multiple subsequent poses, reducing the number of image acquisitions, saving manual parameter adjustment time, and improving the overall efficiency of calibration.
[0159] 3. Enhance the stability and robustness of exposure control.
[0160] By introducing histogram smoothing and mean shift algorithms to extract the grayscale main peak and its range of influence (grayscale main peak range), the adaptability of checkerboard features under different lighting conditions and camera models is improved, ensuring that stable and reliable contrast measurement results and exposure prediction effects can be obtained in a variety of application scenarios.
[0161] 4. Improve image quality and calibration accuracy
[0162] This technical solution ensures that the acquired images are closer to the preset target value in terms of image contrast, making the corner points of the chessboard clearer and the edges more distinct, thereby improving the success rate and accuracy of corner point detection and enhancing the overall robustness and reliability of subsequent tasks such as camera calibration and hand-eye calibration.
[0163] 5. Easy to deploy and integrate, suitable for industrial field applications.
[0164] This technical solution does not require deep learning or complex image enhancement algorithms. The implementation process is simple and clear with low computational load, making it suitable for rapid deployment in resource-constrained environments such as embedded devices and industrial vision control systems. It has good engineering feasibility and promising prospects for widespread application.
[0165] In summary, this technical solution not only surpasses existing technologies in terms of efficiency and accuracy, but also possesses excellent versatility, stability, and industrial applicability, providing a reliable and quantifiable solution for image acquisition quality control in fields such as camera calibration, visual inspection, and robot guidance.
[0166] To achieve the above embodiments, the present invention also proposes an exposure time determination device.
[0167] Figure 3 This is a schematic diagram of an exposure time determination device provided in an embodiment of the present invention.
[0168] like Figure 3 As shown, the exposure time determination device includes: an acquisition module 31, a first processing module 32, a first determination module 33, and a second determination module 34.
[0169] The acquisition module 31 is used to acquire a calibration image based on the initial value of the exposure time;
[0170] The first processing module 32 is used to perform histogram statistics on the gray values of pixels located in the target region in the calibration image to obtain the gray value histogram of the target region;
[0171] The first determining module 33 is used to determine the current image contrast of the target region based on the grayscale histogram;
[0172] The second determining module 34 is used to determine the target exposure time based on the relationship between the initial exposure time value and the current image contrast, as well as the set target image contrast.
[0173] Furthermore, in one possible implementation of this invention, the first determining module 33 includes:
[0174] The first determining unit is configured to determine at least one gray-level peak range based on the gray-level histogram; wherein any gray-level peak range is composed of a gray-level range containing the corresponding gray-level maxima.
[0175] The second determining unit is used to determine a target grayscale peak range from the at least one grayscale peak range based on the number of pixels corresponding to the at least one grayscale peak range.
[0176] The third determining unit is used to determine the contrast of the current image based on the gray value corresponding to the maximum gray value in the target gray level range.
[0177] Furthermore, in one possible implementation of this invention, the second determining unit is further configured to:
[0178] The target grayscale peak range is defined as the set number of grayscale peak ranges with the largest number of corresponding pixels in the at least one grayscale peak range.
[0179] Furthermore, in one possible implementation of this invention, the second determining unit is further configured to:
[0180] The at least one grayscale peak range is sorted according to the number of pixels corresponding to the at least one grayscale peak range;
[0181] The set number of grayscale peak ranges that are first or last in the sorted at least one grayscale peak range are determined as the target grayscale peak range.
[0182] Furthermore, in one possible implementation of this invention, the number of target grayscale main peak ranges is two; the third determining unit is further configured to:
[0183] The difference between the gray values corresponding to the maximum gray levels in the range of the two target gray level peaks is determined as the current image contrast.
[0184] Furthermore, in one possible implementation of this invention, the apparatus further includes:
[0185] The second processing module is used to normalize the grayscale histogram; and / or,
[0186] The grayscale histogram is smoothed using a Gaussian filter.
[0187] Furthermore, in one possible implementation of this invention, the second determining module 34 is further configured to:
[0188] Determine the ratio between the initial exposure time and the current image contrast.
[0189] The product of the ratio and the contrast of the target image is determined as the target exposure time.
[0190] Furthermore, in one possible implementation of this invention, the apparatus further includes:
[0191] The acquisition module is used to acquire checkerboard images according to the set reference exposure time;
[0192] The third determining module is used to determine the reference exposure time as the initial value of the exposure time in response to the detection of a checkerboard region in the checkerboard image.
[0193] The third processing module is used to update the reference exposure time in response to the absence of a checkerboard region in the checkerboard image until a checkerboard region is detected in the reference image acquired based on the updated reference exposure time, and to determine the updated reference exposure time as the initial value of the exposure time.
[0194] Furthermore, in one possible implementation of this invention, the calibration image is a checkerboard image; the apparatus further includes:
[0195] The detection module is used to detect the corner points of the chessboard in the chessboard image;
[0196] The fourth determining module is used to determine the target area based on the detected chessboard corner points.
[0197] It should be noted that the foregoing explanation of the exposure time determination method embodiment also applies to the exposure time determination device of this embodiment, and will not be repeated here.
[0198] The exposure time determination device of this invention acquires a calibration image based on an initial exposure time value; performs histogram statistics on the grayscale values of pixels located in the target area of the calibration image to obtain a grayscale histogram of the target area; determines the current image contrast of the target area based on the grayscale histogram; and determines the target exposure time based on the relationship between the initial exposure time value and the current image contrast, as well as the set target image contrast. Therefore, by modeling the grayscale distribution characteristics of the target area of the calibration image to determine the image contrast, and combining the relationship between exposure time and contrast to determine the target exposure time, the device effectively avoids the problems of large brightness fluctuations and uncontrollable contrast in the exposure time determination process of related technologies. It can quickly and stably determine the optimal exposure time suitable for the current scene, thereby obtaining a clear target calibration image with good contrast.
[0199] To implement the above embodiments, the present invention also proposes an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the exposure time determination method proposed in any of the above embodiments of the present invention.
[0200] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. It should be noted that... Figure 4 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present invention.
[0201] like Figure 4 As shown, the electronic device may include: a housing 11, a processor 12, a memory 13, a circuit board 14, and a power supply circuit 15, wherein the circuit board 14 is disposed inside the space enclosed by the housing 11, and the processor 12 and the memory 13 are disposed on the circuit board 14; the power supply circuit 15 is used to supply power to various circuits or devices of the above-mentioned electronic device; the memory 13 is used to store executable program code; the processor 12 runs a program corresponding to the executable program code by reading the executable program code stored in the memory 13, for executing the exposure time determination method proposed in any of the above embodiments of the present invention.
[0202] For details on the specific execution process of the above steps by the processor 12 and the steps further executed by the processor 12 by running executable program code, please refer to the description of the method embodiments of the present invention, which will not be repeated here.
[0203] To implement the above embodiments, the present invention also proposes a computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to execute the exposure time determination method proposed in any of the above embodiments of the present invention.
[0204] To implement the above embodiments, the present invention also proposes a computer program product, including a computer program that, when executed by a processor, implements the exposure time determination method proposed in any of the above embodiments of the present invention.
[0205] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0206] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this invention, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0207] Any process or method description in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing custom logic functions or processes, and the scope of preferred embodiments of the invention includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as should be understood by those skilled in the art to which embodiments of the invention pertain.
[0208] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection having one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Alternatively, the computer-readable medium may be paper or other suitable media on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in a computer memory.
[0209] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware as in another embodiment, it can be implemented using any of the following techniques known in the art, or a combination thereof: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0210] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.
[0211] Furthermore, the functional units in the various embodiments of the present invention can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.
[0212] The storage medium mentioned above can be a read-only memory, a disk, or an optical disk, etc. Although embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of the present invention.
Claims
1. A method for determining exposure time, characterized in that, include: Acquire checkerboard images based on the set reference exposure time; In response to the detection of a checkerboard region in the checkerboard image, the reference exposure time is determined as the initial value of the exposure time; In response to the absence of a checkerboard region in the checkerboard image, the reference exposure time is updated until a checkerboard region is detected in the reference image acquired based on the updated reference exposure time, and the updated reference exposure time is determined as the initial value of the exposure time. Acquire a calibration image based on the initial exposure time value; wherein the calibration image is a checkerboard image; Histogram statistics are performed on the grayscale values of pixels located within the target region in the calibration image to obtain the grayscale histogram of the target region; wherein, the process of determining the target region includes: detecting the corner points of the chessboard in the chessboard image, and determining the target region based on the detected chessboard corner points; Based on the grayscale histogram, determine the current image contrast of the target region; The target exposure time is determined based on the relationship between the initial exposure time and the current image contrast, as well as the set target image contrast.
2. The method according to claim 1, characterized in that, Determining the current image contrast of the target region based on the grayscale histogram includes: Based on the grayscale histogram, at least one grayscale peak range is determined; wherein any grayscale peak range is composed of a grayscale range containing the corresponding grayscale maximum value; Based on the number of pixels corresponding to the at least one grayscale peak range, a target grayscale peak range is determined from the at least one grayscale peak range. The contrast of the current image is determined based on the gray value corresponding to the maximum gray level in the target gray level range.
3. The method according to claim 2, characterized in that, Determining the target grayscale peak range from the at least one grayscale peak range based on the number of pixels corresponding to the at least one grayscale peak range includes: The target grayscale peak range is defined as the set number of grayscale peak ranges with the largest number of corresponding pixels in the at least one grayscale peak range.
4. The method according to claim 3, characterized in that, The step of determining the target grayscale peak range as the set number of grayscale peak ranges with the largest number of corresponding pixels in the at least one grayscale peak range includes: The at least one grayscale peak range is sorted according to the number of pixels corresponding to the at least one grayscale peak range; The set number of grayscale peak ranges that are first or last in the sorted at least one grayscale peak range are determined as the target grayscale peak range.
5. The method according to claim 2, characterized in that, The number of target grayscale peak ranges is two; determining the current image contrast based on the grayscale value corresponding to the maximum grayscale value in the target grayscale peak range includes: The difference between the gray values corresponding to the maximum gray levels in the range of the two target gray level peaks is determined as the current image contrast.
6. The method according to claim 2, characterized in that, Before determining at least one grayscale peak range based on the grayscale histogram, the method further includes: The grayscale histogram is normalized; and / or, The grayscale histogram is smoothed using a Gaussian filter.
7. The method according to claim 1, characterized in that, The step of determining the target exposure time based on the relationship between the initial exposure time value and the current image contrast, and the set target image contrast, includes: Determine the ratio between the initial exposure time and the current image contrast. The product of the ratio and the contrast of the target image is determined as the target exposure time.
8. An exposure time determining device, characterized in that, include: The acquisition module is used to acquire checkerboard images according to the set reference exposure time; In response to the detection of a checkerboard region in the checkerboard image, the reference exposure time is determined as the initial exposure time value; in response to the absence of a checkerboard region in the checkerboard image, the reference exposure time is updated until a checkerboard region is detected in the reference image acquired based on the updated reference exposure time, and the updated reference exposure time is determined as the initial exposure time value. Acquire a calibration image based on the initial exposure time value; wherein the calibration image is a checkerboard image; The first processing module is used to perform histogram statistics on the gray values of pixels located in the target region in the calibration image to obtain the gray value histogram of the target region; wherein, the process of determining the target region includes: detecting the corner points of the chessboard in the chessboard image, and determining the target region based on the detected chessboard corner points; The first determining module is used to determine the current image contrast of the target region based on the grayscale histogram; The second determining module is used to determine the target exposure time based on the relationship between the initial exposure time value and the current image contrast, as well as the set target image contrast.
Citation Information
Patent Citations
Automatic exposure method based on analogous column diagram
CN101783888A
Automatic exposure method based on histogram equalization
CN102523386A