Automatic exposure method, device, equipment, storage medium and program product
By extracting the spot features and ambient light intensity of line structured light images and adjusting exposure parameters in combination with preset thresholds, the shortcomings of exposure control in line structured light measurement are solved, achieving higher precision and environmentally adaptive automatic exposure effects.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHEJIANG SUNNY INTELLIGENT OPTICAL TECH CO LTD
- Filing Date
- 2024-10-21
- Publication Date
- 2026-04-21
AI Technical Summary
In existing technologies, the line structured light three-dimensional measurement method has shortcomings in terms of projecting appropriate light and controlling exposure, which affects the measurement accuracy and adaptability.
By extracting the spot features and ambient light brightness from the initial line structured light image, the automatic exposure parameters and line structured light intensity are adjusted using preset thresholds. Different preset thresholds are set according to different distance ranges, and the exposure is controlled by combining the spot width, brightness, and halo width.
It improves the accuracy of exposure control and enhances the adaptability of automatic exposure, thereby improving measurement results in various environments and distance scenarios.
Smart Images

Figure CN121908143A_ABST
Abstract
Description
Technical Field
[0001] The embodiments disclosed herein relate to the field of robotics, and more particularly to an automatic exposure method, an automatic exposure apparatus, a line structured light measurement device, an electronic device, a computer-readable storage medium, and a computer program product. Background Technology
[0002] Line structured light, a commonly used non-contact 3D measurement method, has been widely applied in service robots such as sweeping robots and delivery robots, as well as industrial robots. The line structured light measurement device is based on the principle of triangulation. A projector projects a linear light beam onto the object being measured, and a camera captures the object at a specific angle, recording the deformation information of the light beam on the object. The captured images are then analyzed to convert this deformation information into the 3D information of the object.
[0003] In online structured light 3D measurement, the control of exposure plays a key role in how to project appropriate light and obtain appropriate images. Summary of the Invention
[0004] The automatic exposure method, apparatus, device, storage medium, and program product provided by the embodiments of this disclosure can solve or partially solve the above-mentioned deficiencies or other deficiencies in the prior art.
[0005] According to a first aspect of this disclosure, an automatic exposure method is provided, comprising: extracting spot features and ambient light intensity from an initial line structured light image, wherein the spot features include: spot width, spot brightness, and halo width; and determining automatic exposure parameters or line structured light intensity of a target line structured light image based on the spot features and the ambient light intensity and a preset threshold, wherein different preset thresholds are set according to different distance ranges in the working distance of the line structured light.
[0006] In one embodiment of this disclosure, the step of extracting the spot features and ambient light intensity from the initial line structured light image includes: acquiring a first frame image with the line structured light turned on and a second frame image with the line structured light turned off to obtain the initial line structured light image; removing ambient light from the first frame image based on the second frame image to obtain a pure structured light image; and extracting the spot width based on the pure structured light image, extracting the spot intensity and the halo width based on the first frame image, and extracting the ambient light intensity based on the second image.
[0007] In one embodiment of this disclosure, the step of extracting the spot width based on the pure structured light image includes: determining regions in the pure structured light image with gray values greater than a first gray value as effective light regions; counting the number of pixels in each column of the effective light regions in a direction perpendicular to the extension direction of the line structured light to obtain an effective light width array; sorting each column in the effective light width array in descending order of the number of pixels, and selecting the column number with a sorting number less than a first number as the target column number; and determining the spot width based on the average number of pixels in the target column number in the effective light width array.
[0008] In one embodiment of this disclosure, the step of counting the number of pixels in each column of the effective light region in a direction perpendicular to the extension direction of the line structured light to obtain an effective light beam width array includes: counting the number of pixels in each column of the effective light region belonging to at least two gray value intervals in a preset gray value interval in a direction perpendicular to the extension direction of the line structured light to obtain the effective light beam width array; the step of determining the spot width based on the average number of pixels in the target column number in the effective light beam width array includes: determining the average number of pixels in the target column number in the effective light beam width array to obtain an average effective linewidth; and determining the average number of pixels in the target column number of the effective light beam width array belonging to at least one gray value interval based on the average effective linewidth and a preset linewidth threshold, as the spot width.
[0009] In one embodiment of this disclosure, determining the average number of pixels belonging to at least one grayscale value interval in the target column of the effective ray width array as the spot width includes: in response to the average effective linewidth being greater than a first preset linewidth threshold, determining the average number of pixels belonging to a first grayscale value interval in the target column of the effective ray width array as the spot width; in response to the average effective linewidth being less than or equal to the first preset linewidth threshold and greater than a second preset linewidth threshold, determining the average number of pixels belonging to a first grayscale value interval and a second grayscale value interval in the target column of the effective ray width array as the spot width; and in response to the average effective linewidth being less than or equal to a preset second linewidth threshold, determining the average number of pixels belonging to a first grayscale value interval, a second grayscale value interval, and a third grayscale value interval in the target column of the effective ray width array as the spot width.
[0010] In one embodiment of this disclosure, the step of extracting the spot brightness and the halo width based on the first frame image includes: in the region corresponding to the effective light region in the first frame image, counting the maximum grayscale value of each column in a direction perpendicular to the extension direction of the line structured light to obtain a maximum grayscale value array; determining the average value of the maximum grayscale value of the target column number in the maximum grayscale value array as the spot brightness; in the region corresponding to the effective light region in the first frame image, counting the number of pixels in each column of the target column number that belong to the target grayscale value range in a direction perpendicular to the extension direction of the line structured light, and determining the average value of the number of pixels as the halo width.
[0011] In one embodiment of this disclosure, the ambient light brightness includes: average background brightness; the step of extracting the ambient light intensity based on the second frame image includes: in the region corresponding to the effective light region in the second frame image, calculating the average gray value of each column in a direction perpendicular to the extension direction of the line structured light to obtain a background average gray value array; determining the average value of the average gray value of the target column number in the background average gray value array as the average background brightness.
[0012] In one embodiment of this disclosure, determining the automatic exposure parameters or line structured light intensity of the target line structured light image based on the light spot features and the ambient light brightness and a preset threshold includes: determining whether the average background brightness is less than a first preset background grayscale threshold; in response to the average background brightness being less than the first preset background grayscale threshold, determining the automatic exposure parameters or line structured light intensity of the target line structured light image based on the light spot features; and in response to the average background brightness being greater than or equal to the first preset background grayscale threshold, determining the automatic exposure parameters or line structured light intensity of the target line structured light image based on the ambient light intensity.
[0013] In one embodiment of this disclosure, determining the automatic exposure parameters or line structured light intensity of the target line structured light image based on the spot characteristics includes: determining whether the spot width is within a first preset threshold range; in response to the spot width being within the first preset threshold range, determining whether the spot brightness is within a second preset threshold range; in response to the spot brightness being within the second preset threshold range, determining whether the halo width is within a third preset threshold range; and in response to the halo width being within the third preset threshold range, using the automatic exposure parameters and line structured light intensity of the initial line structured light image as the automatic exposure parameters and line structured light intensity of the target line structured light image.
[0014] In one embodiment of this disclosure, determining the automatic exposure parameters or line structured light intensity of the target line structured light image based on the spot characteristics further includes: adjusting the automatic exposure parameters to decrease image brightness or adjusting the line structured light intensity to increase image brightness in response to the spot width not being within a first preset threshold range; adjusting the line structured light intensity to increase image brightness in response to the spot brightness not being within a second preset threshold range; and adjusting the automatic exposure parameters to decrease image brightness in response to the halo width not being within a third preset threshold range.
[0015] In one embodiment of this disclosure, the step of adjusting the automatic exposure parameters to reduce image brightness or adjusting the line structured light intensity to increase image brightness in response to the spot width not being within a first preset threshold range includes: adjusting the line structured light intensity to increase image brightness in response to the spot width being less than a first preset spot width threshold, thereby obtaining the line structured light intensity of the target line structured light image; adjusting the automatic exposure parameters to reduce image brightness in response to the spot width being greater than or equal to a second preset spot width threshold, thereby obtaining the automatic exposure parameters of the target line structured light image; the step of adjusting the line structured light intensity to increase image brightness in response to the spot brightness not being within a second preset threshold range includes: adjusting the line structured light intensity to increase image brightness in response to the spot brightness being less than a preset spot grayscale threshold, thereby obtaining the line structured light intensity of the target line structured light image; the step of adjusting the automatic exposure parameters to reduce image brightness in response to the halo width not being within a third preset threshold range includes: adjusting the automatic exposure parameters to reduce image brightness in response to the halo width being greater than a preset halo width threshold, thereby obtaining the automatic exposure parameters of the target line structured light image.
[0016] In one embodiment of this disclosure, determining the automatic exposure parameters or line structure light intensity of the target line structure light image based on the spot features further includes: determining the line structure light working distance range corresponding to the spot width of the initial line structure light image and the preset threshold corresponding to the distance range based on the pre-calibrated correspondence between the spot width, distance range and preset threshold, wherein the preset threshold includes: a preset halo width threshold, a first preset spot width threshold and a second preset spot width threshold.
[0017] In one embodiment of this disclosure, the ambient light brightness further includes: maximum background brightness; the step of extracting the ambient light intensity based on the second frame image further includes: in the region corresponding to the effective light region in the second frame image, counting the maximum grayscale value of each column in the target column number in a direction perpendicular to the extension direction of the line structured light, and determining the average value of the maximum grayscale value as the maximum background brightness.
[0018] In one embodiment of this disclosure, determining the automatic exposure parameters or line structured light intensity of the target line structured light image based on the ambient light intensity includes: determining whether the average background brightness is within a fourth preset threshold range; in response to the average background brightness being within the fourth preset threshold range, determining whether the maximum background brightness is within a fifth preset threshold range; and in response to the maximum background brightness being within the fifth preset threshold range, using the automatic exposure parameters and line structured light intensity of the initial line structured light image as the automatic exposure parameters and line structured light intensity of the target line structured light image.
[0019] In one embodiment of this disclosure, determining the automatic exposure parameters or line structure light intensity of the target line structure light image based on the ambient light intensity further includes: adjusting the automatic exposure parameters to reduce image brightness in response to the average background brightness not being within a fourth preset threshold range; and adjusting the automatic exposure parameters to reduce image brightness or adjusting the line structure light intensity to increase image brightness in response to the maximum background brightness not being within a fifth preset threshold range.
[0020] In one embodiment of this disclosure, the step of adjusting the automatic exposure parameters to reduce image brightness in response to the average background brightness not being within a fourth preset threshold range further includes: adjusting the automatic exposure parameters to reduce image brightness in response to the average background brightness being greater than or equal to a second preset background grayscale threshold, thereby obtaining the automatic exposure parameters of the target line structured light image; the step of adjusting the automatic exposure parameters to reduce image brightness or adjusting the line structured light intensity to increase image brightness in response to the maximum background brightness not being within a fifth preset threshold range includes: adjusting the line structured light intensity to increase image brightness in response to the maximum background brightness being less than a first preset maximum background grayscale threshold, thereby obtaining the line structured light intensity of the target line structured light image; and adjusting the automatic exposure parameters to reduce image brightness in response to the maximum background brightness being greater than or equal to a second preset maximum background grayscale threshold, thereby obtaining the automatic exposure parameters of the target line structured light image.
[0021] In one embodiment of this disclosure, the step of extracting the spot features and ambient light intensity from the initial line structured light image further includes: counting the number of pixels in the second frame image whose grayscale value is a target grayscale value, as the number of ambient light pixels; the step of determining the automatic exposure parameters or line structured light intensity of the target line structured light image based on the spot features, the ambient light intensity, and a preset threshold includes: adjusting the automatic exposure parameters to reduce the image brightness in response to the number of ambient light pixels being greater than a second number, thereby obtaining the automatic exposure parameters of the target line structured light image; and determining the automatic exposure parameters or line structured light intensity of the target line structured light image based on the spot features, the ambient light intensity, and the preset threshold in response to the number of ambient light pixels being less than or equal to the second number.
[0022] An automatic exposure apparatus according to a second aspect of this disclosure includes: an image feature extraction module configured to extract spot features and ambient light intensity from an initial line structured light image, the spot features including spot width, spot brightness, and halo width; and an automatic exposure setting module configured to determine automatic exposure parameters or line structured light intensity of a target line structured light image based on the spot features, the ambient light intensity, and a preset threshold, wherein different preset thresholds are set according to different distance ranges within the working distance of the line structured light.
[0023] The line structured light measurement apparatus provided according to a third aspect of this disclosure may include: a projector and a camera, wherein the projector is configured to project line structured light onto the object under test, and the camera is configured to perform the automatic exposure method described in the first aspect of this disclosure to photograph the object under test at a specific angle.
[0024] An electronic device provided according to a fourth aspect of this disclosure may include: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the automatic exposure method described in the first aspect of this disclosure.
[0025] A computer-readable storage medium according to the fifth aspect of this disclosure stores a computer program, which, when executed by a processor, implements the automatic exposure method described in the first aspect of this disclosure.
[0026] The computer program product provided according to the sixth aspect of this disclosure includes a computer program that, when executed by a processor, implements the automatic exposure method described in the first aspect of this disclosure.
[0027] The automatic exposure method, apparatus, device, storage medium, and program product provided according to the embodiments of this disclosure, in the process of exposure control, not only is the spot width judged, but also the spot brightness and halo width are judged, which can improve the accuracy of exposure control and thus improve the effect of automatic exposure. Furthermore, by introducing ambient light brightness and selecting a preset threshold according to the working distance range, the influence of ambient light brightness and different distance ranges on exposure control is also considered, which can enhance the automatic exposure's adaptability to the environment, enabling automatic exposure to be applied to various environments and distances, further improving the effect of automatic exposure.
[0028] It should be understood that the description in this section is not intended to identify key or important features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0029] Other features, objects, and advantages of this disclosure will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings. The drawings are provided for a better understanding of the invention and are not intended to limit the scope of this disclosure. Wherein:
[0030] Figure 1 This is a flowchart of an automatic exposure method according to an embodiment of the present disclosure;
[0031] Figure 2 This is a flowchart illustrating the extraction of light spot features and ambient light intensity according to embodiments of this disclosure;
[0032] Figure 3 This is a flowchart illustrating the extraction of the spot width according to embodiments of the present disclosure;
[0033] Figure 4 This is a flowchart illustrating the extraction of spot brightness and halo width according to embodiments of the present disclosure;
[0034] Figure 5 This is a flowchart illustrating exposure adjustment based on spot characteristics and ambient light intensity according to embodiments of the present disclosure;
[0035] Figure 6 This is a flowchart illustrating exposure adjustment based on light spot characteristics according to embodiments of the present disclosure;
[0036] Figure 7 This is a flowchart of exposure adjustment based on spot characteristics according to an embodiment of the present disclosure;
[0037] Figure 8 This is a flowchart illustrating exposure adjustment based on ambient light intensity according to embodiments of the present disclosure;
[0038] Figure 9 This is a flowchart of an embodiment of the present disclosure for adjusting exposure based on ambient light intensity;
[0039] Figure 10 This is a schematic diagram of a line structured light image obtained by existing automatic exposure methods;
[0040] Figure 11 This is a block diagram of an automatic exposure apparatus according to an embodiment of the present disclosure;
[0041] Figure 12 This is a block diagram of an electronic device used to implement the automatic exposure method of the embodiments of this disclosure. Detailed Implementation
[0042] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of these embodiments to aid understanding; however, these should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0043] It should be noted that, where there is no conflict, the embodiments and features described in this disclosure can be combined with each other. This disclosure will now be described in detail with reference to the accompanying drawings and embodiments.
[0044] The embodiments of this disclosure provide an automatic exposure method 1000.
[0045] Figure 1 A flowchart of an automatic exposure method 1000 according to an embodiment of the present disclosure is shown. Figure 1 As shown, the automatic exposure method 1000 may include the following steps:
[0046] S100. Extract the spot features and ambient light intensity from the initial line structured light image, where the spot features include: spot width, spot intensity, and halo width.
[0047] S200. Based on the light spot characteristics and ambient light brightness and preset threshold, determine the automatic exposure parameters or line structure light intensity of the target line structure light image, wherein different preset thresholds are set according to different distance ranges in the working distance of the line structure light.
[0048] The automatic exposure method 1000 of this disclosure can be executed by an automatic exposure device, which can be installed in a line structured light measurement system to control the automatic exposure parameters of the camera and the intensity of the line structured light projected by the projector. For example, the line structured light projected by the projector can be a laser of a specific wavelength. The line structured light measurement system can be installed in a service robot or an industrial robot, or it can be applied to other fields; this disclosure does not limit this application. The executing entity of the automatic exposure method 1000 can acquire an initial line structured light image captured by the camera and extract the light spot features and ambient light brightness from the initial line structured light image. The light spot features can include: the light spot width, light spot brightness, and halo width of the line structured light in the image. Then, the extracted light spot features and ambient light brightness can be judged according to a preset threshold, and it can be determined whether to adjust the automatic exposure parameters of the camera or the line structured light intensity of the projector based on the judgment result. This allows the automatic exposure parameters or line structured light intensity of the camera to be obtained for the next capture of the target line structured light image. The preset threshold can be different thresholds set according to different distance ranges within the working distance of the line structured light.
[0049] The automatic exposure method 1000 of this disclosure, in the process of exposure control, not only judges the spot width, but also adds judgments on the spot brightness and halo width, which can improve the accuracy of exposure control and thus improve the effect of automatic exposure. Furthermore, by introducing ambient light brightness and selecting a preset threshold according to the working distance range, the influence of ambient light brightness and different distance ranges on exposure control is also considered, which can enhance the automatic exposure's adaptability to the environment, enabling automatic exposure to be applied to various environments and distances, further improving the effect of automatic exposure.
[0050] It should be understood that the steps shown in method 1000 are not exclusive, and other steps may be performed before, after, or between any of the steps shown. Furthermore, some of the steps shown may be performed simultaneously, or may be performed in a manner different from [the steps shown in the method described ... Figure 1 The execution is performed in the order shown.
[0051] The steps of the automatic exposure method 1000 in the embodiments of this disclosure will be described in detail below.
[0052] Step S100
[0053] In step S100, the light spot features and ambient light intensity in the initial line structured light image are extracted. Figure 2 A flowchart illustrating the extraction of light spot features and ambient light intensity according to embodiments of the present disclosure is shown. Figure 2 As shown, step S100 may include the following steps: S110, acquiring a first frame image with the line structured light turned on and a second frame image with the line structured light turned off to obtain an initial line structured light image; S120, removing ambient light from the first frame image based on the second frame image to obtain a pure structured light image; S130, extracting the spot width based on the pure structured light image, extracting the spot brightness and halo width based on the first frame image, and extracting the ambient light brightness based on the second frame image.
[0054] In this embodiment, the initial line structured light image includes a first frame image and a second frame image. The execution entity can acquire the first frame image by turning on the line structured light projector and then acquiring the second frame image by turning off the projector. The first frame image contains both ambient light and the line structured light, while the second frame image contains only the ambient light. The execution entity can remove the ambient light from the first frame image by subtracting the second frame image from the first frame image to obtain a pure structured light image. This allows for the extraction of the spot width from the pure structured light image, the spot brightness and halo width from the first frame image, and the ambient light brightness from the second frame image. This ensures that the extracted spot width is unaffected by ambient light and halo interference, and that the spot brightness, halo width, and ambient light brightness can be accurately extracted.
[0055] In some alternative implementations, such as Figure 3 As shown, Figure 3 A flowchart illustrating the extraction of spot width according to an embodiment of the present disclosure is shown. Step S130, which involves extracting the spot width based on a pure structured light image, may include the following steps: S131, identifying regions in the pure structured light image with gray values greater than a first gray value as effective light regions; S132, counting the number of pixels in each column of the effective light region in a direction perpendicular to the extension direction of the line structured light, to obtain an effective light width array; S133, sorting each column in the effective light width array in descending order of the number of pixels, and selecting the column number whose sorting number is less than a first number as the target column number; S134, determining the spot width based on the average number of pixels in the target column number of the effective light width array.
[0056] The executing entity can determine the effective light region of the line structured light in a pure structured light image and only count the spot width within the effective region. For example, the region with a grayscale value greater than 50 in the pure structured light image can be defined as the effective line structured light image, i.e., the effective region of the line structured light. Then, the number of pixels in each column of the effective light region in the pure structured light image can be counted in the direction perpendicular to the extension direction of the line structured light, resulting in an effective ray width array. Each column in the effective ray width array corresponds to the number of pixels in one column in the effective light region in the direction perpendicular to the extension direction of the line structured light. Then, the columns in the effective ray width array can be sorted in descending order of the number of pixels to obtain the sorting index of each column in the effective ray width array. Finally, the column number with a sorting index less than the first number can be selected as the target column number. For example, by sorting each column of the effective ray width array iListEffGray[n] in descending order of pixel count, the sorting index of each column in the effective ray width array can be obtained. The column numbers that represent the first m percent of the sorted columns can be selected, and their corresponding column IDs in the effective ray width array can be recorded as the target column number. Then, based on the pixel count of the target column number in the selected effective ray width array, the average pixel count can be determined, and the spot width can be determined based on the average pixel count.
[0057] By sorting the linewidths of the structured light spots after statistical analysis in descending order and calculating the average of the statistical linewidths within a certain range to determine the spot width, the phenomenon of a wide center and narrow edges in structured light images can be effectively solved. This also addresses the impact of camera lens distortion on the determination of spot width. Furthermore, it effectively solves the problem of miscalculating large grayscale values of halos on both sides of the spot as part of the spot width. This significantly improves the accuracy of subsequent automatic exposure judgments based on spot width, thereby enhancing the accuracy of exposure control.
[0058] For example, in a certain scene, the optimal grayscale value for line structured light in an image is around 250. However, when interference from ambient light and halos occurs, the maximum brightness of the line structured light may be slightly lower. Increasing the brightness of the line structured light to 250 in this case would make the halos or ambient light too strong, affecting the accuracy of subsequent line structured light spot calculations. Therefore, the grayscale values of the image can be divided into different grayscale value ranges, and the spot width can be dynamically calculated based on these ranges to achieve dynamic adjustment of automatic exposure, resulting in high real-time performance. For example, the grayscale values of the image can be divided into six ranges: 0-50, 50-100, 100-200, 200-220, 220-240, and 240-255. The division of grayscale value ranges can vary depending on the characteristics of different projectors and cameras, and the embodiments disclosed herein do not limit this.
[0059] Therefore, step S132 counts the number of pixels in each column of the effective light region in a direction perpendicular to the extension direction of the line structured light to obtain an effective light beam width array. This may include: counting the number of pixels in each column of the effective light region that belong to at least two gray value intervals within a preset gray value interval in a direction perpendicular to the extension direction of the line structured light to obtain an effective light beam width array. Step S134 determines the spot width based on the average number of pixels in the target column of the effective light beam width array. This may include: determining the average number of pixels in the target column of the effective light beam width array to obtain an average effective linewidth; and determining the average number of pixels in the target column of the effective light beam width array that belong to at least one gray value interval based on the average effective linewidth and a preset linewidth threshold, as the spot width.
[0060] In some optional examples, determining the average number of pixels belonging to at least one grayscale value range in the target column of the effective ray width array as the spot width may include the following steps: in response to an average effective linewidth greater than a first preset linewidth threshold, determining the average number of pixels belonging to a first grayscale value range in the target column of the effective ray width array as the spot width; in response to an average effective linewidth less than or equal to the first preset linewidth threshold and greater than a second preset linewidth threshold, determining the average number of pixels belonging to the first grayscale value range and the second grayscale value range in the target column of the effective ray width array as the spot width; and in response to an average effective linewidth less than or equal to a preset second linewidth threshold, determining the average number of pixels belonging to the first grayscale value range, the second grayscale value range, and the third grayscale value range in the target column of the effective ray width array as the spot width.
[0061] For example, the effective light area can be divided into several columns. The number of pixels belonging to the following grayscale value ranges in each column can be counted along a direction perpendicular to the extension direction of the structured light, resulting in the corresponding arrays: iList_240_255[n], iList_220_240[n], iList_200_220[n], iList_100_200[n], and iList_50_100[n]. This yields the effective light width array iListEffGray[n]. Then, each column in the effective light width array iListEffGray[n] is sorted from largest to smallest based on the number of pixels, and the sorting index is selected as the column number of the first m percent. The corresponding column number id in the effective light width array is recorded as the target column number. The average number of pixels in the first m percent of the effective light width array can then be calculated to obtain the average effective linewidth effGray. Based on the average effective linewidth effGray and the recorded column number id, the spot width iLineStat is determined using the following method:
[0062] When the average effective linewidth effGray is greater than the threshold iUpperLimit, the average number of pixels in the gray value range iList_240_255[id] in the first m% of columns is calculated to obtain the average linewidth iLineMean of the spot, which is used as the spot width iLineStat.
[0063] When the average effective linewidth effGray is less than the threshold iUpperLimit and greater than the threshold iLowerLimit, the average number of pixels in the gray value interval iList_240_255[id]+iList_220_240[id] in the first m% column numbers is calculated to obtain the average linewidth iLineMean of the spot, which is used as the spot width iLineStat.
[0064] When the average effective linewidth effGray is less than the threshold iLowerLimit, the average number of pixels in the gray value interval iList_240_255[id]+iList_220_240[id]+iList_200_220[id] in the first m% of columns is calculated to obtain the average linewidth iLineMean of the spot, which is used as the spot width iLineStat.
[0065] In some alternative implementations, such as Figure 4 As shown, Figure 4A flowchart illustrating the extraction of spot brightness and halo width according to an embodiment of the present disclosure is shown. Step S130, which extracts spot brightness and halo width based on a first frame image, may include the following steps: S135, in the region corresponding to the effective light area in the first frame image, the maximum grayscale value of each column is counted in a direction perpendicular to the extension direction of the line structured light, to obtain a maximum grayscale value array; S136, the average value of the maximum grayscale values of the target column number in the maximum grayscale value array is determined as the spot brightness; S137, in the region corresponding to the effective light area in the first frame image, the number of pixels belonging to the target grayscale value range in each column of the target column number is counted in a direction perpendicular to the extension direction of the line structured light, and the average value of the number of pixels is determined as the halo width.
[0066] The executing entity can map the effective light region in the pure structured light image to the first frame image. For the region corresponding to the effective light region in the first frame image, the maximum grayscale value of each column is counted in a direction perpendicular to the extension direction of the line structured light, resulting in a maximum grayscale value array. Then, based on the maximum grayscale value of the target column number in the maximum grayscale value array, the average of the maximum grayscale values is determined as the spot brightness. Next, in the region corresponding to the effective light region in the first frame image, the number of pixels belonging to the target grayscale value range in each column of the target column number is counted in a direction perpendicular to the extension direction of the line structured light, and the average of the pixel count is determined as the halo width. The target grayscale value range is the grayscale value range of the halo in the image, for example, a grayscale value range of 50-200. For example, the average of the maximum gray values in the first m% of the columns in the array iListGrayMax[n] corresponding to the effective area can be calculated to obtain the average maximum gray value iGrayMaxMean, which is used as the spot brightness iGrayMaxStat. In the first frame image, the average number of pixels in the gray value interval iList_100_200[id]+iList_50_100[id] can be counted in the region corresponding to the effective light area in the direction perpendicular to the extension direction of the line structured light to obtain the average halo width iGlowMean, which is used as the halo width iGlowStat.
[0067] In some optional implementations, ambient light brightness may include average background brightness. Step S130, which extracts ambient light brightness based on the second frame image, may include: calculating the average grayscale value of each column in the region corresponding to the effective light region in the second frame image, in a direction perpendicular to the extension direction of the line structured light, to obtain a background average grayscale value array; and determining the average value of the average grayscale value of the target column number in the background average grayscale value array as the average background brightness. The executing entity can map the effective light region in the pure structured light image to the second frame image, and calculate the average grayscale value of each column in the region corresponding to the effective light region in the second frame image, in a direction perpendicular to the extension direction of the line structured light, to obtain a background average grayscale value array. Then, based on the average grayscale value of the target column number in the average grayscale value array, the average value of the average grayscale value determined can be used as the average background brightness. For example, the average value of the average grayscale value of the first m% of the columns in the background average grayscale value array iListBG[n] corresponding to the effective region can be calculated to obtain the background average grayscale value iBGMean, which is used as the average background brightness iBGStat.
[0068] Step S200
[0069] In step S200, the automatic exposure parameters or line structured light intensity of the target line structured light image are determined based on the light spot characteristics, ambient light brightness, and preset threshold. Figure 5 A flowchart illustrating exposure adjustment based on spot characteristics and ambient light intensity according to an embodiment of this disclosure is shown. Figure 5 As shown, step S200 may include the following steps: S210, determining whether the average background brightness is less than a first preset background grayscale threshold; in response to the average background brightness being less than the first preset background grayscale threshold, executing S220; S220, determining the automatic exposure parameters or line structure light intensity of the target line structure light image based on the light spot characteristics; in response to the average background brightness being greater than or equal to the first preset background grayscale threshold, executing S230; S230, in response to the average background brightness being greater than or equal to the first preset background grayscale threshold, determining the automatic exposure parameters or line structure light intensity of the target line structure light image based on the ambient light brightness.
[0070] In this embodiment, the executing entity can determine the average background brightness by using a first preset background grayscale threshold. When the average background brightness is less than the first preset background grayscale threshold thbg1, it can be considered that the ambient light is very small and its influence on the light spot is negligible. Ambient light can be disregarded, and the automatic exposure parameters or line structure light intensity for the next automatic exposure can be determined solely based on the characteristics of the light spot. When the average background brightness is greater than or equal to the first preset background grayscale threshold thbg1, it can be considered that the ambient light is large and its influence on the light spot cannot be ignored. Ambient light must be considered first, and the automatic exposure parameters or line structure light intensity for the next automatic exposure can be determined based on the brightness of the ambient light.
[0071] In some alternative implementations, such as Figure 6 As shown, Figure 6 A flowchart illustrating exposure adjustment based on spot characteristics according to an embodiment of the present disclosure is shown. Step S220, determining the automatic exposure parameters or line structured light intensity of the target line structured light image based on spot characteristics, may include the following steps: S221, determining whether the spot width is within a first preset threshold range; in response to the spot width being within the first preset threshold range, executing S222; S222, determining whether the spot brightness is within a second preset threshold range; in response to the spot brightness being within the second preset threshold range, executing S223; S223, determining whether the halo width is within a third preset threshold range; in response to the halo width being within the third preset threshold range, executing S224; S224, using the automatic exposure parameters and line structured light intensity of the initial line structured light image as the automatic exposure parameters and line structured light intensity of the target line structured light image. The first preset threshold range (a1-a2), the second preset threshold range (b1-b2), and the third preset threshold range (c1-c2) can be set to different ranges according to different application scenarios, and the embodiments of the present disclosure do not limit this.
[0072] Optionally, step S220 may further include the following steps: in response to the spot width not being within the first preset threshold range, execute S225; S225, adjust the automatic exposure parameters to reduce image brightness or adjust the line structured light intensity to increase image brightness; in response to the spot brightness not being within the second preset threshold range, execute S226; S226, adjust the line structured light intensity to increase image brightness; in response to the halo width not being within the third preset threshold range, execute S227; S227, adjust the automatic exposure parameters to reduce image brightness.
[0073] In some optional examples, such as Figure 7 As shown, Figure 7A flowchart illustrating exposure adjustment based on spot features according to an embodiment of the present disclosure is shown. Step S220, determining the automatic exposure parameters or line structured light intensity of the target line structured light image based on spot features, may include the following steps: S301, determining whether the spot width is less than a first preset spot width threshold (standdown); in response to the spot width being less than the first preset spot width threshold (standdown), the spot width is too narrow, and proceeding to S302; S302, adjusting the line structured light intensity to increase the image brightness, thereby obtaining the line structured light intensity of the target line structured light image; in response to the spot width being greater than or equal to the first preset spot width threshold (standdown), proceeding to S303; S303, determining whether the spot width is less than a second preset spot width threshold (standup); in response to the spot width being less than the second preset spot width threshold (standup), proceeding to S304; S304, determining whether the spot brightness is less than a preset spot grayscale threshold, for example, a preset spot grayscale threshold of 1. 220; In response to the spot width being greater than or equal to the second preset spot width threshold standup, execute S305; S305, adjust the automatic exposure parameters to reduce image brightness, and obtain the automatic exposure parameters of the target line structured light image; In response to the spot brightness being less than the preset spot grayscale threshold, the spot is too dark, execute S302; In response to the spot brightness being greater than or equal to the preset spot grayscale threshold, execute S306; S306, determine whether the halo width is greater than the preset halo width threshold iGlowStand; In response to the halo width being greater than the preset halo width threshold iGlowStand, the halo is too large, execute S305; In response to the halo width being less than or equal to the preset halo width threshold iGlowStand, execute S307; S307, use the automatic exposure parameters and line structured light intensity of the initial line structured light image as the automatic exposure parameters and line structured light intensity of the target line structured light image.
[0074] When the spot width, spot brightness, and halo width are all within the preset threshold range, there is no need to adjust the camera's exposure parameters or the line structured light laser intensity of the projector. The current automatic exposure parameters and line structured light laser intensity can be used directly for the next automatic exposure. When at least one of the spot width, spot brightness, and halo width is not within the preset threshold range, it is necessary to adjust the camera's exposure parameters or the line structured light laser intensity of the projector, and then perform the next automatic exposure based on the adjusted automatic exposure parameters or line structured light laser intensity.
[0075] In step S110, after obtaining the spot width, step S220 may further include: determining the working distance range of the line structured light corresponding to the spot width of the initial line structured light image and the preset threshold corresponding to that distance range, based on the pre-calibrated correspondence between the spot width, distance range, and preset threshold. The preset threshold may include: a preset halo width threshold, a first preset spot width threshold, and a second preset spot width threshold. Since line structured light measurement systems have actual working distances, automatic exposure can be set at different distance ranges from the closest to the farthest distance within the working distance, with certain step sizes. Each distance range will obtain a suitable line structured light spot width range d that is neither overexposed nor underexposed. By mapping the spot width to a certain working distance range and calibrating the corresponding threshold within that distance range, the pre-calibrated correspondence between the spot width, distance range, and preset threshold can be obtained, thereby enabling adjustment of the camera's automatic exposure parameters or the projector's line structured light intensity according to the distance range. The step size for the distance range should not be too small, as this will increase the calibration workload and cause overlap in the width range. A larger step size should be selected based on the actual application scenario and the available conditions. In some optional examples, for scenarios where the line structured light beam is thin and the working distance is long, a smaller step size can be selected for calibration, such as a distance range of 16-18, 18-20, 20-22, etc. In other optional examples, for scenarios where the line structured light beam is thick and the working distance is short, a larger step size can be selected for calibration, such as a distance range of 10-20, 20-30, 30-40, etc.
[0076] In some optional implementations, the ambient light brightness in step S100 may further include: maximum background brightness. Step S130, which extracts the ambient light brightness based on the second frame image, may further include: in the region corresponding to the effective light region in the second frame image, counting the maximum grayscale value of each column in the target column number in a direction perpendicular to the extension direction of the line structured light, and determining the average value of the maximum grayscale value as the maximum background brightness. The executing entity can map the effective light region in the pure structured light image to the second frame image, and for the region corresponding to the effective light region in the second frame image, count the maximum grayscale value of each column in the target column number in a direction perpendicular to the extension direction of the line structured light, and determine the average value of the maximum grayscale value as the maximum background brightness. For example, the average value of the maximum grayscale values of the first m% of the columns corresponding to the effective region in the second frame image can be calculated to obtain the maximum background grayscale value iLineBGMean, which is used as the maximum background brightness iLineBGStat.
[0077] like Figure 8 As shown, Figure 8A flowchart illustrating exposure adjustment based on ambient light intensity according to an embodiment of the present disclosure is shown. Step S230, determining the automatic exposure parameters or line structured light intensity of the target line structured light image based on ambient light intensity, may include the following steps: S231, determining whether the average background brightness is within a fourth preset threshold range; in response to the average background brightness being within the fourth preset threshold range, executing S232; S232, determining whether the maximum background brightness is within a fifth preset threshold range; in response to the maximum background brightness being within the fifth preset threshold range, executing S233; S233, using the automatic exposure parameters and line structured light intensity of the initial line structured light image as the automatic exposure parameters and line structured light intensity of the target line structured light image.
[0078] Optionally, step S230 may further include the following steps: in response to the average background brightness not being within the fourth preset threshold range, execute S234; S234, adjust the automatic exposure parameters to reduce image brightness; in response to the maximum background brightness not being within the fifth preset threshold range, execute S235; S235, adjust the automatic exposure parameters to reduce image brightness or adjust the line structured light intensity to increase image brightness.
[0079] In some optional examples, such as Figure 9 As shown, Figure 9A flowchart illustrating exposure adjustment based on ambient light intensity according to an embodiment of the present disclosure is shown. Step S230, determining the automatic exposure parameters or line structure light intensity of the target line structure light image based on ambient light intensity, may include the following steps: S401, determining whether the average background brightness is less than a second preset background grayscale threshold thbg2; in response to the average background brightness being less than the second preset background grayscale threshold thbg2, executing S402; S402, determining whether the maximum background brightness is less than a first preset maximum background grayscale threshold standdown; in response to the average background brightness being greater than or equal to the second preset background grayscale threshold thbg2, executing S403, adjusting the automatic exposure parameters to reduce image brightness, thereby obtaining the automatic exposure parameters of the target line structure light image; in response to the maximum background brightness being less than the first preset maximum background grayscale threshold standdown, executing... S404; S404, Adjust the line structured light intensity to increase the image brightness, and obtain the line structured light intensity of the target line structured light image; In response to the maximum background brightness being greater than or equal to the first preset maximum background grayscale threshold standdown, execute S405; S405, Determine whether the maximum background brightness is less than the second preset maximum background grayscale threshold standup; In response to the maximum background brightness being less than the second preset maximum background grayscale threshold standup, execute S406; S406, Use the automatic exposure parameters and line structured light intensity of the initial line structured light image as the automatic exposure parameters and line structured light intensity of the target line structured light image; In response to the maximum background brightness being greater than or equal to the second preset maximum background grayscale threshold standup, execute S403.
[0080] In some optional implementations, step S100, which extracts the spot features and ambient light intensity from the initial line structured light image, may further include: counting the number of pixels in the second frame image whose grayscale value is the target grayscale value, as the number of ambient light pixels; step S200, which determines the automatic exposure parameters or line structured light intensity of the target line structured light image based on the spot features, the ambient light intensity, and a preset threshold, may further include: adjusting the automatic exposure parameters to reduce the image brightness in response to the ambient light pixel count being greater than a second number and the background being too bright, thereby obtaining the automatic exposure parameters of the target line structured light image; and determining the automatic exposure parameters or line structured light intensity of the target line structured light image based on the spot features, the ambient light intensity, and a preset threshold in response to the ambient light pixel count being less than or equal to the second number. The target grayscale value can be 255 or n%. The embodiments of this disclosure, by counting the number of pixels with the target grayscale value in the second frame image, can, after obtaining the initial line structured light image, directly reduce the image brightness by adjusting the automatic exposure parameters when it is determined that the image is overexposed and in a completely white state by judging the ambient light intensity in the image.
[0081] The embodiments of this disclosure extract ambient light brightness, determine the ambient light brightness, and adjust the automatic exposure parameters or structured light intensity according to the determination result. This can effectively reduce the interference of ambient light on automatic exposure and avoid the situation where the structured light spot in the image is overwhelmed by excessive ambient light, such as sunlight, infrared light, halogen lamps, etc., leading to automatic exposure failure.
[0082] It should be noted that in the above embodiments, if adjusting the structured light intensity cannot meet the requirements, the image brightness can be increased by adjusting the automatic exposure parameters; similarly, if adjusting the automatic exposure parameters cannot meet the requirements, the image brightness can be decreased by adjusting the structured light intensity.
[0083] Figure 10 A schematic diagram of a line structured light image obtained by a conventional automatic exposure method is shown. Figure 10 As shown in Figure A on the left, the center of the light spot line is wide while the edges are narrow and curved, which affects the statistical analysis of the light spot width, thus impacting the judgment of the light spot width and consequently affecting the control of automatic exposure. Also in Figure A on the left, large grayscale values of the halos on both sides of the laser beam can be mistakenly counted as light spot width, affecting the statistical analysis of the light spot width. In Figure B on the right, ambient light severely interferes with the statistical analysis and extraction of the light spot, causing automatic exposure to fail. The automatic exposure method provided by the above-described embodiments of this disclosure can effectively solve these problems. Figure 10 To address the existing problems and improve the effectiveness of automatic exposure.
[0084] This disclosure also provides an automatic exposure apparatus 2000. Figure 11 A block diagram of an automatic exposure apparatus 2000 according to an embodiment of the present disclosure is shown. Figure 11 As shown, the infrared automatic exposure device 2000 may include:
[0085] Image feature extraction module 510 is configured to extract spot features and ambient light intensity from an initial line structured light image, wherein the spot features include: spot width, spot intensity, and halo width; and
[0086] The automatic exposure setting module 520 is configured to determine the automatic exposure parameters or line structure light intensity of the target line structure light image based on the light spot characteristics and the ambient light brightness and a preset threshold, wherein different preset thresholds are set according to different distance ranges in the working distance of the line structure light.
[0087] In some alternative implementations, the image feature extraction module 510 may include:
[0088] The receiving unit is configured to acquire a first frame image with the line structured light turned on and a second frame image with the line structured light turned off, to obtain the initial line structured light image;
[0089] The processing unit is configured to remove ambient light from the first frame image based on the second frame image to obtain a pure structured light image; and
[0090] The processing unit is configured to extract the spot width based on the pure structured light image, extract the spot brightness and the halo width based on the first frame image, and extract the ambient light brightness based on the second frame image.
[0091] In some optional implementations, the processing unit is further configured to:
[0092] In the pure structured light image, the region with a gray value greater than a first gray value is defined as the effective light region;
[0093] The number of pixels in each column of the effective light region is counted in a direction perpendicular to the extension direction of the line structured light to obtain the effective light beam width array;
[0094] Sort each column in the effective light width array in descending order of pixel count, and select the column number whose sorting number is less than the first number as the target column number;
[0095] The spot width is determined based on the average number of pixels in the target column number of the effective light width array.
[0096] In some optional implementations, the processing unit is further configured to:
[0097] For the effective light region, in a direction perpendicular to the extension direction of the line structured light, count the number of pixels in each column that belong to at least two gray value intervals in the preset gray value interval to obtain the effective light width array;
[0098] The average effective linewidth is obtained by determining the average number of pixels in the target column number of the effective ray width array;
[0099] Based on the average effective linewidth and the preset linewidth threshold, the average number of pixels belonging to at least one grayscale value range in the target column of the effective light width array is determined as the light spot width.
[0100] In some optional implementations, the processing unit is further configured to:
[0101] In response to the average effective linewidth being greater than a first preset linewidth threshold, the average number of pixels belonging to the first grayscale value range in the target column of the effective light width array is determined as the light spot width;
[0102] In response to the fact that the average effective linewidth is less than or equal to a first preset linewidth threshold and greater than a second preset linewidth threshold, the average number of pixels belonging to the first gray value range and the second gray value range in the target column of the effective light width array is determined as the light spot width;
[0103] In response to the average effective linewidth being less than or equal to a preset second linewidth threshold, the average number of pixels belonging to the first gray value interval, the second gray value interval, and the third gray value interval in the target column of the effective light width array is determined as the light spot width.
[0104] In some optional implementations, the processing unit is further configured to:
[0105] In the region corresponding to the effective light region in the first frame image, the maximum gray value of each column is counted in a direction perpendicular to the extension direction of the line structured light to obtain the maximum gray value array.
[0106] The average value of the maximum grayscale value of the target column number in the maximum grayscale value array is determined as the brightness of the light spot;
[0107] In the first frame image, in the region corresponding to the effective light area, the number of pixels in each column of the target column number that belong to the target grayscale value range is counted in a direction perpendicular to the extension direction of the line structured light, and the average number of pixels is determined as the halo width.
[0108] In some optional implementations, the ambient light brightness includes: average background brightness; the processing unit is further configured to:
[0109] In the second frame image, in the region corresponding to the effective light region, the average gray value of each column is calculated according to the direction perpendicular to the extension direction of the line structured light to obtain the background average gray value array.
[0110] The average value of the target column number in the background average gray value array is determined as the average background brightness.
[0111] In some alternative implementations, the automatic exposure setting module 520 may include:
[0112] The spot feature processing unit is configured to determine the automatic exposure parameters or line structure light intensity of the target line structure light image based on the spot features in response to the average background brightness being less than a first preset background grayscale threshold.
[0113] An ambient light brightness processing unit is configured to determine the automatic exposure parameters or line structure light intensity of the target line structure light image based on the ambient light brightness in response to the average background brightness being greater than or equal to a first preset background grayscale threshold.
[0114] In some optional implementations, the spot feature processing unit is further configured to:
[0115] Determine whether the width of the light spot is within the first preset threshold range;
[0116] In response to the light spot width being within a first preset threshold range, it is determined whether the light spot brightness is within a second preset threshold range;
[0117] In response to the light spot brightness being within a second preset threshold range, it is determined whether the halo width is within a third preset threshold range;
[0118] In response to the halo width being within a third preset threshold range, the automatic exposure parameters and line structure light intensity of the initial line structure light image are used as the automatic exposure parameters and line structure light intensity of the target line structure light image.
[0119] In some optional implementations, the spot feature processing unit is further configured to:
[0120] In response to the light spot width not being within the first preset threshold range, adjust the automatic exposure parameters to reduce image brightness or adjust the line structured light intensity to increase image brightness;
[0121] In response to the light spot brightness not being within the second preset threshold range, the intensity of the line structured light is adjusted to increase the image brightness;
[0122] In response to the fact that the halo width is not within the third preset threshold range, the automatic exposure parameters are adjusted to reduce the image brightness.
[0123] In some optional implementations, the spot feature processing unit is further configured to:
[0124] In response to the light spot width being less than a first preset light spot width threshold, the line structured light intensity is adjusted to increase the image brightness, thereby obtaining the line structured light intensity of the target line structured light image;
[0125] In response to the spot width being greater than or equal to a second preset spot width threshold, the automatic exposure parameters are adjusted to reduce the image brightness, thereby obtaining the automatic exposure parameters of the target line structured light image;
[0126] In response to the light spot brightness being less than a preset light spot grayscale threshold, the line structured light intensity is adjusted to increase the image brightness, thereby obtaining the line structured light intensity of the target line structured light image;
[0127] In response to the halo width being greater than a preset halo width threshold, the automatic exposure parameters are adjusted to reduce the image brightness, thereby obtaining the automatic exposure parameters of the target line structured light image.
[0128] In some optional implementations, the spot feature processing unit is further configured to:
[0129] Based on the pre-calibrated correspondence between the spot width, distance range and preset threshold, the distance range of the line structured light operation corresponding to the spot width of the initial line structured light image and the preset threshold corresponding to the distance range are determined, wherein the preset threshold includes: a preset halo width threshold, a first preset spot width threshold and a second preset spot width threshold.
[0130] In some optional implementations, the ambient light brightness further includes: maximum background brightness;
[0131] The processing unit is further configured as follows:
[0132] In the second frame image, in the region corresponding to the effective light area, the maximum grayscale value of each column in the target column number is counted in a direction perpendicular to the extension direction of the line structured light, and the average value of the maximum grayscale value is determined as the maximum background brightness.
[0133] In some optional implementations, the ambient light processing unit is further configured to:
[0134] Determine whether the average background brightness is within the range of the fourth preset threshold;
[0135] In response to the average background brightness being within a fourth preset threshold range, it is determined whether the maximum background brightness is within a fifth preset threshold range;
[0136] In response to the maximum background brightness being within a fifth preset threshold range, the automatic exposure parameters and line structure light intensity of the initial line structure light image are used as the automatic exposure parameters and line structure light intensity of the target line structure light image.
[0137] In some alternative implementations, the ambient light processing unit is further configured to:
[0138] In response to the average background brightness not being within the fourth preset threshold range, the automatic exposure parameters are adjusted to reduce the image brightness;
[0139] In response to the maximum background brightness not being within the fifth preset threshold range, the automatic exposure parameters are adjusted to reduce the image brightness or the line structured light intensity is adjusted to increase the image brightness.
[0140] In some optional implementations, the ambient light processing unit is further configured to:
[0141] In response to the average background brightness being greater than or equal to a second preset background grayscale threshold, the automatic exposure parameters are adjusted to reduce the image brightness, thereby obtaining the automatic exposure parameters of the target line structured light image;
[0142] In response to the maximum background brightness being less than a first preset maximum background grayscale threshold, the line structured light intensity is adjusted to increase the image brightness, thereby obtaining the line structured light intensity of the target line structured light image;
[0143] In response to the maximum background brightness being greater than or equal to a second preset maximum background grayscale threshold, the automatic exposure parameters are adjusted to reduce the image brightness, thereby obtaining the automatic exposure parameters of the target line structured light image.
[0144] In some optional implementations, the image feature extraction module 510 is further configured to count the number of pixels in the second frame image whose grayscale value is the target grayscale value, as the number of ambient light pixels.
[0145] The automatic exposure setting module 520 is further configured to adjust the automatic exposure parameters to reduce image brightness in response to the number of ambient light pixels being greater than a second number, thereby obtaining the automatic exposure parameters of the target line structured light image; and to determine the automatic exposure parameters or line structured light intensity of the target line structured light image based on the light spot characteristics, the ambient light brightness, and the preset threshold in response to the number of ambient light pixels being less than or equal to the second number.
[0146] In addition, this disclosure also provides a line structured light measurement device, which includes a projector and a camera, wherein the projector is configured to project line structured light onto the object under test, and the camera is configured to perform the above-described automatic exposure method to take a picture of the object under test at a specific angle.
[0147] This disclosure also provides an electronic device, which includes at least one processor and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the above-described automatic exposure method 1000.
[0148] This disclosure also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the above-described automatic exposure method 1000.
[0149] This disclosure also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described automatic exposure method 1000.
[0150] Figure 12A schematic block diagram of an example electronic device 3000 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers. It can also represent various forms of mobile devices capable of running computing programs. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0151] like Figure 12 As shown, the electronic device 3000 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory (RAM) 603. The RAM 603 may also store various programs and data required for the operation of the electronic device 3000. The computing unit 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0152] Multiple components in electronic device 3000 are connected to I / O interface 605, including: input unit 606, such as a touch screen; output unit 607, such as various types of displays, speakers, etc.; storage unit 608, such as a disk; and communication unit 609, such as a network card, modem, wireless transceiver, etc. Communication unit 609 allows electronic device 3000 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0153] The computing unit 601 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 601 performs the various methods and processes described above, such as the automatic exposure method 1000. For example, in some embodiments, the automatic exposure method 1000 may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 608. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 3000 via ROM 602 and / or communication unit 609. When the computer program is loaded into RAM 603 and executed by the computing unit 601, one or more steps of the automatic exposure method 1000 described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to perform the automatic exposure method 1000 by any other suitable means (e.g., by means of firmware).
[0154] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0155] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0156] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0157] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0158] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. An automatic exposure method, characterized in that, include: Extract the light spot features and ambient light intensity from the initial line structured light image. The light spot features include: light spot width, light spot intensity, and halo width; and... Based on the light spot characteristics and the ambient light brightness and preset threshold, the automatic exposure parameters or line structure light intensity of the target line structure light image are determined, wherein different preset thresholds are set according to different distance ranges in the working distance of the line structure light.
2. The method according to claim 1, wherein, The extraction of light spot features and ambient light intensity from the initial line structured light image includes: The initial line structured light image is obtained by acquiring a first frame image with the line structured light turned on and a second frame image with the line structured light turned off. Based on the second frame image, ambient light is removed from the first frame image to obtain a pure structured light image; and The spot width is extracted based on the pure structured light image, the spot brightness and the halo width are extracted based on the first frame image, and the ambient light brightness is extracted based on the second frame image.
3. The method according to claim 2, wherein, The step of extracting the spot width based on the pure structured light image includes: In the pure structured light image, the region with a gray value greater than a first gray value is defined as the effective light region; The number of pixels in each column of the effective light region is counted in a direction perpendicular to the extension direction of the line structured light to obtain the effective light beam width array; Sort each column in the effective light width array in descending order of pixel count, and select the column number whose sorting index is less than the first number as the target column number; and The spot width is determined based on the average number of pixels in the target column number of the effective light width array.
4. The method according to claim 3, wherein, The effective light region is counted according to the direction perpendicular to the extension direction of the line structured light, to obtain an effective light ray width array, including: For the effective light region, in a direction perpendicular to the extension direction of the line structured light, count the number of pixels in each column that belong to at least two gray value intervals in the preset gray value interval to obtain the effective light width array; Determining the spot width based on the average number of pixels in the target column of the effective light width array includes: The average effective linewidth is obtained by determining the average number of pixels in the target column number of the effective ray width array; Based on the average effective linewidth and the preset linewidth threshold, the average number of pixels belonging to at least one grayscale value range in the target column of the effective light width array is determined as the light spot width.
5. The method according to claim 4, wherein, The step of determining the average number of pixels belonging to at least one grayscale value range in the target column of the effective light width array as the spot width includes: In response to the average effective linewidth being greater than a first preset linewidth threshold, the average number of pixels belonging to the first grayscale value range in the target column of the effective light width array is determined as the light spot width; In response to the fact that the average effective linewidth is less than or equal to a first preset linewidth threshold and greater than a second preset linewidth threshold, the average number of pixels belonging to the first gray value range and the second gray value range in the target column of the effective light width array is determined as the light spot width; In response to the average effective linewidth being less than or equal to a preset second linewidth threshold, the average number of pixels belonging to the first gray value interval, the second gray value interval, and the third gray value interval in the target column of the effective light width array is determined as the light spot width.
6. An automatic exposure device, characterized in that, include: The image feature extraction module is configured to extract the spot features and ambient light brightness in the initial line structured light image, wherein the spot features include: spot width, spot brightness and halo width; as well as The automatic exposure setting module is configured to determine the automatic exposure parameters or line structure light intensity of the target line structure light image based on the light spot characteristics, the ambient light brightness, and a preset threshold, wherein different preset thresholds are set according to different distance ranges in the working distance of the line structure light.
7. A line structured light measurement device, characterized in that, include: The projector is configured to project line structured light onto the object being measured; as well as A camera is configured to perform the automatic exposure method as described in any one of claims 1 to 5, to photograph the object under test at a specific angle.
8. An electronic device, characterized in that, include: At least one processor; as well as, A memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the automatic exposure method as described in any one of claims 1 to 5.
9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the automatic exposure method as described in any one of claims 1 to 5.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the automatic exposure method as described in any one of claims 1 to 5.