A method, system, and medium for automatic exposure based on laser images
By weighted compensation of overexposed pixels in laser images, a grayscale index is constructed, and the exposure level is dynamically adjusted. This solves the problem of improper exposure adjustment in laser imaging, realizes stable exposure control and monotonicity of brightness evaluation in laser imaging systems, and is applicable to a variety of laser imaging systems.
Patent Information
- Application Number
- CN202511271876.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-08
- Publication Date
- 2025-12-26
- Estimated Expiration
- 2045-09-08
AI Technical Summary
Existing technologies cannot effectively solve the nonlinear relationship between exposure grayscale value and exposure level in laser imaging applications, leading to improper exposure adjustment step size settings, resulting in inconsistent brightness in laser imaging and affecting the accuracy of defocus calculation.
By weighted compensation of overexposed pixels in laser images, a grayscale index is constructed, and the exposure level is dynamically adjusted. The adjustment coefficient is calculated by using the ratio of the grayscale index to a preset range, thereby achieving rapid convergence of the exposure level.
It achieves stable and appropriate exposure control in laser imaging systems, ensuring the monotonicity of image brightness evaluation. It is suitable for exposure adjustment during fixed-shot and follow-focusing processes, and applicable to various scenarios such as microscopic focusing, spectral confocalization, and 3D laser imaging.
Smart Images

Figure CN120812407B_ABST
Abstract
Description
[0001] This invention relates to the field of image processing technology, and in particular to an automatic exposure method, system and medium based on laser images. Background Technology
[0002] Automatic exposure technology generally uses a fast adjustment algorithm based on the target imaging grayscale value of the image (or a region in the image) and the current imaging grayscale value to achieve relatively fast automatic exposure.
[0003] For example, Chinese patent CN104917976A discloses a method for automatic exposure and automatic gain adjustment of a camera. This patent calculates the exposure adjustment or gain adjustment required based on the difference between the average brightness value of the image and the target brightness value. The specific adjustment process is a multi-iteration process until the target brightness value is reached.
[0004] Alternatively, an ambient light sensor (such as a photoresistor) can be used to pre-calibrate multiple sets of ambient light intensity and exposure settings. In actual use, after the imaging device senses the ambient light brightness, it uses a lookup table mapping method to confirm the exposure settings and complete automatic exposure. For example, Chinese patent CN109361866B discloses an automatic exposure control method and system, which performs automatic exposure based on exposure parameters when the image sensor acquires images.
[0005] Due to the presence of natural light or industrial light sources in non-laser conventional scenarios, such as Figure 1 As shown, the relationship between exposure level and exposure grayscale value exists: in the application environment between dark field (assuming 8-bit, corresponding to 0DN) and exposure saturation (assuming 8-bit, corresponding to 255DN), the exposure level (x) and grayscale value (y) basically satisfy a linear relationship, which can be expressed as y=kx.
[0006] In conventional scenarios without lasers, such as natural light or industrial light sources, automatic exposure control can be achieved by adjusting the exposure level and changing the grayscale value of the image, relying on a simple linear relationship.
[0007] For example, Chinese patent CN115802169B discloses an automatic exposure method and terminal based on a brightness histogram. This patent uses the ratio of the target gray value to the current gray value as the basis for adjusting the exposure level. That is, according to the image layering of the gray histogram, the image blocks are divided into different layer types to improve the accuracy of the overall brightness estimation of the image and the robustness of the exposure adjustment.
[0008] The Chinese patent CN108551555B discloses an automatic exposure method of an industrial camera using a CMOS detector. In the case of fixed illumination, the linear relationship between the image gray value and the exposure level is measured to determine the mapping relationship between the exposure level and the image gray value, so as to realize the exposure time level adjustment.
[0009] The Chinese patent CN115174820B discloses a fast adjustment method for camera automatic exposure. According to the photoelectric model of image imaging, the exposure time and gain coefficient that the current image gray value should reach the target gray value are calculated to obtain the next frame of image.
[0010] The above method can meet the needs of most scenes, and the scene is usually a visible light scene. However, for laser imaging applications that require accurate control of fast exposure response, the above method cannot support. The main reasons are as follows:
[0011] Due to the concentration of laser energy, as shown in Figure 2 and Figure 3 , with the increase of exposure level, the growth rate of exposure gray value from dark field to exposure saturation is very fast.
[0012] In addition, in the laser image, the relationship between the exposure gray value and the exposure level is also related to the focusing distance, Figure 2 shows the relationship between the exposure gray value and the exposure level when the focus is near, Figure 3 shows the relationship between the exposure gray value and the exposure level when the focus is far.
[0013] As can be seen from the above, in laser imaging applications, the linear region between the exposure gray value and the exposure level shown by the laser image is small. Further, a fixed adjustment step cannot be set for the exposure level to realize automatic exposure control.
[0014] If the adjustment step of the exposure level is set too large, the exposure adjustment is easy to overshoot when the focus is near. Specifically, there may be no linear change process in the linear region, and the adjusted exposure gray value is 0 or 255, which cannot obtain an effective linear change process; there may also be a large difference between the exposure gray values after adjustment in the multiple adjustment process, which cannot converge.
[0015] If the adjustment step of the exposure level is set too small, the exposure adjustment speed is slow when the focus is far. Specifically, because the adjustment is not timely, there is no effective signal on the laser image, and without effective signal, the defocus amount cannot be calculated, which leads to the failure of the entire focusing system to work normally.
[0016] Because the appropriate adjustment step of the exposure level cannot be set, in the above two cases, the imaging of the laser image will appear bright and dark alternately, and in the laser imaging application, the stable and correct defocus amount cannot be obtained, which affects the normal use.
[0017] For exposure adjustment of laser images, Chinese patent CN 114095667 B discloses an automatic exposure method and device, electronic equipment and storage medium. The patent adjusts the position of the average brightness value within the preset brightness range, so that the exposure value approaches the exposure value suitable for the 3D laser camera image target brightness within a few frames. Then, fine tuning can make the average brightness of the image captured by the 3D laser camera closer to the target brightness value, and improve the visual effect of the image. The patent is different from the technical means of the present application. SUMMARY
[0018] The present application proposes an automatic exposure method, system and medium based on laser images, which at least solves one of the above technical problems.
[0019] To achieve the above purpose, the present application proposes the following technical solutions:
[0020] An automatic exposure method based on laser images, comprising:
[0021] Based on the average gray value of the laser image, the overexposed pixels in the laser image are weightedly compensated to obtain a gray value index of the laser image;
[0022] Wherein, the overexposed pixel is a pixel point in the laser image whose gray value is equal to the upper limit value;
[0023] If the gray value index does not fall within the preset gray range, calculate the adjustment coefficient; otherwise, the adjustment coefficient is zero;
[0024] Wherein, the adjustment coefficient is the product of the pixel distribution that does not satisfy the preset gray range, the exposure level function and the control parameter;
[0025] The exposure level function is proportional to the current exposure level, and the control parameter is used to control the adjustment degree of the adjustment coefficient;
[0026] According to the adjustment coefficient, the adjustment value of the current exposure level is calculated, so that the current exposure level is adjusted to the target exposure level, so as to obtain the effective laser image under the target exposure level.
[0027] Further, the gray value index of the laser image comprises:
[0028] The sum of the total number of non-overexposed pixels and the total weight of overexposed pixels in the laser image is taken as the gray value index of the laser image; wherein the gray value of the non-overexposed pixel is less than the upper limit value; the total weight of the overexposed pixel is greater than the total number of the overexposed pixel.
[0029] Further, the total weight of the overexposed pixel is the product of the total number of the overexposed pixel and the weight coefficient.
[0030] Further, the weight sum of the overexposed pixels is the product of the pixel sum of the overexposed pixels and the minimum value of the weight;
[0031] The minimum value of the weight is the ratio of the number of non-overexposed pixels to the number of overexposed pixels and the minimum value of the magnification factor.
[0032] Further, the gray value index of the laser image comprises:
[0033] The weight number of the overexposed pixels is calculated, and the product of the weight number and the average gray value of the laser image is taken as the compensation of the overexposed pixels; and the sum of the compensation of the overexposed pixels and the average gray value of the laser image is taken as the gray value index of the laser image.
[0034] Further, it comprises: if the gray value index is greater than the maximum value of the preset gray range, the ratio of the difference between the gray value of the current pixel point and the target gray value to the difference between the upper limit value and the target gray value is taken as the pixel distribution that does not meet the preset gray range; and the adjustment coefficient is calculated based on the pixel distribution that does not meet the preset gray range, the exposure step function and the control parameter.
[0035] Further, it comprises: if the gray value index is less than the minimum value of the preset gray range, the ratio of the difference between the gray value of the current pixel point and the target gray value to the target gray value is taken as the pixel distribution that does not meet the preset gray range; and the adjustment coefficient is calculated based on the pixel distribution that does not meet the preset gray range, the exposure step function and the control parameter.
[0036] Further, the exposure step function is a function relationship constructed by the ratio of the current exposure step and the maximum value of the exposure step; and the function relationship comprises a power function, an exponential function and a logarithmic function.
[0037] Based on the same inventive concept, the application further proposes an automatic exposure system, comprising:
[0038] The gray value index calculation module weights and compensates the overexposed pixels in the laser image to calculate the gray value index of the laser image; wherein the overexposed pixels are the pixel points with the gray value equal to the upper limit value;
[0039] The adjustment coefficient calculation module calculates the adjustment coefficient if the gray value index does not fall within the preset gray range; otherwise, the adjustment coefficient is zero; wherein the adjustment coefficient is the product of the pixel distribution that does not meet the preset gray range and the exposure step function and the control parameter;
[0040] The exposure step function is proportional to the current exposure step, and the control parameter is used to control the adjustment degree of the adjustment coefficient.
[0041] The exposure level adjustment module calculates an adjustment value of the current exposure level according to the adjustment coefficient, so that the current exposure level is adjusted to the target exposure level, and an effective laser image under the target exposure level is obtained.
[0042] In another aspect, the application also provides a computer readable storage medium storing a computer program, which, when executed by a processor, causes the processor to perform the method described above.
[0043] The beneficial effects of the embodiments of the application are as follows:
[0044] The embodiments consider that the proportion of overexposed pixels in the laser image decreases with the increase of the exposure level, resulting in the decrease of the average gray value of the laser image with the increase of the exposure level, that is, the average gray value of the laser image and the exposure level do not have monotonicity, so the application constructs a calculation formula of the gray value index of the laser image as the luminance evaluation index of the laser image by weighting compensation of the overexposed pixels.
[0045] The embodiments construct the calculation formula of the gray value index from two ways of the weight sum of the weighted compensation of the overexposed pixels and the weight compensation of the number of overexposed pixels.
[0046] Meanwhile, in the compensation of the weight sum of the overexposed pixels, to avoid that the weight sum of the overexposed pixels is compensated too high, on the basis of the weight compensation of the pixel sum of the overexposed pixels, the truncation judgment of the weight coefficient is added, so that the weight sum of the overexposed pixels is controlled within an effective range, and the monotonicity of the gray value index is ensured.
[0047] In order to ensure that the laser imaging system can obtain stable and properly exposed laser images, the embodiments provide an automatic exposure method based on a laser image, according to the size relationship between the gray value index and the preset gray range, a dynamic adjustment strategy is set, the exposure level is adjusted, the gray value index is quickly converged to the vicinity of the target gray value, and an effective laser image under the target exposure level is obtained.
[0048] The embodiments calculate the adjustment coefficient by the product of the pixel distribution not meeting the preset gray range, the exposure level function and the control parameter. According to the size relationship between the gray value index and the preset gray range, the pixel distribution not meeting the preset gray range is determined, and the dynamic change of the adjustment coefficient is controlled. Combined with the specific value of the artificially adjusted control parameter, the dynamic change of the adjustment coefficient is realized to adapt to the needs of different application scenarios.
[0049] The automatic exposure method provided by the embodiments is suitable for exposure adjustment of still shooting (the measured object does not move relatively), and can also be used for exposure adjustment in the process of following focus (the measured object moves relatively), and has universal adaptability.
[0050] In addition, the embodiment is applicable to a laser imaging system, and is not limited to a microscopic focusing system, a spectral confocal system and a 3D laser imaging system, and can be adapted to application scenarios of various laser forms such as a point laser, a multi-point laser and a line laser. BRIEF DESCRIPTION OF DRAWINGS
[0051] Figure 1 is a curve diagram of exposure gray value-exposure step in a non-laser image;
[0052] Figure 2 is a curve diagram of exposure gray value-exposure step in a laser image at a near focus;
[0053] Figure 3 is a curve diagram of exposure gray value-exposure step in a laser image at a far focus;
[0054] Figure 4 is a laser image of a microscopic focusing system at different steps;
[0055] Figure 5 is Figure 4 a curve diagram of a proportion of overexposed pixels in a laser image-exposure step;
[0056] Figure 6 is Figure 4 a curve diagram of a mean gray value in a laser image-exposure step;
[0057] Figure 7 is a flowchart of an automatic exposure method in the embodiment;
[0058] Figure 8 is a flowchart of an automatic exposure adjustment strategy in the embodiment;
[0059] Figure 9 is a curve diagram of an exposure step-gray value index in a focusing state in the embodiment. DETAILED DESCRIPTION
[0060] To make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application.
[0061] According to the background art, the automatic exposure control of a laser image and the exposure control of a non-laser image are different because of the concentration of laser energy, so that the linear region between the exposure gray value and the exposure step in a laser image is greatly reduced compared with a non-laser image; meanwhile, the relationship between the exposure gray value and the exposure step in a laser image is also affected by the focusing distance. Therefore, in laser imaging, the exposure control cannot be adjusted depending on the linear relationship between the exposure gray value and the exposure step.
[0062] In the automatic exposure control, in order to formulate a reasonable exposure strategy, it is necessary to accurately evaluate the image brightness, that is, to establish a reasonable gray value index.
[0063] In the prior art, in the application scenario of non-laser imaging, the average brightness value (average gray value) of the acquired image is taken as the exposure gray index.
[0064] Taking the average gray value as the exposure gray index is not suitable for the brightness evaluation of laser images.
[0065] The reason is that laser energy is concentrated, and overexposure (for example, 8-bit image, overexposed pixel is 255 DN) is easy to occur in the central region of the laser image.
[0066] The present embodiment provides data analysis that the average gray value is not suitable for the brightness evaluation of laser images, as follows:
[0067] The laser imaging system can be a microscopic focusing system, a spectral confocal system, or a 3D laser system. The analysis process and exposure adjustment strategy provided in the present embodiment are applicable to the above-mentioned laser imaging systems.
[0068] Taking a microscopic automatic focusing system as an example, Figure 4 laser images corresponding to different exposure positions (exposure positions are 200, 400, 600, and 800, respectively) are shown.
[0069] Based on the laser images of the above-mentioned different positions, as shown in Figure 5 , the proportion of overexposed pixels in the laser image increases with the increase of the exposure position, showing a trend of first increasing and then decreasing.
[0070] The overexposed pixel is a pixel point with a pixel value equal to the upper limit value.
[0071] Taking an 8-bit image as an example, the overexposed pixel is a pixel point with a gray value equal to 255. Then the proportion of overexposed pixels is the ratio of the number of pixel points with a pixel value of 255 to the total number of pixels in the laser image.
[0072] Among them, the increase of the exposure position specifically represents the increase of the laser intensity or the increase of the sensor exposure time.
[0073] Based on the laser images of the above-mentioned different positions, as shown in Figure 6 , the average gray value of the image increases first and then decreases with the increase of the exposure position, which means that the average gray value (average brightness value) of the image does not have monotonicity in the application of laser imaging.
[0074] In non-laser imaging, the main reason for using average gray value as the brightness evaluation index is that in non-laser images, the average gray value of the image increases with the increase of the exposure level, that is, it has a monotonic increase.
[0075] If the average gray value of the laser image is used as the brightness evaluation index, the average gray value corresponding to the laser image with a large exposure level is smaller than the average gray value corresponding to the laser image with a small exposure level, so that during exposure adjustment, the exposure level will be continuously increased until the maximum exposure level is reached, at which time the laser image is completely overexposed, affecting the accuracy of the defocus amount calculation.
[0076] In summary, the average gray value is not suitable for brightness evaluation of laser images.
[0077] Therefore, it is necessary to design a suitable brightness evaluation index (gray value index) for laser images according to their characteristics, that is, the brightness evaluation index has monotonicity.
[0078] In the prior art, based on the average brightness value, in order to further overcome the brightness difference of different regions and offset the influence of local strong light or dark part, a partitioned brightness evaluation is adopted, and then a weighted sum is obtained to obtain the overall evaluation.
[0079] For example, Chinese patent CN112689097A uses Gaussian coefficients and gray weight numbers to perform convolution calculation to obtain the current brightness evaluation value; CN110505402A divides the speckle pattern into multiple regions and calculates the brightness average value of each region; or as in patent CN114095667B, only the maximum brightness value in the laser and the values near it are selected to be averaged to obtain the current brightness value, to obtain a brightness evaluation index suitable for laser images. The above patents and the technical means of the present application are different.
[0080] As shown in Figure 7 To ensure that the laser imaging system can obtain stable and properly exposed laser images, the present application proposes an automatic exposure method based on laser images, which can quickly converge the exposure level to the target gray value through a dynamic adjustment strategy.
[0081] Specifically as follows:
[0082] Based on the average gray value of the laser image, the overexposed pixels in the laser image are weightedly compensated to obtain the gray value index of the laser image.
[0083] Among them, the overexposed pixel is a pixel point in the laser image whose gray value is equal to the upper limit value.
[0084] Taking an 8-bit laser image as an example, the upper limit value of its gray value is 255, that is, the pixel point with a gray value of 255 is an overexposed pixel.
[0085] Similarly, the gray value of the overexposed pixel in the 16-bit image is (2 16 -1) DN. Preferably, other format sizes of laser images can also be used to obtain their corresponding upper limit values.
[0086] In the laser image I obtained in this embodiment, the height is H and the width is W, that is, the height of the laser image I has H pixel points and the width has W pixel points.
[0087] The classical calculation formula of the average gray value avg is:
[0088]
[0089] In the formula, ∑I represents the total sum of the gray values of all pixel points in the laser image, and HxW represents the total sum of the pixel points.
[0090] This embodiment considers that the proportion of overexposed pixels in the laser image decreases as the exposure level increases, resulting in a decrease in the average gray value of the laser image as the exposure level increases, that is, the average gray value of the laser image and the exposure level do not have monotonicity, so the present application compensates for the overexposed pixels by weighting to construct the calculation formula of the gray value index of the laser image.
[0091] In this embodiment, the set of non-overexposed pixels of the laser image is S1, the set of overexposed pixels is S2, there are N1 non-overexposed pixels in S1, and there are N2 overexposed pixels in S2.
[0092] The classical calculation formula of the average gray value avg can also be represented as:
[0093]
[0094] In the formula, sum(S1) represents the total sum of the gray values of the pixels in the set S1 of non-overexposed pixels, that is, the total sum of the pixels of non-overexposed pixels; sum(S2) represents the total sum of the gray values of the pixels in the set S2 of overexposed pixels, that is, the total sum of the pixels of overexposed pixels.
[0095] Preferably, the gray value index of the laser image comprises:
[0096] The sum of the total sum of the pixels of non-overexposed pixels and the total sum of the weights of overexposed pixels in the laser image is taken as the gray value index of the laser image, wherein the gray value of the non-overexposed pixel is less than the upper limit value; the total sum of the weights of the overexposed pixels is greater than the total sum of the pixels of the overexposed pixels.
[0097] Preferably, the total sum of the weights of the overexposed pixels is the product of the total sum of the pixels of the overexposed pixels and the weight coefficient.
[0098] Therefore, in this embodiment, the calculation formula of the gray value index V is:
[0099]
[0100] In the formula, R1 is a weight coefficient; "sum(S2)×R1" represents the weight sum of overexposed pixels, and because R1>1, the weight sum of overexposed pixels is greater than the pixel sum of overexposed pixels, that is, sum(S2)×R1>sum(S2).
[0101] In the formula, R1 is obtained according to experiments, so that the gray value index V has monotonicity.
[0102] A plurality of laser images of different defocus amounts and multiple exposure levels are collected, the gray value index of the laser image of each exposure level is calculated according to the calculation formula of the gray value index V, and the size of the weight coefficient R1 is adjusted so that the gray value index increases with the increase of the exposure level under each defocus amount, that is, the gray value index V has monotonicity; and then the specific value of the weight coefficient R1 is determined.
[0103] Preferably, the different defocus amounts include at least three focusing situations, that is, focusing (defocus amount is 0), near focusing and far focusing.
[0104] Preferably, in some specific application scenarios, if the adjustment of the weight coefficient R1 cannot make the gray value index-exposure level curve corresponding to different defocus amounts present an increasing trend, the gray value index-exposure level curve under the near focusing situation is preferred to present an increasing trend.
[0105] The embodiment considers only the weight compensation of the pixel sum of overexposed pixels on the basis of calculating the weight sum of overexposed pixels, and it is possible that the weight compensation of the pixel sum of overexposed pixels is too high in any laser imaging system, which leads to the failure of the convergence of the gray value index and the final failure of the calculation of the defocus amount.
[0106] Therefore, the embodiment increases the truncation judgment of the weight coefficient on the basis of the weight compensation of the pixel sum of overexposed pixels, so that the weight sum of overexposed pixels is controlled within an effective range, and the monotonicity of the gray value index is ensured.
[0107] Preferably, the weight sum of overexposed pixels is the product of the pixel sum of overexposed pixels and the minimum weight value; the minimum weight value is the ratio of the number of non-overexposed pixels to the number of overexposed pixels and the minimum magnification coefficient.
[0108] Therefore, in the embodiment, the calculation formula of the gray value index V is:
[0109]
[0110] In the formula, R2 is a magnification coefficient, and R2>1. R2 is obtained according to experiments, so that the gray value index V has monotonicity.
[0111] The method for obtaining R2 is the same as that for R1.
[0112] Preferably, in addition to the above two adjustments to the total weight of overexposed pixels, this embodiment also proposes a weight compensation method for the number of overexposed pixels, so that the grayscale value index has monotonicity.
[0113] Preferably, the grayscale index of the laser image includes:
[0114] The weighted number of overexposed pixels is calculated, and the product of the weighted number and the average gray value of the laser image is used as the compensation for the overexposed pixels. The sum of the compensation for the overexposed pixels and the average gray value of the laser image is used as the gray value index of the laser image.
[0115] In this embodiment, the formula for calculating the grayscale value index V is:
[0116]
[0117] In the formula, This represents the weight of overexposed pixels, and the compensation for overexposed pixels is... .
[0118] R3 is the weight compensation coefficient, which is obtained experimentally to make the gray value index V monotonic. The method of obtaining R3 is the same as that of R1.
[0119] like Figure 8 As shown, by calculating the grayscale value index V of the laser image, it is possible to simply determine whether the exposure level Q corresponding to the laser image is reasonable. This application sets a preset grayscale range of T±dT based on the target grayscale value T, where dT represents the allowable error.
[0120] If the grayscale value does not fall within the preset grayscale range, the adjustment coefficient is calculated; otherwise, the adjustment coefficient is zero.
[0121] Specific situations where the grayscale value does not fall within the preset grayscale range include:
[0122] If the grayscale value index is greater than the maximum value of the preset grayscale range, the ratio of the difference between the current pixel's grayscale value and the target grayscale value in the difference between the upper limit and the target grayscale value is used as the pixel distribution that does not meet the preset grayscale range.
[0123] When V > T + dT, it means that the grayscale value of the current laser image is greater than the target grayscale value, indicating that the current laser image is overexposed. This serves as the basic adjustment ratio for reducing exposure, specifically the pixel distribution that does not meet the preset grayscale range. Where P... max This represents the upper limit of the current laser image.
[0124] Taking an 8-bit image as an example, P max = 255, that is, when V > T + dT, the pixel distribution not satisfying the preset gray range is obtained. When V > T + dT, the pixel distribution not satisfying the preset gray range is obtained.
[0125] Preferably, if the image format is of other sizes, the pixel distribution not satisfying the preset gray range when V > T + dT in the image is obtained with a corresponding upper limit value.
[0126] If the gray value index is less than the minimum value of the preset gray range, the ratio of the difference between the gray value of the current pixel and the target gray value to the target gray value is taken as the pixel distribution not satisfying the preset gray range.
[0127] That is, when V < T + dT, it is indicated that the gray value index of the current laser image is less than the target gray value, that is, the current laser image is in an underexposed state, and (T-V) / T is taken as the basic adjustment proportion of increasing exposure, that is, the pixel distribution not satisfying the preset gray range.
[0128] Based on the pixel distribution not satisfying the preset gray range, the exposure level function, and the control parameter, the adjustment coefficient is calculated.
[0129] The adjustment coefficient is the product of the pixel distribution not satisfying the preset gray range, the exposure level function, and the control parameter.
[0130] The exposure level function is proportional to the current exposure level, and the control parameter is used to control the adjustment degree of the adjustment coefficient.
[0131] When V > T + dT, the adjustment coefficient .
[0132] When V < T + dT, the adjustment coefficient .
[0133] In the formula, f(Q) represents the exposure level function, and f(Q) is an increasing function with respect to the exposure level Q corresponding to the current laser image, that is, f(Q) increases with the increase of the exposure level, so that the adjustment coefficient r increases with the increase of the exposure level.
[0134] In this embodiment, the value range of f(Q) is [0, 1].
[0135] In this embodiment, the exposure level function is a function relationship constructed by the ratio of the current exposure level to the maximum exposure level. The function relationship includes a power function, an exponential function, and a logarithmic function.
[0136] This embodiment provides several forms of f(Q), such as ; in the formula, Q max is the maximum exposure level; and the function adjustment coefficient γ is used to adjust the nonlinear change of f(Q).
[0137] In addition to the above example content of the power function, f(Q) can also be constructed to have a logarithmic function relationship, such as In this embodiment, the specific value of the base of the logarithmic function is not limited, and the specific value of the base of the logarithmic function can be determined according to the laser image obtained according to the actual application scenario.
[0138] In addition, an exponential function relationship can also be constructed, such as .
[0139] In the calculation formula of the adjustment coefficient r, when V>T+dT, the control parameter is A; when V<T+dT, the control parameter is B.
[0140] In this embodiment, the value range of the control parameters A and B is [0, 1]. The control parameter A is used to control the decrease of the exposure level, and the control parameter B is used to control the increase of the exposure level.
[0141] The greater the values of the control parameters A and B, the greater the adjustment range of the adjustment coefficient, but excessively high exposure level adjustment will cause oscillation of the gray value. The smaller the values of the control parameters A and B, the smaller the adjustment degree of the adjustment coefficient, and the number of adjustments needs to be increased to make the gray value index V of the laser image tend to the target gray value T. Therefore, according to the actual situation, reasonable control parameters need to be set to realize rapid adjustment of the exposure level.
[0142] As shown in Figure 9 , this embodiment takes the laser images obtained at different levels in the focus state (defocus amount zpos=0) as an example to illustrate the acquisition process of the control parameters.
[0143] Figure 9 The curve relationship between the exposure level and the gray value index is shown.
[0144] When the exposure level Q=190, the gray value index V is basically saturated and gradually tends to be stable. The target gray value T is set to 150, and the corresponding target exposure level is 160; and the control parameter A=(190-160) / 190=0.16.
[0145] When the exposure level Q=110, the gray value index V=30, and the target gray value T is set to 150, and the corresponding target exposure level is 160; and the control parameter B=0.5×(160-110) / 110=0.23.
[0146] Since the exposure Q = 110 is in the linear region of the gray value index, the slope of the linear region increases with the increase of the exposure, that is, the change degree of the gray value index is larger, in order to control the overshoot phenomenon of the gray value index adjustment, therefore, the proportional coefficient needs to be set when calculating the control parameter in the linear region to control the growth degree.
[0147] The embodiment only provides a calculation example of the control parameters A and B, and the change degree of the gray value index caused by the size of the exposure is different, therefore, different control parameters are set according to different exposures.
[0148] Preferably, the best control parameter in the current focusing state can also be determined according to the near-focusing priority principle.
[0149] Preferably, the near-focusing priority principle can be embodied as that only the control parameter of the near-focusing state is used in the control parameters of the multiple focusing states of the exposure.
[0150] Or the control parameters of the multiple focusing states of the exposure are weighted calculated, wherein the weight of the control parameter corresponding to the near-focusing state is the largest, so as to obtain the best control parameter in the current focusing state.
[0151] According to the adjustment coefficient, the adjustment value of the current exposure is calculated, so that the current exposure is adjusted to the target exposure, so as to obtain the effective laser image under the target exposure.
[0152] According to the adjustment coefficient r, the adjustment value dQ = Q x r of the exposure is calculated, and the target exposure Q next = Q + dQ.
[0153] According to the target exposure obtained by calculation, the exposure in the current mapping scene is adjusted, so as to obtain the effective laser image under the target exposure.
[0154] Preferably, the adjustment mode of the exposure in the embodiment is not limited, and the adjustment of the exposure can be realized by adjusting one or more combinations of the exposure time, the emission energy of the laser, the digital / analog gain of the mapping device and the lens aperture.
[0155] Based on the same inventive concept, the application also provides an automatic exposure system, comprising:
[0156] A gray value index calculation module, which weights and compensates the overexposed pixels in the laser image, calculates the gray value index of the laser image; wherein the overexposed pixels are the pixel points with the gray value equal to the upper limit value;
[0157] The adjusting coefficient calculation module calculates the adjusting coefficient if the gray value index does not fall into the preset gray range, otherwise the adjusting coefficient is zero; wherein the adjusting coefficient is the product of the pixel distribution not satisfying the preset gray range, the exposure level function and the control parameter;
[0158] The exposure level function is proportional to the current exposure level, and the control parameter is used to control the adjusting degree of the adjusting coefficient;
[0159] The exposure level adjusting module calculates the adjusting value of the current exposure level according to the adjusting coefficient, so that the current exposure level is adjusted to the target exposure level to obtain the effective laser image under the target exposure level.
[0160] Based on the same inventive concept, the application further provides a computer readable storage medium comprising a computer program, wherein the computer program is executed by a processor to implement the method described above.
[0161] 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 contradict, they should be considered within the scope of the present disclosure.
[0162] The above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method of automatic exposure based on laser image, characterized in that, The method comprises the following steps: Based on the average gray value of the laser image, the pixel sum of the overexposed pixels in the laser image is weightedly compensated or the number of the overexposed pixels in the laser image is weightedly compensated to obtain a gray value index of the laser image; Wherein, the overexposed pixel is a pixel point in the laser image whose gray value is equal to the upper limit value; If the gray value index does not fall within the preset gray range, an adjustment coefficient is calculated; otherwise, the adjustment coefficient is zero; Wherein, the adjustment coefficient is the product of the pixel distribution not satisfying the preset gray range and the exposure level function and the control parameter; If the gray value index is greater than the maximum value of the preset gray range, the ratio of the difference between the gray value of the current pixel point and the target gray value to the difference between the upper limit value and the target gray value is taken as the pixel distribution not satisfying the preset gray range; If the gray value index is less than the minimum value of the preset gray range, the ratio of the difference between the gray value of the current pixel point and the target gray value to the target gray value is taken as the pixel distribution not satisfying the preset gray range; The exposure level function is directly proportional to the current exposure level, and the control parameter is used to control the adjustment degree of the adjustment coefficient; According to the adjustment coefficient, the adjustment value of the current exposure level is calculated to adjust the current exposure level to a target exposure level, so as to obtain an effective laser image under the target exposure level.
2. The automatic exposure method according to claim 1, characterized by, The gray value index of the laser image comprises: The ratio of the sum of the pixel sum of the non-overexposed pixels in the laser image and the weight sum of the overexposed pixels to the total number of pixels is taken as the gray value index of the laser image; wherein, the gray value of the non-overexposed pixel is less than the upper limit value; the weight sum of the overexposed pixel is greater than the pixel sum of the overexposed pixel; The weight sum of the overexposed pixel is the product of the pixel sum of the overexposed pixel and the weight coefficient; Or, the weight sum of the overexposed pixel is the product of the pixel sum of the overexposed pixel and the minimum weight value; the ratio of the number of non-overexposed pixels to the number of overexposed pixels is the minimum weight value.
3. The automatic exposure method according to claim 1, characterized by, The gray value index of the laser image comprises: The weight number of the overexposed pixel is calculated, and the product of the weight number and the average gray value of the laser image is taken as the compensation of the overexposed pixel; the sum of the compensation of the overexposed pixel and the average gray value of the laser image is taken as the gray value index of the laser image.
4. The automatic exposure method according to claim 1, characterized by, The exposure level function is a function relationship constructed by the ratio of the current exposure level to the maximum value of the exposure level; the function relationship includes power function, exponential function and logarithmic function.
5. An automatic exposure system characterized by comprising: The method comprises the following steps: The gray value index calculation module obtains the gray value index of the laser image by weightingly compensating the pixel sum of the overexposed pixels in the laser image or weightingly compensating the number of the overexposed pixels in the laser image based on the average gray value of the laser image; wherein, the overexposed pixel is a pixel point whose gray value is equal to the upper limit value; The adjustment coefficient calculation module calculates the adjustment coefficient if the gray value index does not fall within the preset gray range; otherwise, the adjustment coefficient is zero; wherein, the adjustment coefficient is the product of the pixel distribution not satisfying the preset gray range and the exposure level function and the control parameter; The exposure level function is directly proportional to the current exposure level, and the control parameter is used to control the adjustment degree of the adjustment coefficient; If the gray value index is greater than the maximum value of the preset gray range, a ratio of the difference between the gray value of the current pixel point and the target gray value in the difference between the upper limit value and the target gray value is taken as the pixel distribution not satisfying the preset gray range; If the gray value index is less than the minimum value of the preset gray range, a ratio of the difference between the gray value of the current pixel point and the target gray value to the target gray value is taken as the pixel distribution not satisfying the preset gray range; The exposure aperture adjustment module calculates an adjustment value of the current exposure aperture according to the adjustment coefficient, so that the current exposure aperture is adjusted to the target exposure aperture, to obtain an effective laser image under the target exposure aperture. 6.A computer readable storage medium comprising a computer program, wherein the computer program is executed by a processor to implement the automatic exposure method according to any one of claims 1-4.
Citation Information
Patent Citations
Camera automatic shutter and automatic gain adjustment method
CN104917976A
An automatic exposure method for industrial cameras using CMOS detectors
CN108551555B
An automatic exposure control method and system
CN109361866B
Control method, depth camera and electronic device
CN110505402A
Line laser automatic brightness control method and system and storage medium
CN112689097A