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

By acquiring multiple frames of images with different exposure times and calculating reflectance using the linear relationship between grayscale value and exposure time, the limitations of traditional exposure methods in 3D structured light measurement are overcome, enabling fast and efficient exposure time calculation and image quality improvement.

CN120916067APending Publication Date: 2025-11-07WUHAN POWER3D TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511078102.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-01
Publication Date
2025-11-07

AI Technical Summary

Technical Problem

In existing 3D structured light measurement technology, the traditional fixed exposure method is difficult to simultaneously achieve image brightness balance and detail preservation, resulting in poor point cloud quality. Furthermore, the automatic exposure method has limitations such as single exposure, high equipment adaptation costs, and long calculation time for multiple exposure strategies.

Method used

By acquiring multiple frames of images to be processed at different exposure times, the reflectance of each pixel block is calculated using the linear relationship between grayscale value and exposure time. Based on the reflectance, the expected exposure time of each pixel block at a preset target grayscale value is calculated, thus achieving fast and efficient exposure time calculation.

Benefits of technology

It enables rapid and efficient calculation of optimal exposure time in scenarios with different reflectivities, improving image brightness balance and detail preservation, and enhancing point cloud quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120916067A_ABST
    Figure CN120916067A_ABST
Patent Text Reader

Abstract

The invention relates to an automatic exposure method and device, computer equipment, a computer readable storage medium and a computer program product. The method comprises the following steps: acquiring multiple frames of to-be-processed images under different exposure time; the to-be-processed image comprises a plurality of pixel blocks; calculating the reflectivity of each pixel block by using the linear relationship between the gray value of each frame of the to-be-processed image and the exposure time; and calculating the expected exposure time of each pixel block under a preset target gray value based on the reflectivity of each pixel block. By adopting the method, the exposure time can be quickly and efficiently calculated.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of three-dimensional structured light measurement, in particular to an automatic exposure method and device, computer equipment, computer readable storage medium and computer program product. BACKGROUND

[0002] Three-dimensional structured light measurement technology has been widely applied in industrial quality detection, reverse engineering and automated manufacturing by projecting an encoded grating pattern on the surface of the measured object, capturing the deformed fringe image with a camera, and combining geometric reconstruction algorithm to obtain the object surface topography information.

[0003] In order to ensure the accuracy of three-dimensional reconstruction, the captured image should have good gray scale contrast and signal-to-noise ratio. However, in actual measurement, the significant difference in object surface reflectivity, environmental light interference and pattern modulation characteristics make it difficult for the traditional fixed exposure method to balance image brightness and detail retention at the same time, which affects the final point cloud quality.

[0004] Currently, the related technology has the problems of single exposure limitation, high device adaptation cost and long time-consuming of multiple exposure strategy calculation in the automatic exposure method, which cannot quickly and efficiently adapt to the needs of complex reflectivity industrial measurement scenes. SUMMARY

[0005] Therefore, it is necessary to provide an automatic exposure method, device, computer equipment, computer readable storage medium and computer program product capable of quickly and efficiently calculating exposure time to solve the above technical problems.

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

[0007] obtaining a plurality of frames of images to be processed under different exposure times; the images to be processed include a plurality of pixel blocks;

[0008] calculating the reflectivity of each pixel block by using the linear relationship between the gray value of each frame of the images to be processed and the exposure time;

[0009] based on the reflectivity of each pixel block, calculating the expected exposure time of each pixel block under a preset target gray value.

[0010] In one embodiment, the above calculation of the reflectivity of each pixel block by using the linear relationship between the gray value of each frame of the images to be processed and the exposure time comprises:

[0011] calculating the average exposure time according to the exposure time of each frame of the images to be processed;

[0012] calculating the average gray value according to the gray value of each frame of the images to be processed;

[0013] Linear regression is performed based on the exposure time of each frame of the to-be-processed image, the gray value of each frame of the to-be-processed image, the average exposure time, and the average gray value, to calculate the reflectivity of each pixel block.

[0014] In one embodiment, the above-mentioned calculation of the expected exposure time of each pixel block at a preset target gray value based on the reflectivity of each pixel block comprises:

[0015] A first gray difference of each pixel block is obtained by calculating the difference between the preset target gray value and the gray value of each pixel block in the first frame of the to-be-processed image.

[0016] A first exposure time increment of each pixel block is obtained by calculating the ratio between the first gray difference of each pixel block and the reflectivity of each pixel block.

[0017] The expected exposure time of each pixel block is obtained by adding the first exposure time increment to the exposure time of the first frame of the to-be-processed image.

[0018] In one embodiment, after the above-mentioned calculation of the reflectivity of each pixel block, the method further comprises:

[0019] A plurality of reflection regions are obtained by classifying according to the reflectivity of each pixel block.

[0020] The above-mentioned calculation of the expected exposure time of each pixel block at a preset target gray value based on the reflectivity of each pixel block comprises:

[0021] The average reflectivity of each reflection region is calculated according to the reflectivity of each pixel block.

[0022] The expected exposure time of each reflection region at the preset target gray value is calculated according to the average reflectivity of each reflection region.

[0023] In one embodiment, the above-mentioned calculation of the expected exposure time of each reflection region at the preset target gray value according to the average reflectivity of each reflection region comprises:

[0024] The gray value of each reflection region is calculated according to the gray value of the to-be-processed image.

[0025] A second gray difference of each reflection region is obtained by calculating the difference between the preset target gray value and the gray value of each reflection region.

[0026] A second exposure time increment of each reflection region is obtained by calculating the ratio between the second gray difference of each reflection region and the average reflectivity of each reflection region.

[0027] On the basis of the second exposure time increment, the exposure time of the first frame of the to-be-processed image is added to obtain an expected exposure time of each of the reflection regions.

[0028] In one embodiment, the classifying according to the reflectivity of the pixel blocks to obtain the multiple classes of reflection regions comprises:

[0029] Randomly selecting a first number of initial cluster centers from the reflectivity of each of the pixel blocks;

[0030] Calculating a first distance of other reflectivity to the initial cluster center, and performing first clustering according to the first distance to obtain an initial cluster;

[0031] For each of the initial clusters, randomly selecting a second number of reference cluster centers, calculating a second distance of other reflectivity in the initial cluster to the reference cluster center, and performing second clustering according to the second distance to obtain a reference cluster;

[0032] Calculating an evaluation value of the initial cluster and the reference cluster, and continuing the steps of the first clustering and the second clustering on the basis of the initial cluster or the reference cluster according to the evaluation value until the evaluation value reaches a convergence condition.

[0033] In a second aspect, the present application further provides an automatic exposure device, comprising:

[0034] An acquisition module configured to acquire multiple frames of to-be-processed images under different exposure times; the to-be-processed images comprise multiple pixel blocks;

[0035] A reflectivity calculation module configured to calculate the reflectivity of each of the pixel blocks by using a linear relationship between the gray value of each frame of the to-be-processed images and the exposure time;

[0036] An exposure time calculation module configured to calculate, on the basis of the reflectivity of each of the pixel blocks, an expected exposure time of each of the pixel blocks under a preset target gray value.

[0037] In a third aspect, the present application further provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method in any one of the above embodiments when executing the computer program.

[0038] In a fourth aspect, the present application further provides a computer readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to implement the steps of the method in any one of the above embodiments.

[0039] In a fifth aspect, the present application further provides a computer program product comprising a computer program, wherein the computer program is executed by a processor to implement the steps of the method in any one of the above embodiments.

[0040] The automatic exposure method, device, computer device, computer readable storage medium and computer program product can obtain a plurality of frames of images to be processed under different exposure times, calculate the reflectivity of each pixel block in combination with the linear relationship between the image gray value and the exposure time, and then calculate under a unified target gray value, so that the exposure time under various scenes can be quickly and efficiently calculated. BRIEF DESCRIPTION OF DRAWINGS

[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related art, the drawings needed to be used in the description of the embodiments of the present application or the related art will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other related drawings can be obtained by those skilled in the art without creative labor.

[0042] Figure 1 A flowchart of an automatic exposure method in an embodiment;

[0043] Figure 2 A flowchart of an automatic exposure step in an exemplary embodiment;

[0044] Figure 3 A high reflectivity target test schematic used in an embodiment;

[0045] Figure 4 A Figure 3 A corresponding effect diagram;

[0046] Figure 5 A low reflectivity target test schematic used in an embodiment;

[0047] Figure 6 A Figure 5 A corresponding effect diagram;

[0048] Figure 7 A structural block diagram of an automatic exposure device in an embodiment;

[0049] Figure 8 An internal structure diagram of a computer device in an embodiment. DETAILED DESCRIPTION

[0050] In order to make the purpose, technical solutions and advantages of the present application more clear, the present application will be further described in detail below in combination with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and not to limit the present application.

[0051] In an embodiment, as Figure 1As shown, an automatic exposure method is provided, and the embodiment takes the method applied to a terminal as an example. It can be understood that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is realized through the interaction of the terminal and the server. In the embodiment, the method includes the following steps:

[0052] In step 102, a plurality of frames of to-be-processed images under different exposure times are acquired; the to-be-processed images include a plurality of pixel blocks.

[0053] The fixed exposure sequence is a pre-set fixed exposure time list, for example, 5 ms, 10 ms, 20 ms. In the image acquisition process, the camera uses these exposure times one by one according to the sequence to obtain a plurality of frames of to-be-processed images.

[0054] The pixel block is obtained by dividing the to-be-processed image according to a pre-set division rule. For example, it can be obtained by dividing 8x8 or 16x16.

[0055] For example, a plurality of frames of to-be-processed images are acquired in sequence according to a pre-set fixed exposure sequence. The fixed exposure sequence is a set of known exposure time values, for example, 10 ms, 20 ms, 30 ms, etc. The camera strictly applies each exposure time in sequence during the acquisition process to acquire images, thereby obtaining a plurality of image sequences corresponding to different exposure times under the premise of ensuring constant projection brightness. Each frame of image is complete two-dimensional image data, including a plurality of pixel points. In order to facilitate subsequent processing, each frame of image is divided into a plurality of pixel blocks in the present application, each pixel block being a local area in the image, for example, composed of 8x8 pixels.

[0056] In step 104, the reflectivity of each pixel block is calculated using the linear relationship between the gray value of each frame of to-be-processed image and the exposure time.

[0057] The gray value represents the brightness intensity of each pixel in the image, generally an integer in the range of 0-255, indicating the intensity of light received by the pixel; the exposure time refers to the length of time that the camera is sensitive to light, and the longer the exposure time, the brighter the image.

[0058] Under the same lighting conditions, the pixel gray value increases linearly with the extension of the exposure time, and the growth rate is proportional to the reflectivity of the object surface. In other words, the speed of gray value growth is a manifestation of the light reflection ability of the region. Therefore, the reflectivity of each pixel block can be calculated through the linear relationship between the gray value and the exposure time.

[0059] Assuming that under the fixed lighting conditions, the same pixel block is taken using different exposure times, such as 10ms, 20ms, 30ms, and the gray values are 50, 100, 150 respectively, it is found that the gray value increases by 50, and the exposure time increases by 10ms. Therefore, as long as multiple images under different exposure times are collected, based on the gray value change trend, the slope can be calculated by linear fitting, that is, the reflectivity.

[0060] In step 106, based on the reflectivity of each pixel block, the expected exposure time of each pixel block under the preset target gray value is calculated.

[0061] First of all, it needs to be pointed out that the exposure time in step 104 refers to the actual exposure time set during image acquisition, that is, the camera sets and applies the exposure time to the image sensor before acquiring each frame of image to be processed, which belongs to the acquisition parameter. Because in the real scene, the object performance exists in different materials, colors and combined structures, resulting in significant differences in the light intensity received by the pixel blocks in the same frame of image. If a uniform fixed exposure time is used, the bright area may be overexposed and the highlight may overflow, while the dark area may have too low gray value. Therefore, the expected exposure time of different pixel blocks needs to be calculated. The expected exposure time in step 106 refers to the theoretical best exposure time calculated based on the reflectivity of each pixel block, its gray value in the reference frame and the preset target gray value, which is used to predict the exposure time that should be used by the pixel block to achieve the desired brightness level.

[0062] Optionally, in step 104, the reflectivity of each pixel block has been obtained, based on which the linear relationship between the gray value and the exposure time can be used to inversely calculate the exposure time that should be used by each pixel block to achieve the target gray value, and the calculated exposure time is the expected exposure time in this embodiment.

[0063] In the above automatic exposure method, multiple frames of images to be processed under different exposure times are obtained, and the linear relationship between the image gray value and the exposure time is used to calculate the reflectivity of each pixel block, and then the exposure time under the unified target gray value is calculated, which can quickly and efficiently calculate the exposure time in various scenes.

[0064] In one embodiment, the above calculation of the reflectivity of each pixel block using the linear relationship between the gray value and the exposure time of each frame of image to be processed includes: calculating the average exposure time according to the exposure time of each frame of image to be processed; calculating the average gray value according to the gray value of each frame of image to be processed; performing linear regression based on the exposure time of each frame of image to be processed, the gray value of each frame of image to be processed, the average exposure time and the average gray value to calculate the reflectivity of each pixel block.

[0065] Given an arbitrary object with unknown surface reflectivity, it is difficult to determine the optimal exposure time. Therefore, fixed exposure time can result in: ① overexposure in high reflectivity areas (loss of details). ② underexposure in low reflectivity areas, poor point cloud imaging quality. Therefore, an optimal exposure time can be determined according to the surface reflectivity of the object to ensure the quality of the entire structured light measurement. Based on the illumination imaging model, the gray response of each pixel point at different exposure times can be described as follows:

[0066] Formula (1)

[0067] Where: : camera sensitivity; La: direct environmental light; Lo: reflected environmental light; Lp: projected light; : object surface reflectivity; t: exposure time; In: image noise; I(x,y;t): pixel intensity.

[0068] In the structured light measurement system, ① the projected light is much larger than the ambient light, so La and Lo can be ignored. ② for a given camera and pixel point, and are constant. ③ LED light is approximately constant over time, and Lp is constant for each pixel.

[0069] Therefore, in the structured light system, the illumination imaging model can finally be converted into a linear form, that is:

[0070] Formula (2)

[0071] For a stationary object, k(x,y) can be determined by capturing a set of images of the object with different exposure times and fitting the intensity of each pixel with linear regression. Because and Lp are known and controlled, k(x,y) can be used to determine the approximate surface reflectivity of the object at each imaging pixel .

[0072] To obtain the above slope k(x,y), the present scheme first calculates the average exposure time according to the exposure time of each frame of the image to be processed, and calculates the average gray value according to the gray value of each frame of the image to be processed, and then further adopts the least square method for one-dimensional linear regression. The specific calculation formula is as follows:

[0073] Formula (3)

[0074] Where, x i is the exposure time corresponding to the i-th frame of image, is the gray value of the pixel point in the frame image, , the mean value of the exposure time and the gray value, respectively.

[0075] In one embodiment, the above-mentioned calculating the expected exposure time of each pixel block at the preset target gray value based on the reflectivity of each pixel block comprises: calculating the difference between the preset target gray value and the gray value of each pixel block in the first frame of the image to be processed to obtain a first gray difference of each pixel block; calculating the ratio between the first gray difference of each pixel block and the reflectivity of each pixel block to obtain a first exposure time increment; and adding the exposure time of the first frame of the image to be processed to the first exposure time increment to obtain the expected exposure time of each pixel block.

[0076] The first gray difference refers to the difference between the preset target gray value and the corresponding gray value of each pixel block in the first frame of the image; and the first exposure time increment is the ratio of the first gray difference to the reflectivity of the pixel block, which represents the additional exposure time required by the pixel block to reach the target gray value.

[0077] Optionally, for each pixel block in the image, the difference between the gray value of the pixel block in the first frame of the image to be processed and the preset target gray value is calculated to obtain a first gray difference of the pixel block. The first gray difference represents how far the pixel block is from the target brightness under the current exposure condition. For example, if the target gray value is 160 and the current gray value is 100, the first gray difference is 60.

[0078] Optionally, the first gray difference of the pixel block is divided by its reflectivity to obtain the exposure time increment required by the pixel block, i.e., the first exposure time increment. Finally, the actual exposure time used by the first frame of the image is added to the exposure time increment to obtain the expected exposure time of each pixel block.

[0079] Further, the first gray difference of each pixel and the first gray difference can be calculated first, and then the expected exposure of each pixel block is calculated based on the first gray difference of each pixel and the first gray difference.

[0080] For example, the preset exposure time of each pixel point can be calculated according to formula (4).

[0081] Formula (4)

[0082] wherein, is the preset target gray value of each pixel point, represents the actual gray value collected by the pixel point under the exposure time t1, represents the pixel-level gray difference, represents the reflectivity of the pixel point.

[0083] In other embodiments, the expected exposure time of each pixel can also be calculated, and the expected exposure time of each pixel block is calculated based on the expected exposure time of each pixel.

[0084] In the above embodiment, the expected exposure time of each pixel block is calculated based on the reflectivity and the current gray value of each pixel block, combined with the preset target gray value, so that the exposure time can be finely estimated at the pixel block level.

[0085] Further, in an embodiment, after calculating the reflectivity of each pixel block, the method further includes: classifying the pixel blocks according to the reflectivity to obtain multiple categories of reflection regions; and calculating the expected exposure time of each pixel block at the preset target gray value based on the reflectivity of each pixel block, including: calculating the average reflectivity of each reflection region according to the reflectivity of the pixel block; and calculating the expected exposure time of each reflection region at the preset target gray value according to the average reflectivity of each reflection region.

[0086] Since the device may be slightly shaken during continuous image acquisition, directly calculating the reflectivity based on a single pixel may result in unstable results. In this embodiment, the reflectivity is calculated in units of pixel blocks composed of similar 5x5 pixels to improve stability and robustness. After obtaining the reflectivity of each pixel block, the pixel blocks are classified according to their values to divide them into high reflectivity, medium reflectivity, and low reflectivity regions. Then, the expected exposure time corresponding to the reflectivity values of different categories is calculated.

[0087] In this embodiment, the average reflectivity of each reflection region is first calculated according to the reflectivity of the pixel block, and then the expected exposure time of each reflection region is calculated based on the average reflectivity of each reflection region. The calculation method of the expected exposure time of each reflection region is similar to the method of calculating the expected exposure time based on the pixel block in the above embodiment, which will not be repeated here.

[0088] In the above embodiment, in order to improve the stability and region light adaptability of the exposure time estimation, in this embodiment, after the reflectivity of each pixel block is calculated, the pixel blocks are further classified.

[0089] In an embodiment, the calculation of the expected exposure time of each reflection region at the preset target gray value according to the average reflectivity of each reflection region includes: calculating the gray value of each reflection region according to the gray value of the image to be processed; calculating the difference between the preset target gray value and the gray value of each reflection region to obtain a second gray difference of each reflection region; calculating the ratio of the second gray difference of each reflection region to the average reflectivity of each reflection region to obtain a second exposure time increment; and adding the exposure time of the first frame of image to be processed to the second exposure time increment to obtain the expected exposure time of each reflection region.

[0090] wherein the second gray scale difference refers to a difference between the preset target gray scale value and the average gray scale value of the corresponding reflection region of each reflection region in the first frame image; and the second exposure time increment is a ratio of the second gray scale difference to the reflectivity of the reflection region, indicating the additional exposure time required to reach the target gray scale.

[0091] Optionally, after obtaining the multiple types of reflection regions, the corresponding pixel blocks in the first frame to-be-processed image are also classified correspondingly, and the average gray scale values of the reflection regions of each type in the first frame to-be-processed image are calculated. Assuming that there are three types of reflection regions, the average gray scale values of the reflection regions of each type in the first frame to-be-processed image can be denoted as I cat1 , I cat2 and I cat3 .

[0092] For example, the expected exposure time of each reflection region can be calculated according to formula (5).

[0093] Formula (5)

[0094] wherein the second gray scale difference refers to a difference between the preset target gray scale value and the average gray scale value of the corresponding reflection region of each reflection region in the first frame image; and the second exposure time increment is a ratio of the second gray scale difference to the reflectivity of the reflection region, indicating the additional exposure time required to reach the target gray scale.

[0095] In one embodiment, the above classification according to the reflectivity of the pixel block to obtain multiple types of reflection regions includes: randomly selecting a first number of initial cluster centers from the reflectivity of each pixel block; calculating a first distance of other reflectivity to the initial cluster center, and performing first clustering according to the first distance to obtain an initial cluster; for each initial cluster, randomly selecting a second number of reference cluster centers, and calculating a second distance of other reflectivity in the initial cluster to the reference cluster center, and performing second clustering according to the second distance to obtain a reference cluster; calculating an evaluation value of the initial cluster and the reference cluster, and continuing the steps of first clustering and second clustering on the basis of the initial cluster or the reference cluster according to the evaluation value until the evaluation value reaches a convergence condition.

[0096] In this embodiment, the first preset number and the second preset number are pre-set, which can be set according to specific application scenarios.

[0097] Optionally, before clustering, normalization to the (0-1) interval is first performed, and then classification is performed based on the reflectivity after normalization.

[0098] ​​​First, a first number of initial cluster centers are randomly selected from the reflectivity of each pixel block, and then all pixel blocks are traversed to calculate the Euclidean distance between the reflectivity of each pixel block and each initial cluster center, i.e., a first distance, and each pixel block is assigned to a cluster corresponding to the nearest cluster center to obtain initial clusters.

[0099] For each initial cluster, a second preset number of reference cluster centers are randomly selected, and the Euclidean distance between each pixel block and the reference cluster centers in the cluster is calculated again, i.e., a second distance, and the samples in the cluster are reclassified according to the minimum distance to form reference clusters.

[0100] Then, the evaluation value of the initial cluster and the reference cluster is calculated, such as a clustering evaluation index of Bayesian information criterion. If the evaluation value of the reference cluster is higher than that of the initial cluster and the evaluation value has not converged, the first clustering and the second clustering are continued to be performed on the basis of the reference cluster until the evaluation value of the reference cluster converges. If the evaluation value of the reference cluster is less than that of the initial cluster and the evaluation value has not converged, the first clustering and the second clustering are continued to be performed on the basis of the initial cluster until the evaluation value of the reference cluster converges.

[0101] In the embodiment, each pixel block is classified by clustering to obtain multiple reflection regions.

[0102] Further, in one embodiment, the automatic exposure function is combined with the local area automatic exposure function. Figure 2 , Figure 2 FIG. 1 is a flowchart of an automatic exposure process in an exemplary embodiment.

[0103] For a CMOS sensor, under the conditions of non-underexposure and non-overexposure, and under the premise that parameters such as ISO remain fixed, the pixel gray scale and the exposure time are in a linear relationship. Based on this principle, by collecting a series of images under the same projection brightness and different exposure times, the surface reflectivity of the object can be calculated. Subsequently, according to the measured reflectivity, the region is classified, and the optimal exposure time required by different target regions to reach the expected gray scale range is estimated, as shown in FIG. 2. Figure 2

[0104] In an exemplary embodiment, to verify the automatic exposure function, single-exposure tests and multiple-exposure tests are respectively performed on single-color targets with different reflectivities.

[0105] In the single-exposure test, after the local area automatic exposure function is used to complete light measurement, the exposure time is applied to the structured light point imaging, and the point cloud reconstruction effect is evaluated.

[0106] For example, the automatic exposure function is combined with the local area automatic exposure function. Figure 3 , Figure 3 FIG. 3 is a test schematic diagram of a high-reflectivity target used in one embodiment.

[0107] ​Figure 3 The exposure time corresponding to each test target in the middle is shown in Table 1.

[0108] Table 1

[0109]

[0110] Figure 3 The effect diagram corresponding to each test target in the middle is shown in Figure 4 The user drags the circular ROI to a position that covers both reflectivity regions, and performs automatic exposure calculation based on the region, thereby obtaining the best exposure time recommended by the algorithm. Figure 4 The point cloud result obtained by collecting images and reconstruction at the exposure time is shown on the left side in the middle, and the current local area automatic exposure mode is used on the right side.

[0111] For example, in combination with Figure 5 , Figure 5 A test schematic diagram of a low reflectivity target used in an embodiment.

[0112] Figure 4 The exposure time corresponding to each test target in the middle is shown in Table 2.

[0113] Table 2

[0114]

[0115] Figure 5 The effect diagram corresponding to each test target in the middle is shown in Figure 6

[0116] It should be understood that, although each step in the flowchart involved in each of the above-described embodiments is displayed in sequence according to the direction of the arrow, these steps are not necessarily executed in sequence according to the direction of the arrow. Unless otherwise specified herein, the execution of these steps is not strictly limited in sequence, and these steps can be executed in other sequences. Moreover, at least part of the steps in the flowchart involved in each of the above-described embodiments can include multiple steps or stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence of these steps or stages is not necessarily sequential, but can be executed in rotation or alternation with at least part of other steps or steps or stages in other steps.

[0117] ​Based on the same inventive concept, the embodiments of the present application also provide an automatic exposure device for implementing the automatic exposure method described above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme described in the above method, so the specific limitations in one or more automatic exposure device embodiments provided below can refer to the limitations of the automatic exposure method described above, which will not be described here.

[0118] In one exemplary embodiment, as shown in Figure 7 An automatic exposure device is provided, comprising: an acquisition module, a reflectivity calculation module and an exposure time calculation module, wherein:

[0119] The acquisition module is configured to acquire a plurality of frames of images to be processed under different exposure times; the images to be processed comprise a plurality of pixel blocks.

[0120] The reflectivity calculation module is configured to calculate the reflectivity of each pixel block by using the linear relationship between the gray value of each frame of the image to be processed and the exposure time.

[0121] The exposure time calculation module is configured to calculate the expected exposure time of each pixel block under a preset target gray value based on the reflectivity of each pixel block.

[0122] In one embodiment, the reflectivity calculation module described above comprises:

[0123] The average exposure time calculation unit is configured to calculate the average exposure time according to the exposure time of each frame of the image to be processed.

[0124] The first gray value calculation unit is configured to calculate the average gray value according to the gray value of each frame of the image to be processed.

[0125] The first reflectivity calculation unit is configured to calculate the reflectivity of each pixel block by linear regression based on the exposure time of each frame of the image to be processed, the gray value of each frame of the image to be processed, the average exposure time and the average gray value.

[0126] In one embodiment, the exposure time calculation module described above comprises:

[0127] The first gray difference calculation unit is configured to calculate the difference between the preset target gray value and the gray value of each pixel block in the first frame of the image to be processed, to obtain the first gray difference of each pixel block.

[0128] The first increment calculation unit is configured to calculate the ratio between the first gray difference of each pixel block and the reflectivity of each pixel block, to obtain the first exposure time increment.

[0129] The first adjustment unit is configured to add the exposure time of the first frame of the image to be processed based on the first exposure time increment, to obtain the expected exposure time of each pixel block.

[0130] In one embodiment, the apparatus further comprises:

[0131] a classification module configured to classify the reflectivity of the pixel blocks to obtain a plurality of reflection regions.

[0132] In one embodiment, the exposure time calculation module comprises:

[0133] an average reflectivity calculation unit configured to calculate the average reflectivity of each reflection region according to the reflectivity of the pixel blocks.

[0134] a reflection region exposure time calculation unit configured to calculate the expected exposure time of each reflection region at a preset target gray value according to the average reflectivity of each reflection region.

[0135] In one embodiment, the reflection region exposure time calculation unit comprises:

[0136] a gray value calculation subunit configured to calculate the gray value of each reflection region according to the gray value of the image to be processed.

[0137] a second gray value difference calculation subunit configured to calculate the difference between the preset target gray value and the gray value of each reflection region to obtain a second gray value difference of each reflection region.

[0138] a second increment calculation unit configured to calculate the ratio of the second gray value difference of each reflection region to the average reflectivity of each reflection region to obtain a second exposure time increment.

[0139] a second adjustment unit configured to add the exposure time of the first frame of image to be processed to the second exposure time increment to obtain the expected exposure time of each reflection region.

[0140] In one embodiment, the classification module comprises:

[0141] a random cluster center unit configured to randomly select a first number of initial cluster centers from the reflectivity of the pixel blocks.

[0142] a first clustering unit configured to calculate a first distance of other reflectivity to the initial cluster center and perform first clustering according to the first distance to obtain an initial cluster.

[0143] a second clustering unit configured to randomly select a second number of reference cluster centers for each initial cluster, calculate a second distance of other reflectivity in the initial cluster to the reference cluster center, and perform second clustering according to the second distance to obtain a reference cluster.

[0144] an iteration unit configured to calculate an evaluation value of the initial cluster and the reference cluster, and continue the steps of first clustering and second clustering based on the initial cluster or the reference cluster according to the evaluation value until the evaluation value reaches a convergence condition.

[0145] The modules in the automatic exposure device can be implemented by software, hardware, or a combination thereof. The modules can be embedded in or independent of a processor in a computer device in hardware form, or stored in a memory in the computer device in software form, so that the processor can call and execute the operations corresponding to the modules.

[0146] In an exemplary embodiment, a computer device, which can be a server, has an internal structure as shown in Figure 8 The computer device includes a processor, a memory, an input / output interface, and a communication interface. The processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for running the operating system and the computer program in the non-volatile storage medium. The database of the computer device is configured to store image data to be processed. The input / output interface of the computer device is configured to exchange information between the processor and external devices. The communication interface of the computer device is configured to communicate with terminals outside through a network connection. The computer program is executed by the processor to implement an automatic exposure method.

[0147] Those skilled in the art can understand that Figure 8 The structure shown in the above

[0148] In an exemplary embodiment, a computer device includes a memory and a processor. The memory stores a computer program. When the processor executes the computer program, the following steps are implemented: obtaining a plurality of frames of image data to be processed under different exposure times; the image data to be processed includes a plurality of pixel blocks; calculating the reflectivity of each pixel block using the linear relationship between the gray value and the exposure time of each frame of image data to be processed; and calculating the expected exposure time of each pixel block under a preset target gray value based on the reflectivity of each pixel block.

[0149] In one embodiment, the processor, when executing the computer program, further implements the following steps: calculating an average exposure time according to the exposure times of the frames of the to-be-processed images; calculating an average gray value according to the gray values of the frames of the to-be-processed images; and calculating the reflectivity of each pixel block based on the exposure times of the frames of the to-be-processed images, the gray values of the frames of the to-be-processed images, the average exposure time, and the average gray value.

[0150] In one embodiment, the processor, when executing the computer program, further implements the following steps: calculating a first gray difference of each pixel block by calculating a difference between the preset target gray value and the gray value of each pixel block in the first frame of the to-be-processed images; calculating a first exposure time increment by calculating a ratio between the first gray difference of each pixel block and the reflectivity of each pixel block; and obtaining the expected exposure time of each pixel block by adding the first exposure time increment to the exposure time of the first frame of the to-be-processed images.

[0151] In one embodiment, the processor, when executing the computer program, further implements the following steps: obtaining multiple categories of reflection regions by classifying the reflectivity of each pixel block; and calculating the expected exposure time of each pixel block at the preset target gray value based on the reflectivity of each pixel block, including: calculating an average reflectivity of each reflection region according to the reflectivity of each pixel block; and calculating the expected exposure time of each reflection region at the preset target gray value according to the average reflectivity of each reflection region.

[0152] In one embodiment, the processor, when executing the computer program, further implements the following steps: calculating a gray value of each reflection region according to the gray value of the to-be-processed images; calculating a second gray difference of each reflection region by calculating a difference between the preset target gray value and the gray value of each reflection region; calculating a second exposure time increment by calculating a ratio between the second gray difference of each reflection region and the average reflectivity of each reflection region; and obtaining the expected exposure time of each reflection region by adding the second exposure time increment to the exposure time of the first frame of the to-be-processed images.

[0153] In one embodiment, the processor, when executing the computer program, further implements the following steps: randomly selecting a first number of initial cluster centers from the reflectivity of each pixel block; calculating a first distance from other reflectivity to the initial cluster center, and performing first clustering according to the first distance to obtain an initial cluster; randomly selecting a second number of reference cluster centers for each initial cluster, calculating a second distance from other reflectivity in the initial cluster to the reference cluster center, and performing second clustering according to the second distance to obtain a reference cluster; calculating an evaluation value of the initial cluster and the reference cluster, and continuing the steps of the first clustering and the second clustering based on the initial cluster or the reference cluster according to the evaluation value until the evaluation value reaches a convergence condition.

[0154] In one embodiment, a computer readable storage medium is provided, having stored thereon a computer program, the computer program being executed by a processor to implement the following steps: obtaining a plurality of frames of to-be-processed images under different exposure times; the to-be-processed images comprising a plurality of pixel blocks; calculating reflectivity of each pixel block by using a linear relationship between a gray value and an exposure time of each frame of to-be-processed images; and calculating an expected exposure time of each pixel block under a preset target gray value based on the reflectivity of each pixel block.

[0155] In one embodiment, the computer program is executed by the processor to further implement the following steps: calculating an average exposure time according to the exposure times of the frames of to-be-processed images; calculating an average gray value according to the gray values of the frames of to-be-processed images; and calculating the reflectivity of each pixel block by linear regression based on the exposure times of the frames of to-be-processed images, the gray values of the frames of to-be-processed images, the average exposure time, and the average gray value.

[0156] In one embodiment, the computer program is executed by the processor to further implement the following steps: calculating a first gray difference of each pixel block by calculating a difference between the preset target gray value and a gray value of each pixel block in a first frame of to-be-processed images; calculating a first exposure time increment by calculating a ratio between the first gray difference of each pixel block and the reflectivity of each pixel block; and obtaining the expected exposure time of each pixel block by adding the first exposure time increment to the exposure time of the first frame of to-be-processed images.

[0157] In one embodiment, the computer program is executed by the processor to further implement the following steps: obtaining a plurality of categories of reflection regions by classifying the pixel blocks according to the reflectivity of the pixel blocks; and calculating the expected exposure time of each pixel block under the preset target gray value based on the reflectivity of each pixel block, comprising: calculating an average reflectivity of each reflection region according to the reflectivity of the pixel blocks; and calculating the expected exposure time of each reflection region under the preset target gray value according to the average reflectivity of each reflection region.

[0158] In one embodiment, the computer program is executed by the processor to further implement the following steps: calculating a gray value of each reflection region according to the gray value of the to-be-processed images; calculating a second gray difference of each reflection region by calculating a difference between the preset target gray value and the gray value of each reflection region; calculating a second exposure time increment by calculating a ratio between the second gray difference of each reflection region and the average reflectivity of each reflection region; and obtaining the expected exposure time of each reflection region by adding the second exposure time increment to the exposure time of the first frame of to-be-processed images.

[0159] In one embodiment, the computer program, when executed by the processor, further implements the following steps: randomly selecting a first number of initial cluster centers from the reflectivities of the pixel blocks; calculating first distances of other reflectivities to the initial cluster centers, and performing first clustering according to the first distances to obtain initial clusters; for each initial cluster, randomly selecting a second number of reference cluster centers, and calculating second distances of other reflectivities in the initial cluster to the reference cluster centers, and performing second clustering according to the second distances to obtain reference clusters; calculating evaluation values of the initial clusters and the reference clusters, and continuing the steps of the first clustering and the second clustering based on the initial clusters or the reference clusters according to the evaluation values until the evaluation values reach a convergence condition.

[0160] In one embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the following steps: obtaining a plurality of frames of to-be-processed images under different exposure times; the to-be-processed images comprising a plurality of pixel blocks; calculating reflectivities of the pixel blocks by using a linear relationship between gray values and exposure times of the frames of to-be-processed images; and calculating expected exposure times of the pixel blocks under a preset target gray value based on the reflectivities of the pixel blocks.

[0161] In one embodiment, the computer program, when executed by the processor, further implements the following steps: calculating an average exposure time according to the exposure times of the frames of to-be-processed images; calculating an average gray value according to the gray values of the frames of to-be-processed images; and performing linear regression based on the exposure times of the frames of to-be-processed images, the gray values of the frames of to-be-processed images, the average exposure time, and the average gray value to calculate the reflectivities of the pixel blocks.

[0162] In one embodiment, the computer program, when executed by the processor, further implements the following steps: calculating a first gray difference of each pixel block between the preset target gray value and a gray value of the pixel block in a first frame of to-be-processed images; calculating a first exposure time increment of each pixel block between the first gray difference of the pixel block and the reflectivity of the pixel block; and adding the first exposure time increment to an exposure time of the first frame of to-be-processed images to obtain the expected exposure time of the pixel block.

[0163] In one embodiment, the computer program, when executed by the processor, further implements the following steps: classifying the pixel blocks according to the reflectivities to obtain a plurality of reflection regions; and calculating expected exposure times of the pixel blocks under a preset target gray value based on the reflectivities of the pixel blocks, comprising: calculating average reflectivities of the reflection regions according to the reflectivities of the pixel blocks; and calculating expected exposure times of the reflection regions under the preset target gray value according to the average reflectivities of the reflection regions.

[0164] In one embodiment, the computer program, when executed by the processor, further implements the following steps: calculating the gray value of each reflection region according to the gray value of the image to be processed; calculating the difference between the preset target gray value and the gray value of each reflection region to obtain a second gray difference of each reflection region; calculating the ratio of the second gray difference of the reflection region to the average reflectivity of each reflection region to obtain a second exposure time increment; and adding the exposure time of the first frame of image to be processed to the second exposure time increment to obtain the expected exposure time of each reflection region.

[0165] In one embodiment, the computer program, when executed by the processor, further implements the following steps: randomly selecting a first number of initial cluster centers from the reflectivity of each pixel block; calculating a first distance of other reflectivity to the initial cluster center and performing first clustering according to the first distance to obtain an initial cluster; randomly selecting a second number of reference cluster centers for each initial cluster, calculating a second distance of other reflectivity in the initial cluster to the reference cluster center, and performing second clustering according to the second distance to obtain a reference cluster; calculating an evaluation value of the initial cluster and the reference cluster, and continuing the steps of first clustering and second clustering on the basis of the initial cluster or the reference cluster according to the evaluation value until the evaluation value reaches a convergence condition.

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

[0167] The technical features of the above embodiments can be combined in any manner. To make the description concise, all possible combinations of the technical features in the above embodiments are not described, but as long as the combinations of the technical features do not exist contradictions, they should be considered as the scope of the present application.

[0168] The above-described embodiments are merely illustrative of several embodiments of the present application, and the description is relatively specific and detailed, but should not be understood as a limitation on the scope of the patent. It should be noted that for those skilled in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are all within the scope of the present application. Therefore, the scope of protection of the present application should be subject to the appended claims.

Claims

1. An automatic exposure method characterized by, The method comprises: acquiring a plurality of frames of to-be-processed images under different exposure times; the to-be-processed images comprise a plurality of pixel blocks; calculating reflectivity of each pixel block by using a linear relationship between a gray value of each frame of to-be-processed images and the exposure time; calculating an expected exposure time of each pixel block under a preset target gray value based on the reflectivity of each pixel block.

2. The method of claim 1, wherein, The calculation of the reflectivity of each pixel block by using the linear relationship between the gray value of each frame of to-be-processed images and the exposure time comprises: calculating an average exposure time according to the exposure time of each frame of to-be-processed images; calculating an average gray value according to the gray value of each frame of to-be-processed images; performing linear regression based on the exposure time of each frame of to-be-processed images, the gray value of each frame of to-be-processed images, the average exposure time and the average gray value to calculate the reflectivity of each pixel block.

3. The method of claim 1, wherein, The calculation of the expected exposure time of each pixel block under the preset target gray value based on the reflectivity of each pixel block comprises: calculating a difference value between the preset target gray value and the gray value of each pixel block in the first frame of to-be-processed images to obtain a first gray difference of each pixel block; calculating a ratio between the first gray difference of each pixel block and the reflectivity of each pixel block to obtain a first exposure time increment; adding the exposure time of the first frame of to-be-processed images to the first exposure time increment to obtain the expected exposure time of each pixel block.

4. The method of claim 1, wherein, After the calculation of the reflectivity of each pixel block, the method further comprises: classifying the pixel blocks according to the reflectivity to obtain a plurality of types of reflection regions; The calculation of the expected exposure time of each pixel block under the preset target gray value based on the reflectivity of each pixel block comprises: calculating an average reflectivity of each reflection region according to the reflectivity of the pixel blocks; calculating the expected exposure time of each reflection region under the preset target gray value according to the average reflectivity of each reflection region.

5. The method of claim 4, wherein, The calculation of the expected exposure time of each reflection region under the preset target gray value according to the average reflectivity of each reflection region comprises: calculating a gray value of each reflection region according to the gray value of the to-be-processed images; calculating a second gray difference of each reflection region by calculating a difference value between the preset target gray value and the gray value of each reflection region; calculating a second exposure time increment by calculating a ratio between the second gray difference of each reflection region and the average reflectivity of each reflection region; adding the exposure time of the first frame of to-be-processed images to the second exposure time increment to obtain the expected exposure time of each reflection region.

6. The method of claim 4, wherein, The classification of the pixel blocks according to the reflectivity to obtain a plurality of types of reflection regions comprises: randomly selecting a first number of initial cluster centers from the reflectivity of each pixel block; calculating a first distance of other reflectivities to the initial cluster centers and performing first clustering according to the first distance to obtain initial clusters; For each of the initial clusters, a second number of reference cluster centers are randomly selected, and second distances of other reflectivities in the initial cluster to the reference cluster centers are calculated, and a second clustering is performed according to the second distances, to obtain reference clusters; An evaluation value of the initial cluster and the reference cluster is calculated, and the first clustering and the second clustering are continued based on the initial cluster or the reference cluster according to the evaluation value until the evaluation value reaches a convergence condition.

7. An automatic exposure device characterized by comprising: The apparatus comprises: An acquisition module configured to acquire a plurality of frames of to-be-processed images under different exposure times; the to-be-processed images comprise a plurality of pixel blocks; A reflectivity calculation module configured to calculate reflectivities of the pixel blocks by using a linear relationship between gray values of the to-be-processed images and the exposure times; An exposure time calculation module configured to calculate, based on the reflectivities of the pixel blocks, expected exposure times of the pixel blocks under a preset target gray value. 8.A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the computer device is configured to perform the method according to any one of claims 1-7. The processor, when executing the computer program, implements the steps of the method of any one of claims 1 to 6.

9. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program, when executed by the processor, implements the steps of the method of any one of claims 1 to 6.

10. A computer program product comprising a computer program, characterized in that, The computer program, when executed by the processor, implements the steps of the method of any one of claims 1 to 6.