Automatic brightness adjustment method and system of vision system light supplement lamp based on image gray histogram dynamic range
By defining the effective boundaries of low and high grayscale, a dual-boundary response range is formed, which solves the problem of unstable grayscale dynamic range adjustment in the prior art, realizes stable supplementary lighting adjustment under multiple constraints, reduces the impact of noise and light source fluctuations, and improves imaging quality.
Patent Information
- Application Number
- CN202611483826.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-22
- Publication Date
- 2026-11-24
AI Technical Summary
Existing technologies struggle to identify the effective grayscale dynamic range based on the actual response relationship between low and high grayscale regions in the grayscale histogram during the change of supplementary light driving amount. This leads to instability in the adjustment process, making it susceptible to noise, positional changes, and light source fluctuations, and making it difficult to simultaneously meet the requirements of dark detail and bright saturation.
By acquiring the supplementary light driving amount and grayscale histogram, the effective boundaries of low grayscale and high grayscale are determined, forming the effective grayscale dynamic range. Based on the boundary response changes, a dual-boundary response interval is formed. Combined with the response judgment margin, the expansion, inflection or compression category is determined, the supplementary light working interval is established, and the formal detection supplementary light driving amount is output.
It reduces the impact of noise and light source fluctuations on adjustment, improves the stability and accuracy of supplemental lighting adjustment, reduces excessive illumination and round-trip correction, and ensures the consistency of imaging parameters and the positional accuracy of the detection area.
Smart Images

Figure CN123164334A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of machine vision image processing technology, and specifically to a method and system for automatically adjusting the brightness of a vision system's supplementary lighting based on the dynamic range of the image's grayscale histogram. Background Technology
[0002] Industrial vision systems typically use cameras to acquire images of the object under test and perform tasks such as defect detection, dimensional measurement, and target localization based on the texture, edges, grayscale, or shape information in the images. Due to factors such as the surface reflectivity of the object under test, the installation position of the supplementary lighting, changes in ambient light, and the state of the light source, the acquired images may exhibit unclear details in dark areas, near-saturation in bright areas, or insufficient effective grayscale dynamic range. Therefore, it is necessary to adjust the brightness of the supplementary lighting before the actual inspection.
[0003] Existing brightness adjustment methods typically adjust the fill light drive amount based on the image's average grayscale, peak grayscale, proportion of dark pixels, or proportion of overly bright pixels. These indicators mainly reflect the overall brightness or local endpoint state of the image, making it difficult to characterize the individual response changes in low-grayscale and high-grayscale regions when the fill light drive amount changes. For example, as the fill light drive amount continuously increases, the image's average grayscale may still rise, while the bright areas may already be close to saturation, or the rate of change of the effective grayscale boundary may exceed that of the effective grayscale boundary, causing the effective grayscale dynamic range to begin to compress.
[0004] Furthermore, when using a fixed adjustment step size or determining the supplementary light drive amount based solely on the state of a single image, it is easily affected by image noise, trigger deviation, changes in the position of the object under test, and fluctuations in the supplementary light output. When effective requirements for dark areas, saturation protection requirements for bright areas, and dynamic range requirements exist simultaneously, these requirements may also mutually restrict the supplementary light drive amount, leading to problems such as exceeding limits, back-and-forth corrections, or difficulty in achieving stable convergence during the adjustment process.
[0005] Therefore, this application provides a method and system for automatically adjusting the brightness of a visual system's supplementary lighting based on the dynamic range of the image's grayscale histogram to solve the aforementioned technical problems. Summary of the Invention
[0006] The purpose of this invention is to provide a method and system for automatically adjusting the brightness of a visual system's supplementary lighting based on the dynamic range of the image's grayscale histogram. This addresses the technical problem in the prior art of identifying the expansion, transition, and compression states of the effective grayscale dynamic range based on the actual response relationship between the low-grayscale and high-grayscale regions of the grayscale histogram during the change of the supplementary lighting driving amount, and of stably determining the supplementary lighting driving amount under multiple imaging constraints.
[0007] To address the aforementioned technical problems, this invention provides a method for automatically adjusting the brightness of a visual system's supplementary lighting based on the dynamic range of an image's grayscale histogram, comprising: Obtain the fill light driving amount and grayscale histogram, and determine the effective boundary of low grayscale, effective boundary of high grayscale, and effective grayscale dynamic range according to the tail exclusion ratio; Adjust the fill light driving amount and acquire feedback images. Determine the low grayscale boundary response and high grayscale boundary response based on the changes in the low grayscale effective boundary and high grayscale effective boundary, and save the effective response record. The effective response records form a dual-boundary response interval. The conservative response difference boundary is formed based on the relative relationship between the low grayscale boundary response interval and the high grayscale boundary response interval. The expansion, transition or compression category is determined by comparing it with the response judgment margin. The lower bound of the driving change is determined based on the effective boundary of low grayscale, the effective boundary of dark area, the effective grayscale dynamic range, the effective dynamic range of target, and the response range of low grayscale boundary. The upper bound of the driving change is determined based on the effective boundary of high grayscale, the protection boundary of saturation end, the response range of high grayscale boundary, and the supplementary light control constraint, thus forming the feasible variation range of supplementary light driving amount. When the category changes from expansion to transition or compression, the supplementary lighting working range is established based on the driving amount before and after the transition. Images are acquired according to the candidate supplementary lighting driving amount, and the range endpoints are updated according to the dual boundary response category. When the range width is not greater than the minimum adjustment resolution, the officially detected supplementary lighting driving amount is output.
[0008] In some specific embodiments, determining the effective low-grayscale boundary, the effective high-grayscale boundary, and the effective grayscale dynamic range according to the tail exclusion ratio further includes: The cumulative ratio is formed based on the pixel distribution of each gray level; Based on the tail exclusion ratio, a low grayscale cumulative ratio threshold and a high grayscale cumulative ratio threshold corresponding to the high grayscale tail exclusion are set. The grayscale level where the cumulative ratio first reaches the low grayscale cumulative ratio threshold is taken as the effective boundary of low grayscale, and the grayscale level where the cumulative ratio first reaches the high grayscale cumulative ratio threshold is taken as the effective boundary of high grayscale. The effective grayscale dynamic range is determined based on the positional relationship between the effective grayscale boundary and the effective grayscale boundary. Under a fixed supplementary light driving amount, the target image is repeatedly acquired and the candidate tail exclusion ratio is increased in turn. When the inter-frame fluctuation of the low gray level effective boundary and the high gray level effective boundary is lower than the preset fluctuation limit and the main gray level area is still preserved, the corresponding candidate tail exclusion ratio is selected.
[0009] In some specific embodiments, adjusting the fill light driving amount and acquiring a feedback image further includes: When the effective boundary of low grayscale is lower than the effective boundary of dark area and the effective boundary of high grayscale is lower than the saturation end protection boundary, restricted brightness enhancement detection is performed; When the effective boundary of high grayscale is higher than the effective boundary of bright area and the effective boundary of low grayscale is higher than the protective boundary of dark end, restricted light reduction detection is performed. Based on the corresponding changes of the effective boundary of low grayscale, effective boundary of high grayscale and the amount of supplementary light before and after adjustment, the low grayscale boundary response and high grayscale boundary response in the light reduction direction are determined. When the effective grayscale boundary is not lower than the dark end protection boundary, the effective grayscale boundary is not higher than the saturation end protection boundary, and the effective grayscale dynamic range is lower than the target effective dynamic range, restricted detection of the brightening direction and the dimming direction is performed, and the adjustment direction is determined according to the change of the effective grayscale dynamic range of the brightening direction and the dimming direction.
[0010] In some specific embodiments, after adjusting the fill light drive amount and acquiring the feedback image, the method further includes: Verify whether the images before and after the limited detection meet the following requirements: consistent imaging parameters, regional position deviation not exceeding the preset allowable value, change in supplementary light driving amount not less than the minimum effective change, stable supplementary light output, and consistent trigger timing. When all conditions are met, the low grayscale boundary response and the high grayscale boundary response are written into the valid response record according to the brightening direction and the dimming direction, respectively. When either condition is not met, the images before and after are discarded and the images are re-acquired. When the number of valid response records in the same direction is less than the preset number, the next limited detection is limited by the noise margin of repeated acquisition. When the number of valid response records in the same direction is more than the preset number, a double-boundary response interval is formed according to the distribution range of the most recent valid response records. When consecutive new records exceed the double-boundary response range and noise margin, the original range is cleared and the restricted detection is re-executed.
[0011] In some specific embodiments, forming a double-boundary response interval based on the distribution range of the most recent valid response records further includes: In the direction of brightening, based on the relative relationship between the upper and lower boundaries of the high grayscale boundary response range and the low grayscale boundary response range, a conservative response difference lower boundary and a conservative response difference upper boundary are formed, and the conservative response difference range is defined by the conservative response difference lower boundary and the conservative response difference upper boundary. The double-boundary response category is determined based on the comparison between the lower bound of the conservative response difference, the upper bound of the conservative response difference, and the response judgment margin. When the lower bound of the conservative response difference is greater than the response judgment margin, it is determined to be an extended category. When the conservative response difference interval overlaps with the turning range defined by the response judgment margin, it is determined to be a turning category. When the upper bound of the conservative response difference is lower than the lower limit of the turning range defined by the response judgment margin, it is determined to be a compression category. The response determination margin is determined based on the repeated acquisition fluctuations, minimum effective change, and preset safety factor of the low grayscale effective boundary and high grayscale effective boundary when the supplementary light driving amount is fixed.
[0012] In some specific embodiments, after determining the double-boundary response category based on the comparison relationship between the lower bound of the conservative response difference, the upper bound of the conservative response difference, and the response judgment margin, the method further includes: When the dual-boundary response category is the extended category, the dark end supplementary lighting requirement is determined based on the state of the low gray effective boundary relative to the dark effective boundary and the low gray boundary response range, and the dynamic range supplementary lighting requirement is determined based on the state of the effective gray dynamic range relative to the target effective dynamic range and the lower bound of the conservative response difference. The lower bound of the driving change is determined based on the dark end illumination requirements and the dynamic range illumination requirements. The upper limit of the drive change is determined based on the state of the high grayscale effective boundary relative to the saturation end protection boundary, the high grayscale boundary response range, the hardware allowable range of the supplementary light drive quantity, and the single control limit. When the lower limit of the drive change is not greater than the upper limit of the drive change, the feasible range of the supplementary light drive amount is defined by the lower limit and the upper limit of the drive change. When the lower limit of the drive change is greater than the upper limit of the drive change, the output is an empty feasible range.
[0013] In some specific embodiments, after outputting the empty feasible interval, the following is also included: Once the fill light driving amount under the extended category and the fill light driving amount under the transition or compression category have been obtained, the fill light working range is established using the fill light driving amount under the extended category and the fill light driving amount under the transition or compression category. When the supplementary light driving amount under the extended category and the supplementary light driving amount under the transition or compression category have not been obtained simultaneously, restricted brightness enhancement detection or restricted brightness reduction detection is performed in the direction that satisfies the dark end protection boundary and saturation end protection boundary constraints. After completing the restricted detection, select states from the collected states where the effective boundary of low grayscale is not lower than the dark end protection boundary and the effective boundary of high grayscale is not higher than the saturation end protection boundary; When a filtered state exists, the formal detection supplementary light driving amount is determined based on the effective grayscale dynamic range of each filtered state. When no filtered state exists, the current supplementary light driving amount is maintained and the supplementary light adjustment abnormality result is output.
[0014] In some specific embodiments, updating the interval endpoints according to the double-boundary response category further includes: Candidate supplementary lighting driving quantities are determined based on the supplementary lighting working range, and executable driving quantity constraints are applied according to the minimum adjustment resolution to acquire candidate images; The candidate image is paired with the image corresponding to the lower end of the supplementary lighting working range to determine the dual-boundary response category. When the dual-boundary response category is the extended category and the high grayscale effective boundary is lower than the saturation end protection boundary, the lower endpoint is updated with the candidate supplementary light driving amount; When the dual-boundary response category is a transition or compression category, or when the effective high grayscale boundary is not lower than the saturation end protection boundary, the higher endpoint is updated with the candidate supplementary light driving amount. Repeatedly update the interval endpoints. When the interval width is not greater than the minimum adjustment resolution, determine the formal detection supplementary light driving amount based on the supplementary light working interval.
[0015] In some specific embodiments, the low grayscale boundary response and the high grayscale boundary response are written into the effective response record according to the enhancement direction and the reduction direction, respectively, further including: The detection formula, imaging parameters, supplementary lighting mode, region type, and the low grayscale effective boundary, high grayscale effective boundary, and effective grayscale dynamic range of the initial image are matched against historical records item by item. When all matches, load the valid response record in the same direction; when any does not match, re-execute the restricted probe. When the new double-boundary response is within the allowable range of the double-boundary response interval and the noise margin limit, the new double-boundary response is added to the valid response record and the earliest record is removed. When the new double-boundary response continuously exceeds the allowable range, the original record is cleared and the valid response record is reconstructed. When the change in the fill light driving amount reaches the minimum effective change amount, and the changes in the effective boundaries of low grayscale and high grayscale are both within the noise margin range, the increase in the fill light driving amount is stopped and the abnormal fill light response result is output.
[0016] Based on the same concept, the present invention also provides an automatic brightness adjustment system for a visual system supplementary lighting based on the dynamic range of an image grayscale histogram, comprising: The boundary acquisition module is configured to acquire the supplementary light driving amount and grayscale histogram, and determine the effective boundary of low grayscale, the effective boundary of high grayscale, and the effective grayscale dynamic range according to the tail exclusion ratio; The response recording module is configured to adjust the amount of fill light driving and acquire feedback images, determine the low grayscale boundary response and high grayscale boundary response based on the changes in the low grayscale effective boundary and high grayscale effective boundary, and save the effective response records. The category determination module is configured to form a dual-boundary response interval from the valid response records, form a conservative response difference boundary based on the relative relationship between the low grayscale boundary response interval and the high grayscale boundary response interval, and determine the expansion, transition or compression category by comparing it with the response judgment margin. The feasible range formation module is configured to determine the lower bound of the driving change based on the effective boundary of low grayscale, the effective boundary of dark area, the effective grayscale dynamic range, the effective dynamic range of the target and the response range of low grayscale boundary, and to determine the upper bound of the driving change based on the effective boundary of high grayscale, the saturation end protection boundary, the response range of high grayscale boundary and the supplementary light control constraint, thereby forming a feasible range of changes in the supplementary light driving amount. The working interval update module is configured to establish a supplementary lighting working interval based on the driving quantities before and after the transition when the category changes from expansion to transition or compression. It acquires images according to the candidate supplementary lighting driving quantities, updates the interval endpoints according to the double boundary response category, and outputs the officially detected supplementary lighting driving quantity when the interval width is not greater than the minimum adjustment resolution.
[0017] Compared with existing technologies, its advantages are as follows: This invention discloses a method and system for automatically adjusting the brightness of a visual system's fill light based on the dynamic range of an image's grayscale histogram. The method determines the effective boundaries of low and high grayscale from the grayscale histogram according to the tail exclusion ratio, and determines the effective grayscale dynamic range accordingly. This reduces the impact of a small number of extremely dark noise pixels and extremely bright abnormal pixels on the evaluation of the image's dynamic range, and enables the image state used for fill light adjustment to reflect the effective distribution of the subject's grayscale region.
[0018] Based on the actual changes in the effective low-grayscale boundary and the effective high-grayscale boundary during the adjustment of the supplementary light driving amount, the low-grayscale boundary response and the high-grayscale boundary response are determined respectively. Based on the relative relationship between the low-grayscale boundary response range and the high-grayscale boundary response range, the expansion, transition or compression category is determined. This can identify the effectiveness of continuing to adjust the supplementary light before obvious saturation or dynamic range compression occurs.
[0019] By using multiple sets of valid response records to form a double-boundary response interval, and forming a conservative response difference boundary based on the relative relationship of the response intervals, and combining the response judgment margin with repeated acquisition fluctuation calibration, image noise, local reflection changes and response fluctuations can be included in the category judgment, reducing the impact of single boundary fluctuations on the adjustment results.
[0020] The lower bound of the driving change is determined based on the effective boundary of the dark area and the effective dynamic range of the target, and the upper bound of the driving change is determined based on the saturation end protection boundary, the high grayscale boundary response range, and the supplementary light control constraints. This makes the candidate supplementary light driving amount subject to the requirements of the effective dark area, the dynamic range, the bright area saturation protection, and the hardware control conditions, thereby reducing the risk of supplementary light adjustment exceeding the limits.
[0021] When the category changes from expansion to transition or compression, a supplementary lighting working range is established, and the dual-boundary response category is determined using the real feedback image corresponding to the candidate supplementary lighting driving amount. The endpoints of the supplementary lighting working range are updated according to the dual-boundary response category, so that the determination of the formal detection supplementary lighting driving amount is continuously constrained by the actual imaging response, thereby reducing the excessive illumination and round-trip correction caused by fixed step size adjustment.
[0022] The valid response records are verified by checking the consistency of imaging parameters, the location of the detection area, the change in the amount of supplementary light driving, the status of supplementary light output, and the triggering sequence. Combined with historical response reuse, response interval reconstruction, and supplementary light response anomaly handling, the stability and verifiability of the supplementary light adjustment process under different acquisition conditions are improved. Attached Figure Description
[0023] Other features, objects, and advantages of this application will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings: Figure 1 This is a flowchart illustrating some specific embodiments of the present invention's method for automatically adjusting the brightness of a visual system's supplementary lighting based on the dynamic range of an image's grayscale histogram. Figure 2 This is a schematic diagram of the structure of the automatic brightness adjustment system for the visual system based on the dynamic range of the image grayscale histogram in some specific embodiments of the present invention. Detailed Implementation
[0024] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0025] The terminology used in the embodiments of this application is for the purpose of describing particular embodiments only and is not intended to limit the application. The singular forms "a," "the," and "the" as used in the embodiments of this application are also intended to include the plural forms, unless the context clearly indicates otherwise, and "multiple" generally includes at least two.
[0026] It should be understood that the term "and / or" used in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.
[0027] It should be understood that although the terms first, second, third, etc., may be used in the embodiments of this application, these descriptions should not be limited to these terms. These terms are only used to distinguish the descriptions. For example, first may also be referred to as second without departing from the scope of the embodiments of this application, and similarly, second may also be referred to as first.
[0028] Depending on the context, the words “if” or “suppose” as used here can be interpreted as “when” or “in response to determination” or “in response to detection.” Similarly, depending on the context, the phrases “if determination” or “if detection (of the stated condition or event)” can be interpreted as “when determination” or “in response to determination” or “when detection (of the stated condition or event)” or “in response to detection (of the stated condition or event).”
[0029] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that an article or device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such an article or device. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the article or device that includes said element.
[0030] It should be noted that any symbols and / or numbers present in the specification that are not marked in the accompanying drawings are not reference numerals.
[0031] This embodiment is applicable to scenarios requiring improved imaging quality using supplementary lighting, such as industrial vision inspection, dimensional measurement, defect identification, positioning guidance, and surface quality inspection. The vision system may include an industrial camera, lens, LED supplementary lighting, supplementary lighting driver, triggering device, and image processing device. The supplementary lighting driver controls the output intensity of the supplementary lighting according to the supplementary lighting drive quantity, which can be represented by pulse width modulation duty cycle, current setpoint, digital level value, or equivalent control quantity.
[0032] Within a single brightness adjustment cycle, the camera exposure time, analog gain, digital gain, lens aperture, and image preprocessing method remain constant, ensuring that the primary controllable grayscale variation between adjacent images originates from changes in the supplementary lighting drive. For stationary objects, a grayscale histogram can be statistically analyzed within a fixed detection area; for moving objects or objects with slight positional deviations, adjacent images can be registered based on trigger positions, positioning markers, or template matching results. For example, the allowable registration error can be set to 2px; when the registration error exceeds 2px, the corresponding detection area is re-acquired.
[0033] The amount of supplemental light driving is denoted as Its hardware allowable range is The effective boundary of low grayscale is denoted as... The effective boundary of high grayscale is denoted as The effective grayscale dynamic range is denoted as The low-gray-level effective boundary represents the lower boundary of the effective gray-level distribution in the dark areas of the image, while the high-gray-level effective boundary represents the upper boundary of the effective gray-level distribution in the bright areas of the image. The low-gray-level boundary response is denoted as... The high grayscale boundary response is denoted as .
[0034] The current image and its boundary data are formed after the current supplementary light driving amount stabilizes and image acquisition is completed; the feedback image and its boundary data are formed after the supplementary light driving amount changes, the supplementary light output stabilizes, and the corresponding effective trigger is completed; historical effective response records are called when the detection formula, imaging parameters, supplementary light mode, and region type meet the matching conditions. Only feedback data with successful image acquisition, corresponding trigger, and region position deviation meeting the requirements are used for updating the dual-boundary response interval.
[0035] Reference Figure 1 An automatic brightness adjustment method for visual system supplementary lighting based on the dynamic range of image grayscale histograms includes: S101, acquire the fill light driving amount and grayscale histogram, and determine the effective boundary of low grayscale, the effective boundary of high grayscale and the effective grayscale dynamic range according to the tail exclusion ratio; S102, adjust the fill light driving amount and acquire feedback image, determine the low grayscale boundary response and high grayscale boundary response based on the changes in the low grayscale effective boundary and high grayscale effective boundary, and save the effective response record; S103, a dual-boundary response interval is formed from the effective response records. A conservative response difference boundary is formed based on the relative relationship between the low grayscale boundary response interval and the high grayscale boundary response interval. The expansion, transition or compression category is determined by comparing it with the response judgment margin. S104. The lower bound of the driving change is determined based on the effective boundary of low grayscale, the effective boundary of dark area, the effective grayscale dynamic range, the effective dynamic range of target and the response range of low grayscale boundary. The upper bound of the driving change is determined based on the effective boundary of high grayscale, the protection boundary of saturation end, the response range of high grayscale boundary and the supplementary light control constraint, thus forming the feasible variation range of supplementary light driving amount. S105, when the category changes from expansion to transition or compression, establish the supplementary light working interval with the driving amount before and after the transition, acquire images according to the candidate supplementary light driving amount, update the interval endpoints according to the double boundary response category, and output the officially detected supplementary light driving amount when the interval width is not greater than the minimum adjustment resolution.
[0036] To provide a clearer explanation, the steps in the embodiments of the present invention are described in detail below: S101, acquire the fill light driving amount and grayscale histogram, and determine the effective boundary of low grayscale, the effective boundary of high grayscale and the effective grayscale dynamic range according to the tail exclusion ratio; Furthermore, the current fill light driving amount and the current image are obtained, and gray-level statistics are performed on the detection area of the current image to obtain a gray-level histogram; Cumulative normalization is performed on the grayscale histogram, and the effective boundaries of low grayscale and high grayscale are determined according to the tail exclusion ratio. The effective grayscale dynamic range is determined based on the effective low-grayscale boundary and the effective high-grayscale boundary, and the tail exclusion ratio and related boundary parameters are calibrated based on repeatedly acquired images.
[0037] In this embodiment, the image processing device reads the current fill light driving amount from the fill light driver. subscript This indicates the current adjustment status. After the supplemental lighting output stabilizes, the camera acquires the current image under fixed exposure time, fixed gain, and fixed aperture conditions. When the current image is a color image, a grayscale image can be generated according to a fixed color conversion relationship; the color conversion relationship remains unchanged within the same adjustment cycle.
[0038] Let the maximum allowed grayscale value of a grayscale image be... grayscale value The number of pixels is Then the normalized cumulative gray distribution of the current detection area can be expressed as: ; in, Indicates that the grayscale value is not greater than The proportion of the number of pixels in the detection area to the total number of pixels; The grayscale values that participate in the accumulation; This represents the upper limit of grayscale. For an 8-bit grayscale image, an example value is... .
[0039] Let the tail exclusion ratio be Then the effective boundary of low grayscale The effective boundary of high grayscale is the grayscale value at which the cumulative grayscale distribution first reaches the low grayscale cumulative ratio threshold. This refers to the grayscale value at which the cumulative grayscale distribution first reaches the high grayscale cumulative proportion threshold corresponding to the high grayscale tail exclusion. When the cumulative proportion threshold is directly set using the tail exclusion proportion, it can be expressed as: ; ; The effective grayscale dynamic range of the current state is determined based on the grayscale span between the low-grayscale effective boundary and the high-grayscale effective boundary, and then... Image frame identifier , It is stored in association with the current effective grayscale dynamic range for subsequent boundary response determination.
[0040] The tail exclusion ratio can be calibrated by repeatedly acquiring images of a stable target. For example, under stable supplementary lighting conditions, 20 frames of images are continuously acquired, and candidate tail exclusion ratios of 0.5%, 1%, 1.5%, and 2% are used to determine the effective low-grayscale boundary and the effective high-grayscale boundary, respectively. When the inter-frame fluctuations of the effective low-grayscale boundary and the effective high-grayscale boundary are below a preset fluctuation limit and the main grayscale region remains within the effective statistical range, the corresponding candidate tail exclusion ratio is selected. In one example, a ratio can be taken as... .
[0041] To create the protective conditions required for subsequent adjustments, a dark end protection boundary can also be set. Effective boundary of dark areas Effective boundary of bright area saturation end protection boundary and the target's effective dynamic range .
[0042] Dark end protection boundary It can be determined based on the dark field image acquired under the exposure time and gain conditions used in the formal inspection. The dark end protection boundary is determined based on the gray mean, gray standard deviation and dark noise protection factor of the detection area in the dark field image. The dark noise protection factor can be calibrated in the range of 3 to 5 according to the camera noise level, for example, 4.
[0043] Effective boundary of dark areas Calibration can be performed using representative samples containing actual dark textures, dark defects, or dark edges. As the supplementary lighting drive is progressively increased, when the dark area detection result reaches the preset detection requirements, the corresponding low-grayscale effective boundary is recorded, and a conservative value is selected from multiple representative sample records as the effective dark area boundary.
[0044] Effective boundary of bright part and saturation end protection boundary Calibration can be performed using high-reflectivity areas or representative bright area samples. Before the proportion of maximum grayscale pixels increases significantly, a protection margin should be retained, and the effective boundaries of dark areas, bright areas, and saturation end protection boundaries should be arranged sequentially in the direction of increasing grayscale.
[0045] Target effective dynamic range It can be determined by a set of reference images that meet the detection requirements, such as taking the lower quantile or the lowest pass value of the effective grayscale dynamic range of each reference image.
[0046] For moving objects under test, the detection region can be registered between the current image and the previous image, and then the grayscale histogram can be calculated. The registration result is saved in association with the current image; when the registration error exceeds a preset allowable value, the corresponding detection region is re-acquired. After the current grayscale state is determined, the current supplementary lighting driving amount is obtained. Current effective low-grayscale boundary Current effective grayscale boundary The current effective grayscale dynamic range and the corresponding image frame identifier.
[0047] Alternatively, a fixed number of pixels can be used to create a boundary corresponding to the tail exclusion ratio. For example, when the detection area contains 100,000 pixels and When doing so, the 1000 pixels with the lowest grayscale and the 1000 pixels with the highest grayscale can be excluded separately, and then the effective low-grayscale boundaries and effective high-grayscale boundaries of the remaining pixels can be determined.
[0048] S102, adjust the fill light driving amount and acquire feedback image, determine the low grayscale boundary response and high grayscale boundary response based on the changes in the low grayscale effective boundary and high grayscale effective boundary, and save the effective response record; Furthermore, the limited brightness enhancement detection conditions are determined based on the current grayscale boundary state; Determine the restricted light reduction detection conditions based on the current grayscale boundary state; When the effective boundaries of low grayscale and high grayscale satisfy the corresponding protection constraints and the effective grayscale dynamic range is lower than the target effective dynamic range, the restricted detection of the brightening direction and the dimming direction is performed and the adjustment direction is determined. Verify the validity of images, supplementary lighting drive amount, and acquisition status before and after limited detection; A double-boundary response interval is formed based on the number and distribution of valid response records; Maintain or rebuild valid response records based on the relationship between newly added responses and existing double-boundary response intervals; The reuse status of historical valid response records is determined based on the detection formula, imaging parameters, supplementary lighting mode, region type, and initial boundary state.
[0049] In this embodiment, when the current low grayscale effective boundary Furthermore, the current effective boundary of high grayscale is lower than the saturation end protection boundary. At this time, limited illumination detection is performed. The initial detection change can be determined as a percentage of the hardware-allowed range of the supplemental illumination drive amount. For example, this percentage can be 1% to 3%, such as 2%. The initial detection change must meet the requirement of not being lower than the minimum adjustment resolution of the driver. And it does not exceed the preset maximum single detection measurement. After the supplementary light drive amount increases, the control device waits for the supplementary light output to stabilize and for the corresponding frame to be triggered by the camera before acquiring the feedback image.
[0050] For the Group enhancement detection, assuming the supplementary light drive amounts before and after adjustment are respectively... and ,and Then the low-grayscale boundary response and high-grayscale boundary response in the enhancement direction are respectively: ; ; in, This represents the change in the effective low-grayscale boundary corresponding to a unit increase in supplementary light driving amount. This represents the change in the effective grayscale boundary corresponding to the unit increase in supplementary light driving amount.
[0051] When the current high grayscale effective boundary And the current effective boundary of low grayscale At that time, limited light reduction detection is performed. Let the change in the supplementary light driving amount in the light reduction direction be... Then the low grayscale boundary response and high grayscale boundary response in the dimming direction are respectively: ; ; Effective response records for the brightness enhancement and dimming directions are saved separately to reflect the actual response differences between the two directions and to accommodate directional differences caused by factors such as hysteresis of the supplementary light driver, thermal state of the light source, and local reflection changes of the measured object. For the dimming direction, the changing trend of the effective grayscale dynamic range can be determined based on the relative relationship between the low-grayscale boundary response and the high-grayscale boundary response.
[0052] when , And the current effective grayscale dynamic range is lower than Within the protection constraints, limited detection of the enhancement and reduction directions is performed separately. The adjustment direction is determined based on the effective grayscale dynamic range changes formed by the feedback images of the enhancement and reduction directions. When the difference between the enhancement and reduction directions is within the noise tolerance range, the adjustment direction can be determined based on the remaining margin from the hardware drive boundary.
[0053] Before a set of valid response records enters the dual-boundary response interval determination process, at least the following conditions must be met: the exposure time, gain, aperture, and grayscale conversion method before and after adjustment are consistent; the detection area corresponds to the same physical area; the area position deviation does not exceed the preset allowable value; the change in the supplementary light driving amount is not less than the minimum effective change; the supplementary light output is stable; and the image trigger corresponds to the supplementary light driving state. It can also detect severe motion blur or large-area occlusion.
[0054] For example, the minimum effective change can be twice the minimum adjustment resolution of the driver, and the stabilization waiting time for the supplementary light can be 20ms. The specific values can be determined based on the response time calibration results of the supplementary light driver. When any validity condition is not met, the corresponding image is discarded and re-acquired. The number of re-acquisitions can be set to 3; if a valid image pair cannot be formed after 3 consecutive attempts, the current safe supplementary light drive level is maintained and an acquisition anomaly flag is output.
[0055] The most recent 3 to 7 sets of valid response records can be used to form the current set of valid response records. When there are fewer than 3 sets of valid response records in the same direction, the noise margin of repeated acquisition is used to limit the next restricted detection; when the number of valid response records in the same direction reaches a preset number, a double-boundary response interval is formed based on the distribution range of the most recent valid response records.
[0056] The median and median absolute deviation can also be used to filter out anomalies in valid response records. The medians of low-grayscale boundary responses and high-grayscale boundary responses are determined separately, and corresponding screening limits are formed based on the absolute deviation of each valid response record relative to its corresponding median and a screening coefficient. For example, the screening coefficient can be set to 3.
[0057] When both the low-grayscale and high-grayscale boundary responses of the same image pair are within the corresponding filtering limits, the paired record is retained; when either boundary response exceeds the corresponding filtering limit, the paired record is discarded. When the number of retained records reaches a preset number, a dual-boundary response interval is formed based on the distribution range of the retained records; when the number of retained records does not reach the preset number, limited detection is maintained and valid response records are reacquired. When the median absolute deviation is 0, the minimum filtering limit determined based on the fluctuations of the repeated acquisition boundary can be used to reduce the impact of normal quantization fluctuations on the filtering results.
[0058] When a new double-boundary response falls within the allowable range defined by the double-boundary response interval and noise margin, the new double-boundary response is added to the valid response record and the oldest record is removed. When a new double-boundary response continuously exceeds the allowable range, the original record is cleared and a valid response record is reconstructed. For example, reconstruction can be performed when two or more consecutive new responses exceed the allowable range, allowing the double-boundary response interval to be updated according to changes in light source temperature, product surface condition, or local reflection.
[0059] Historical valid response records can be pre-stored in the local configuration area or the status cache of the control device. When reusing historical valid response records, the tested product or test formula remains consistent, the camera and lens configuration remains consistent, the exposure parameters and gain parameters remain consistent, the supplementary lighting mode remains consistent, the area type corresponds to the same type of target area, and the low grayscale effective boundary, high grayscale effective boundary, and effective grayscale dynamic range of the initial image are matched against the historical records item by item.
[0060] When all matches, load the valid response record in the same direction; when any does not match, re-execute the restricted probe. For example, when the deviations of the current initial low grayscale valid boundary, high grayscale valid boundary, and valid grayscale dynamic range from the corresponding historical boundary center do not exceed twice the corresponding historical fluctuation range, it can be determined that the initial boundary state meets the reuse requirements.
[0061] After loading the historical valid response record, when the new double boundary response is within the historical double boundary response range and the allowable range of the noise margin limit, the new double boundary response is added to the valid response record and the earliest record is removed; when the new double boundary response continuously exceeds the allowable range, reuse is stopped and the valid response record is rebuilt.
[0062] When the change in the supplementary light driving amount reaches the minimum effective change amount, and the changes in both the low-grayscale effective boundary and the high-grayscale effective boundary are within the noise margin range, the increase in the supplementary light driving amount is stopped and an abnormal supplementary light response result is output. For example, when the supplementary light driving amount has accumulated a change of at least twice the minimum effective change amount, and the changes in both the low-grayscale effective boundary and the high-grayscale effective boundary are still within the repeated acquisition noise range, it can be determined that the current image lacks an effective response to the supplementary light change, and a prompt is made to check the supplementary light driver execution status, optical path occlusion, trigger correspondence, or ambient light interference.
[0063] S103, a dual-boundary response interval is formed from the effective response records. A conservative response difference boundary is formed based on the relative relationship between the low grayscale boundary response interval and the high grayscale boundary response interval. The expansion, transition or compression category is determined by comparing it with the response judgment margin. Furthermore, based on the valid response records, low grayscale boundary response intervals and high grayscale boundary response intervals are formed; The lower bound and upper bound of the conservative response difference are formed based on the relative relationship between the upper and lower bounds of the low grayscale boundary response interval and the high grayscale boundary response interval. The dual-boundary response category is determined by comparing the lower bound of the conservative response difference, the upper bound of the conservative response difference, and the response judgment margin. The response judgment margin is determined based on the repeated sampling boundary fluctuation, the minimum effective change, and the preset safety factor.
[0064] In this embodiment, for the enhancement direction, the lower and upper limits of the most recent effective low grayscale boundary response record are respectively denoted as... and The lower and upper limits of the most recent valid high-grayscale boundary response record are denoted as follows: and .
[0065] The lower bound and upper bound of the conservative response difference are expressed as follows: ; ; in, The conservative response difference lower bound characterizes the trend of conservative dynamic range changes that can still be obtained when using lower high grayscale boundary responses and higher low grayscale boundary responses. The upper bound of the conservative response difference characterizes the upper limit of the dynamic range change that may be achieved under the current local operating conditions. The lower and upper bounds of the conservative response difference define the conservative response difference interval.
[0066] Let the response determination margin be... .when When the conservative response difference interval overlaps with the transition range defined by the response judgment margin, it is determined to be an extended category; when the conservative response difference interval overlaps with the transition range defined by the response judgment margin, it is determined to be a transition category; when When that happens, it is determined to be a compression category.
[0067] Determining the normal fluctuation of the effective grayscale boundary by repeatedly acquiring images under a fixed supplementary lighting drive. and normal fluctuation of the effective boundary of high grayscale The response judgment margin is calibrated based on the minimum effective change and a preset safety factor. The response judgment margin can be expressed as: ; in, This represents the normal fluctuation amount of the effective boundary of low grayscale. This represents the normal fluctuation amount of the effective boundary of high grayscale. The minimum effective change; A preset safety factor greater than 1. For example, .when , , At that time, the response judgment margin is 0.36.
[0068] For the dimming direction, the effective response records for the dimming direction can be used to form corresponding low-grayscale boundary response intervals and high-grayscale boundary response intervals, and the dual-boundary response category for the dimming direction can be determined based on the relative relationship between the low-grayscale boundary response intervals and the high-grayscale boundary response intervals. The corresponding effective response records for the dimming and dimming directions are saved and retrieved separately.
[0069] When there are a large number of valid records, the conservative quantile values of the response records can be used to form the endpoints of the double-boundary response interval. For example, when there are more than 7 groups of valid records, the 10th percentile and 90th percentile values can be used as the lower and upper limits of the corresponding response interval, respectively, and abnormal records can be screened in conjunction with the aforementioned median absolute deviation.
[0070] Each time a dual-boundary response category is formed, the adjustment cycle identifier, image frame identifier, fill light drive amount, effective low grayscale boundary, effective high grayscale boundary, effective grayscale dynamic range, low grayscale boundary response range, high grayscale boundary response range, lower bound of conservative response difference, upper bound of conservative response difference, response judgment margin, response direction, and dual-boundary response category can be written into the operation log for subsequent review.
[0071] S104. The lower bound of the driving change is determined based on the effective boundary of low grayscale, the effective boundary of dark area, the effective grayscale dynamic range, the effective dynamic range of target and the response range of low grayscale boundary. The upper bound of the driving change is determined based on the effective boundary of high grayscale, the protection boundary of saturation end, the response range of high grayscale boundary and the supplementary light control constraint, thus forming the feasible variation range of supplementary light driving amount. Furthermore, the lower bound of the driving change is determined based on the state of the effective boundary of low grayscale relative to the effective boundary of dark area, the state of the effective grayscale dynamic range relative to the effective dynamic range of target, and the corresponding response information. The upper limit of the drive change is determined based on the state of the high grayscale effective boundary relative to the saturation end protection boundary, the high grayscale boundary response range, the hardware allowable range of the supplementary light drive quantity, and the single control limit. The feasible variation range of the supplementary light driving amount is formed based on the lower and upper bounds of the driving change. When the feasible range of the supplementary light driving amount is empty and the supplementary light driving amount under the extended category and the supplementary light driving amount under the turning or compression category have been obtained, the supplementary light working range is formed. When the supplementary lighting drive required to form the supplementary lighting working area has not yet been obtained simultaneously, restricted detection is performed in the direction that satisfies the protection boundary constraints. The appropriate supplementary lighting drive quantity or output supplementary lighting adjustment abnormality result is determined based on the limited detection and the collected data.
[0072] In this embodiment, for the brightening direction, when the effective boundary of the low grayscale is lower than the effective boundary of the dark area and the response of the low grayscale boundary meets the effective condition, the dark end supplementary lighting requirement can be expressed as: ; in, To meet the need for supplemental lighting in dark areas, As the effective boundary of the dark area, This represents the current effective boundary for low grayscale. This represents the lower limit of the low grayscale boundary response range in the direction of brightening.
[0073] When the effective grayscale dynamic range is lower than the target effective dynamic range and the lower bound of the conservative response difference meets the effective condition, the dynamic range supplementary lighting requirement can be expressed as: ; in, To meet the needs of dynamic range illumination, For the effective dynamic range of the target, This represents the current effective grayscale dynamic range. This is a conservative lower bound for the response difference.
[0074] When the corresponding target is met, the corresponding supplemental lighting requirement is zero. The lower bound of the driving change is determined based on the dark-end supplemental lighting requirement and the dynamic range supplemental lighting requirement: ; in, To drive the lower bound of change.
[0075] The permissible driving change before the effective high-grayscale boundary reaches the saturation end protection boundary can be expressed as: ; in, This represents the allowable driving variation corresponding to the saturation end protection constraint. To protect the saturation end boundary, This represents the current effective boundary of high grayscale. This represents the upper limit of the high grayscale boundary response range in the brightening direction.
[0076] Let the remaining variation allowed by the hardware for the supplementary light drive be... The single-use control limit is Then the upper bound of the driving change can be expressed as: ; in, To drive the upper bound of change; The corresponding hardware allowable range for the supplementary light drive quantity; This corresponds to a single control constraint. For example, It can be set to 5% of the supplementary light drive range, or set to no more than 100 drive units, and further calibrated according to the actual control performance of the supplementary light driver.
[0077] when At that time, the lower and upper bounds of the driving change define the feasible range of the supplementary light driving amount. After the candidate driving change amount is constrained by the minimum adjustment resolution, it remains within the feasible range of the supplementary light driving amount.
[0078] For the light reduction direction, the light reduction requirement can be determined based on the state of the high grayscale effective boundary relative to the bright part effective boundary, and the allowable light reduction amount can be limited based on the state of the low grayscale effective boundary relative to the dark end protection boundary. The feasible range of variation of the light reduction direction can be formed by combining the hardware allowable range of the supplementary light drive amount and the single control limit.
[0079] When the lower bound of the drive change is greater than the upper bound of the drive change, an empty feasible interval is output. When the fill light drive amount under the extended category and the fill light drive amount under the transition or compression category have been obtained, the fill light working interval is established using the fill light drive amount under the extended category and the fill light drive amount under the transition or compression category.
[0080] When the supplementary light driving amount under the extended category and the supplementary light driving amount under the transition or compression category have not been obtained simultaneously, restricted brightness enhancement detection or restricted brightness reduction detection is performed in the direction that satisfies the dark end protection boundary and saturation end protection boundary constraints.
[0081] For example, when the brightness enhancement direction is constrained by the saturation end protection boundary, limited dimming detection can be performed under the condition that the effective low-grayscale boundary satisfies the dark end protection boundary constraint; when the dimming direction is constrained by the dark end protection boundary, limited brightness enhancement detection can be performed under the condition that the effective high-grayscale boundary satisfies the saturation end protection boundary constraint. When both the effective low-grayscale boundary and the effective high-grayscale boundary are higher than the effective bright boundary, limited detection of the brightness enhancement and dimming directions can be performed separately, and the adjustment direction can be determined based on the changes in the effective grayscale dynamic range and protection margin of the brightness enhancement and dimming directions.
[0082] After completing the restricted detection, select states from the acquired states where the effective low-grayscale boundary is not lower than the dark-end protection boundary and the effective high-grayscale boundary is not higher than the saturation-end protection boundary. When a selected state exists, determine the formal detection supplementary lighting driving amount based on the effective grayscale dynamic range of each selected state.
[0083] When multiple selected states have the same maximum effective grayscale dynamic range, the state with the smallest change in the corresponding supplementary light driving amount can be selected, or the state with the corresponding supplementary light driving amount that is close to the current supplementary light driving amount can be selected as the formally detected supplementary light driving amount. When no selected state exists, the current supplementary light driving amount is maintained and the supplementary light adjustment anomaly result is output.
[0084] For calculations involving response values as the denominator, valid conditions for the corresponding response parameters can be set. When the low grayscale boundary response, high grayscale boundary response, or conservative response difference parameter are in the noise-dominated range, the process switches to the limited detection or supplementary lighting working range update process to avoid excessively large driving change estimations caused by small responses.
[0085] S105, when the category changes from expansion to transition or compression, establish the supplementary light working interval with the driving amount before and after the transition, acquire images according to the candidate supplementary light driving amount, update the interval endpoints according to the double boundary response category, and output the officially detected supplementary light driving amount when the interval width is not greater than the minimum adjustment resolution.
[0086] Furthermore, The supplementary light working range is formed based on the supplementary light driving amount under the extended category and the supplementary light driving amount under the transition or compression category, and candidate supplementary light driving amounts are determined. Acquire candidate images corresponding to candidate supplementary lighting driving quantities, form image pairs with the images corresponding to the lower endpoint of the supplementary lighting working range, and determine the dual-boundary response category; When the dual-boundary response category is the extended category and the high grayscale effective boundary is lower than the saturation end protection boundary, the lower endpoint is updated with the candidate supplementary light driving amount; When the dual-boundary response category is a transition or compression category, or when the effective high grayscale boundary is not lower than the saturation end protection boundary, the higher endpoint is updated with the candidate supplementary light driving amount. Repeatedly update the interval endpoints. When the interval width is not greater than the minimum adjustment resolution, determine the formal detection supplementary light driving amount based on the supplementary light working interval.
[0087] In this embodiment, the fill light driving amount under the extended category is set to... The amount of fill light driven under the transition or compression category is and satisfy ,by and These serve as the two endpoints of the supplementary lighting work zone.
[0088] Candidate supplementary light driving quantities can be determined based on the middle position of the supplementary light working range, and executable driving quantity constraints can be applied according to the minimum adjustment resolution. When the quantized candidate supplementary light driving quantity coincides with an existing endpoint, adjacent unsampled executable driving levels can be selected between the endpoints of the supplementary light working range.
[0089] Adjust the supplementary light driver to the candidate supplementary light driving level, and acquire candidate images after the supplementary light output stabilizes. Pair the candidate images with the images corresponding to the lower endpoint of the supplementary light working range, and determine the dual-boundary response category based on the changes in the effective low-grayscale and high-grayscale boundaries with the supplementary light driving level. Once the candidate images meet the aforementioned requirements of consistent imaging parameters, region location, supplementary light driving level variation, stable supplementary light output, and trigger timing, they are used for range endpoint updates.
[0090] When the image pair corresponds to the dual boundary response category as the transition category, a low-side confirmation drive amount that is lower than the candidate supplementary light drive amount and is within the supplementary light working range, and a high-side confirmation drive amount that is higher than the candidate supplementary light drive amount and is within the supplementary light working range can be set respectively, and the low-side confirmation drive amount and the high-side confirmation drive amount can be kept at a preset confirmation step size with the candidate supplementary light drive amount respectively.
[0091] Let the preset confirmation step size be... The low-side confirmation drive quantity and the high-side confirmation drive quantity are located on the low side and high side of the candidate fill light drive quantity, respectively, and both remain within the fill light working range. For example, the preset confirmation step size can be set to twice the minimum adjustment resolution; when the width of the fill light working range is insufficient to accommodate the corresponding confirmation step size, a smaller executable confirmation step size can be determined based on the current range width, for example, determined based on one-quarter of the fill light working range width and quantized to the executable drive level.
[0092] Confirmation images corresponding to the low-side confirmation driving quantity and the high-side confirmation driving quantity are acquired separately, and the corresponding double-boundary response categories are determined. When the double-boundary response category corresponding to the low-side confirmation driving quantity is an extended category, and the double-boundary response category corresponding to the high-side confirmation driving quantity is a transition or compression category, the interval endpoints are updated with the low-side confirmation driving quantity and the high-side confirmation driving quantity. When both the low-side confirmation driving quantity and the high-side confirmation driving quantity correspond to extended categories, the lower endpoint is updated with the high-side confirmation driving quantity. When both the low-side confirmation driving quantity and the high-side confirmation driving quantity correspond to transition or compression categories, the higher endpoint is updated with the low-side confirmation driving quantity.
[0093] If any confirmed image fails to meet the validity criteria, a new confirmed image is acquired according to the aforementioned validity criteria. For example, if a valid confirmed image cannot be formed after three consecutive attempts, the previous supplementary lighting working range is restored, and the range endpoints are updated based on valid candidate images.
[0094] When the dual-boundary response category corresponding to the candidate fill light driving quantity is the extended category and the high grayscale effective boundary of the candidate state is lower than the saturation end protection boundary, the candidate fill light driving quantity and its corresponding image state are updated to the lower end of the fill light working range.
[0095] When the dual-boundary response category corresponding to the candidate supplementary lighting driving quantity is a transition or compression category, or when the effective high grayscale boundary of the candidate state is not lower than the saturation end protection boundary, the candidate supplementary lighting driving quantity and its corresponding image state are updated to the higher end of the supplementary lighting working range.
[0096] When the width of the supplementary lighting working interval is not greater than the minimum adjustment resolution, the interval endpoint update is stopped, and the formal detection supplementary lighting driving amount is determined based on the supplementary lighting working interval. Specifically, the supplementary lighting driving amount that meets the requirements of dark end protection boundary, saturation end protection boundary, and effective grayscale dynamic range can be selected from the acquired states within the supplementary lighting working interval.
[0097] A stable termination condition can also be set. When a candidate state simultaneously meets the requirements for the target's effective dynamic range, effective dark boundary, and effective bright boundary, and remains stable in images for a consecutive preset number of frames, the formal detection fill light driving amount is determined. For example, the consecutive frame number can be 3 to 5 frames. The fill light working range update can also be terminated when the effective grayscale dynamic range improvement is lower than the minimum effective improvement amount determined by the repeated acquisition noise.
[0098] Once the supplementary light drive amount for formal testing is determined, the supplementary light driver maintains the corresponding output state, and the camera acquires images for formal testing. The supplementary light drive amount for formal testing, the effective low-grayscale boundary, the effective high-grayscale boundary, the effective grayscale dynamic range, the final double-boundary response category, and the stopping conditions are saved as historical references for the next brightness adjustment of the same testing product or the same testing formula.
[0099] The above process will be illustrated using a set of numerical values. An 8-bit grayscale image is used, with the upper limit of grayscale... The supplementary lighting drive range is 0 to 1000, and the tail exclusion ratio is... The dark end protection boundary was obtained after calibration. Effective boundary of dark areas Effective boundary of bright area saturation end protection boundary Target effective dynamic range .
[0100] Current fill light driving amount The effective low-grayscale boundary is obtained based on the current image. High grayscale effective boundary The corresponding effective grayscale dynamic range is 193.
[0101] Currently, the effective boundary for low grayscale is lower than the effective boundary for dark areas, and the effective boundary for high grayscale is lower than the saturation end protection boundary; therefore, limited illumination enhancement detection is performed. Based on recent effective response records, the response range for low grayscale boundaries is 0.14 to 0.16, and the response range for high grayscale boundaries is 0.52 to 0.60. All effective response records meet the validity conditions of consistent imaging parameters, satisfactory detection area positional deviation, minimum effective change in supplementary illumination drive amount, stable supplementary illumination output, and corresponding image triggering.
[0102] The conservative response difference lower bound is 0.36, and the conservative response difference upper bound is 0.46, determined based on the low-grayscale boundary response range and the high-grayscale boundary response range. When the calibrated response judgment margin is less than 0.36, the current dual-boundary response category is the extended category.
[0103] The dark end illumination requirement, determined based on the effective dark area boundary, is approximately 42.86; the dynamic range illumination requirement, determined based on the target's effective dynamic range, is approximately 61.11; and the allowable illumination gain, determined based on the saturation end protection boundary, is approximately 71.67. When both the remaining hardware drive quantity and the single-use control limit are not less than 71.67, the lower limit of drive change is 61.11, and the upper limit of drive change is 71.67.
[0104] Candidate values of change are determined based on the feasible range of the supplementary light driving amount and constrained according to the minimum adjustment resolution. For example, if the candidate value of change is 66, then the candidate supplementary light driving amount is 486.
[0105] Based on the current response range estimate, the effective low-grayscale boundary of the candidate state is approximately between 21.24 and 22.56, and the effective high-grayscale boundary is approximately between 239.32 and 244.60, which are within the corresponding protection range.
[0106] The fill light driving amount is set to 486, and candidate images are acquired. For example, the actual effective low-grayscale boundary is 22, the effective high-grayscale boundary is 241, and the corresponding effective grayscale dynamic range is 219, satisfying the requirements for target effective dynamic range, effective dark area boundary, and effective bright area boundary. When the corresponding boundaries of three consecutive frames remain stable, 486 can be determined as the formal detection fill light driving amount.
[0107] When the dual-boundary response category of the subsequent candidate state enters the transition category, the supplementary lighting working interval is established based on the supplementary lighting driving amount under the extended category and the supplementary lighting driving amount under the transition category. The endpoints of the supplementary lighting working interval are updated according to the dual-boundary response category corresponding to the candidate image until the interval width meets the minimum adjustment resolution requirement.
[0108] For the purpose of simplicity, the method steps disclosed in the above embodiments are described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.
[0109] like Figure 2 As shown, the present invention also provides an automatic brightness adjustment system for visual system supplementary lighting based on the dynamic range of image grayscale histogram, comprising: The boundary acquisition module 201 is configured to acquire the supplementary light driving amount and grayscale histogram, and determine the effective boundary of low grayscale, the effective boundary of high grayscale, and the effective grayscale dynamic range according to the tail exclusion ratio; The response recording module 202 is configured to adjust the amount of supplementary light driving and acquire feedback images, determine the low grayscale boundary response and high grayscale boundary response based on the changes in the low grayscale effective boundary and high grayscale effective boundary, and save the effective response record; The category determination module 203 is configured to form a dual-boundary response interval from the effective response records, form a conservative response difference boundary based on the relative relationship between the low grayscale boundary response interval and the high grayscale boundary response interval, and determine the extended, turning or compressed category by comparing it with the response judgment margin. The feasible range forming module 204 is configured to determine the lower bound of the driving change based on the effective boundary of low grayscale, the effective boundary of dark area, the effective grayscale dynamic range, the effective dynamic range of the target and the response range of low grayscale boundary, and to determine the upper bound of the driving change based on the effective boundary of high grayscale, the saturation end protection boundary, the response range of high grayscale boundary and the supplementary light control constraint, thereby forming a feasible range of changes in the supplementary light driving amount. The working interval update module 205 is configured to establish a supplementary lighting working interval based on the driving amounts before and after the transition when the category changes from expansion to transition or compression. It acquires images according to candidate supplementary lighting driving amounts, updates the interval endpoints according to the dual-boundary response category, and outputs the officially detected supplementary lighting driving amount when the interval width is not greater than the minimum adjustment resolution. It is worth noting that although only some basic functional modules are disclosed in this embodiment, it does not mean that the composition of this system is limited to the above-mentioned basic functional modules. On the contrary, based on the above-mentioned basic functional modules, those skilled in the art can arbitrarily add one or more functional modules in combination with existing technology to form an infinite number of embodiments or technical solutions. That is to say, this system is open rather than closed. The fact that this embodiment only discloses a few basic functional modules does not mean that the scope of protection of this invention is limited to the disclosed basic functional modules. Furthermore, for ease of description, the above device is described by function as various units and modules. Of course, in implementing this invention, the functions of each unit and module can be implemented in one or more software and / or hardware.
[0110] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for automatically adjusting the brightness of a visual system's supplementary lighting based on the dynamic range of an image's grayscale histogram, characterized in that, include: Obtain the fill light driving amount and grayscale histogram, and determine the effective boundary of low grayscale, effective boundary of high grayscale, and effective grayscale dynamic range according to the tail exclusion ratio; Adjust the fill light driving amount and acquire feedback images. Determine the low grayscale boundary response and high grayscale boundary response based on the changes in the low grayscale effective boundary and high grayscale effective boundary, and save the effective response record. The effective response records form a dual-boundary response interval. The conservative response difference boundary is formed based on the relative relationship between the low grayscale boundary response interval and the high grayscale boundary response interval. The expansion, transition or compression category is determined by comparing it with the response judgment margin. The lower bound of the driving change is determined based on the effective boundary of low grayscale, the effective boundary of dark area, the effective grayscale dynamic range, the effective dynamic range of target, and the response range of low grayscale boundary. The upper bound of the driving change is determined based on the effective boundary of high grayscale, the protection boundary of saturation end, the response range of high grayscale boundary, and the supplementary light control constraint, thus forming the feasible variation range of supplementary light driving amount. When the category changes from expansion to transition or compression, the supplementary lighting working range is established based on the driving amount before and after the transition. Images are acquired according to the candidate supplementary lighting driving amount, and the range endpoints are updated according to the dual boundary response category. When the range width is not greater than the minimum adjustment resolution, the officially detected supplementary lighting driving amount is output.
2. The method for automatically adjusting the brightness of a visual system's supplementary lighting based on the dynamic range of an image's grayscale histogram, as described in claim 1, is characterized in that... The effective boundaries of low grayscale, high grayscale, and effective grayscale dynamic range are determined based on the tail exclusion ratio, and further include: The cumulative ratio is formed based on the pixel distribution of each gray level; Based on the tail exclusion ratio, a low grayscale cumulative ratio threshold and a high grayscale cumulative ratio threshold corresponding to the high grayscale tail exclusion are set. The grayscale level where the cumulative ratio first reaches the low grayscale cumulative ratio threshold is taken as the effective boundary of low grayscale, and the grayscale level where the cumulative ratio first reaches the high grayscale cumulative ratio threshold is taken as the effective boundary of high grayscale. The effective grayscale dynamic range is determined based on the positional relationship between the effective grayscale boundary and the effective grayscale boundary. Under a fixed supplementary light driving amount, the target image is repeatedly acquired and the candidate tail exclusion ratio is increased in turn. When the inter-frame fluctuation of the low gray level effective boundary and the high gray level effective boundary is lower than the preset fluctuation limit and the main gray level area is still preserved, the corresponding candidate tail exclusion ratio is selected.
3. The method for automatically adjusting the brightness of a visual system's supplementary lighting based on the dynamic range of an image's grayscale histogram, as described in claim 1, is characterized in that... Adjusting the fill light drive amount and acquiring feedback images further includes: When the effective boundary of low grayscale is lower than the effective boundary of dark area and the effective boundary of high grayscale is lower than the saturation end protection boundary, restricted brightness enhancement detection is performed; When the effective boundary of high grayscale is higher than the effective boundary of bright area and the effective boundary of low grayscale is higher than the protective boundary of dark end, restricted light reduction detection is performed. Based on the corresponding changes of the effective boundary of low grayscale, effective boundary of high grayscale and the amount of supplementary light before and after adjustment, the low grayscale boundary response and high grayscale boundary response in the light reduction direction are determined. When the effective grayscale boundary is not lower than the dark end protection boundary, the effective grayscale boundary is not higher than the saturation end protection boundary, and the effective grayscale dynamic range is lower than the target effective dynamic range, restricted detection of the brightening direction and the dimming direction is performed, and the adjustment direction is determined according to the change of the effective grayscale dynamic range of the brightening direction and the dimming direction.
4. The method for automatically adjusting the brightness of a visual system's supplementary lighting based on the dynamic range of an image's grayscale histogram, as described in claim 3, is characterized in that... After adjusting the fill light drive and acquiring the feedback image, the process also includes: Verify whether the images before and after the limited detection meet the following requirements: consistent imaging parameters, regional position deviation not exceeding the preset allowable value, change in supplementary light driving amount not less than the minimum effective change, stable supplementary light output, and consistent trigger timing. When all conditions are met, the low grayscale boundary response and the high grayscale boundary response are written into the valid response record according to the brightening direction and the dimming direction, respectively. When either condition is not met, the images before and after are discarded and the images are re-acquired. When the number of valid response records in the same direction is less than the preset number, the next limited detection is limited by the noise margin of repeated acquisition. When the number of valid response records in the same direction is more than the preset number, a double-boundary response interval is formed according to the distribution range of the most recent valid response records. When consecutive new records exceed the double-boundary response range and noise margin, the original range is cleared and the restricted detection is re-executed.
5. The method for automatically adjusting the brightness of a visual system's supplementary lighting based on the dynamic range of an image's grayscale histogram, as described in claim 4, is characterized in that... The double-boundary response interval is formed based on the distribution range of the most recent valid response records, and further includes: In the direction of brightening, based on the relative relationship between the upper and lower boundaries of the high grayscale boundary response range and the low grayscale boundary response range, a conservative response difference lower boundary and a conservative response difference upper boundary are formed, and the conservative response difference range is defined by the conservative response difference lower boundary and the conservative response difference upper boundary. The double-boundary response category is determined based on the comparison between the lower bound of the conservative response difference, the upper bound of the conservative response difference, and the response judgment margin. When the lower bound of the conservative response difference is greater than the response judgment margin, it is determined to be an extended category. When the conservative response difference interval overlaps with the turning range defined by the response judgment margin, it is determined to be a turning category. When the upper bound of the conservative response difference is lower than the lower limit of the turning range defined by the response judgment margin, it is determined to be a compression category. The response determination margin is determined based on the repeated acquisition fluctuations, minimum effective change, and preset safety factor of the low grayscale effective boundary and high grayscale effective boundary when the supplementary light driving amount is fixed.
6. The method for automatically adjusting the brightness of a visual system's supplementary lighting based on the dynamic range of an image's grayscale histogram, as described in claim 5, is characterized in that... After determining the double-boundary response category based on the comparison relationship between the lower bound of the conservative response difference, the upper bound of the conservative response difference, and the response judgment margin, the following steps are also included: When the dual-boundary response category is the extended category, the dark end supplementary lighting requirement is determined based on the state of the low gray effective boundary relative to the dark effective boundary and the low gray boundary response range, and the dynamic range supplementary lighting requirement is determined based on the state of the effective gray dynamic range relative to the target effective dynamic range and the lower bound of the conservative response difference. The lower bound of the driving change is determined based on the dark end illumination requirements and the dynamic range illumination requirements. The upper limit of the drive change is determined based on the state of the high grayscale effective boundary relative to the saturation end protection boundary, the high grayscale boundary response range, the hardware allowable range of the supplementary light drive quantity, and the single control limit. When the lower limit of the drive change is not greater than the upper limit of the drive change, the feasible range of the supplementary light drive amount is defined by the lower limit and the upper limit of the drive change. When the lower limit of the drive change is greater than the upper limit of the drive change, the output is an empty feasible range.
7. The method for automatically adjusting the brightness of a visual system's supplementary lighting based on the dynamic range of an image's grayscale histogram, as described in claim 6, is characterized in that... After outputting the empty feasible interval, it also includes: Once the fill light driving amount under the extended category and the fill light driving amount under the transition or compression category have been obtained, the fill light working range is established using the fill light driving amount under the extended category and the fill light driving amount under the transition or compression category. When the supplementary light driving amount under the extended category and the supplementary light driving amount under the transition or compression category have not been obtained simultaneously, restricted brightness enhancement detection or restricted brightness reduction detection is performed in the direction that satisfies the dark end protection boundary and saturation end protection boundary constraints. After completing the restricted detection, select states from the collected states where the effective boundary of low grayscale is not lower than the dark end protection boundary and the effective boundary of high grayscale is not higher than the saturation end protection boundary; When a filtered state exists, the formal detection supplementary light driving amount is determined based on the effective grayscale dynamic range of each filtered state. When no filtered state exists, the current supplementary light driving amount is maintained and the supplementary light adjustment abnormality result is output.
8. The method for automatically adjusting the brightness of a visual system's supplementary lighting based on the dynamic range of an image's grayscale histogram, as described in claim 1, is characterized in that... Update interval endpoints according to the double-boundary response category, further including: Candidate supplementary lighting driving quantities are determined based on the supplementary lighting working range, and executable driving quantity constraints are applied according to the minimum adjustment resolution to acquire candidate images; The candidate image is paired with the image corresponding to the lower end of the supplementary lighting working range to determine the dual-boundary response category. When the dual-boundary response category is the extended category and the high grayscale effective boundary is lower than the saturation end protection boundary, the lower endpoint is updated with the candidate supplementary light driving amount; When the dual-boundary response category is a transition or compression category, or when the effective high grayscale boundary is not lower than the saturation end protection boundary, the higher endpoint is updated with the candidate supplementary light driving amount. Repeatedly update the interval endpoints. When the interval width is not greater than the minimum adjustment resolution, determine the formal detection supplementary light driving amount based on the supplementary light working interval.
9. The method for automatically adjusting the brightness of a visual system's supplementary lighting based on the dynamic range of an image's grayscale histogram, as described in claim 4, is characterized in that... The low-grayscale boundary response and high-grayscale boundary response are written into the effective response record according to the enhancement direction and the reduction direction, respectively, and further include: The detection formula, imaging parameters, supplementary lighting mode, region type, and the low grayscale effective boundary, high grayscale effective boundary, and effective grayscale dynamic range of the initial image are matched against historical records item by item. When all matches, load the valid response record in the same direction; when any does not match, re-execute the restricted probe. When the new double-boundary response is within the allowable range of the double-boundary response interval and the noise margin limit, the new double-boundary response is added to the valid response record and the earliest record is removed. When the new double-boundary response continuously exceeds the allowable range, the original record is cleared and the valid response record is reconstructed. When the change in the fill light driving amount reaches the minimum effective change amount, and the changes in the effective boundaries of low grayscale and high grayscale are both within the noise margin range, the increase in the fill light driving amount is stopped and the abnormal fill light response result is output.
10. A visual system supplementary lighting brightness automatic adjustment system based on the dynamic range of image grayscale histogram, characterized in that, include: The boundary acquisition module is configured to acquire the supplementary light driving amount and grayscale histogram, and determine the effective boundary of low grayscale, the effective boundary of high grayscale, and the effective grayscale dynamic range according to the tail exclusion ratio; The response recording module is configured to adjust the amount of fill light driving and acquire feedback images, determine the low grayscale boundary response and high grayscale boundary response based on the changes in the low grayscale effective boundary and high grayscale effective boundary, and save the effective response records. The category determination module is configured to form a dual-boundary response interval from the valid response records, form a conservative response difference boundary based on the relative relationship between the low grayscale boundary response interval and the high grayscale boundary response interval, and determine the expansion, transition or compression category by comparing it with the response judgment margin. The feasible range formation module is configured to determine the lower bound of the driving change based on the effective boundary of low grayscale, the effective boundary of dark area, the effective grayscale dynamic range, the effective dynamic range of the target and the response range of low grayscale boundary, and to determine the upper bound of the driving change based on the effective boundary of high grayscale, the saturation end protection boundary, the response range of high grayscale boundary and the supplementary light control constraint, thereby forming a feasible range of changes in the supplementary light driving amount. The working interval update module is configured to establish a supplementary lighting working interval based on the driving quantities before and after the transition when the category changes from expansion to transition or compression. It acquires images according to the candidate supplementary lighting driving quantities, updates the interval endpoints according to the double boundary response category, and outputs the officially detected supplementary lighting driving quantity when the interval width is not greater than the minimum adjustment resolution.
