An image processing method for improving a glare and shadow environment

By employing region segmentation and feature extraction algorithms, combined with a dynamic compensation focusing strategy, the image processing problem under glare and shadow environments is solved, enabling accurate identification of aircraft outlines and vehicle equipment, and ensuring the real-time performance and accuracy of apron safety monitoring.

CN120807378BActive Publication Date: 2025-11-18CHENGDU NUOBIKAN TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511307740.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-15
Publication Date
2025-11-18
Estimated Expiration
2045-09-15

AI Technical Summary

Technical Problem

Existing image processing methods cannot simultaneously address the overexposure issues in glare areas and the low contrast issues in shadow areas under glare and shadow environments. This results in blurred key features such as aircraft outlines, jet bridge status, and vehicle equipment. The transition boundary between shadow and non-shadow areas is not accurately identified, affecting the accuracy of aircraft type identification and distance measurement. Sudden changes in illumination in dynamic scenes can easily cause loss of image features, leading to delayed obstacle warnings or false alarms, which threatens the safety of apron operations.

Method used

The region segmentation algorithm accurately divides the shadow and non-shadow regions. The feature extraction method is used to calculate the gray value and variance of the shadow region. The mapping relationship between shadow features and focusing parameters is established. The focus offset and convergence speed are dynamically adjusted. Combined with the contrast change of the dynamic compensation algorithm, the focus offset and contrast change trend are dynamically adjusted to realize the contrast monitoring of shadow features during the focusing process. The edge enhancement algorithm of the shadow region is implemented to accurately lock the shadow edge position.

Benefits of technology

In environments with glare and shadows, it can accurately distinguish aircraft fuselages, jet bridges, and vehicle targets from background shadows, improve image quality, ensure the accuracy of aircraft type identification and distance measurement, monitor the positioning status of apron equipment and personnel behavior in real time, and improve the real-time performance and accuracy of image processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120807378B_ABST
    Figure CN120807378B_ABST
Patent Text Reader

Abstract

The application discloses a kind of for promoting image processing method under glare, shadow environment, comprising: using dynamic compensation algorithm to focus point offset amount is adjusted in real time, by monitoring the change trend of contrast value and the convergence state of definition index in focusing process, the correctness of current focusing direction and the suitability of focusing amplitude are judged;The transition characteristics of shadow and non-shadow area are analyzed by shadow edge enhancement algorithm, the direction and amplitude of focus point transformation are dynamically adjusted, and the real position locking result of shadow edge is obtained;For the edge sharpness distribution parameter after promotion, the focus consistency of overall image is verified using feature matching algorithm, and the evaluation result of global focus quality is obtained by calculating the definition difference between different regions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of image processing technology, specifically a method for improving image processing under glare and shadow environments. Background Technology

[0002] In the Airport Intelligent Parking Guidance System (A-VDGS) and the Integrated Apron Safety Management System, image recognition technology needs to achieve high-precision aircraft type identification, distance measurement, obstacle detection, and personnel and vehicle monitoring under complex lighting conditions. As an open-air operating environment, the apron is easily affected by direct sunlight, cloud cover, building shadows, and ground reflections, resulting in severe glare and shadow areas in the images.

[0003] Existing image processing methods have significant limitations when dealing with such scenarios: First, global focusing strategies cannot simultaneously address the overexposure in glare areas and the low contrast in shadow areas, resulting in blurred key features such as aircraft outlines, jet bridge status, and vehicle equipment. Second, the transition boundary between shadow and non-shadow areas is not accurately identified, affecting aircraft type identification (such as misjudging fuselage details) and distance measurement accuracy (errors exceeding the 50cm / 20cm / 10cm classification requirements). Third, in dynamic scenes (such as aircraft taxiing or vehicles passing through), sudden changes in illumination can easily cause image feature loss, leading to delayed obstacle warnings or false alarms, threatening apron operation safety.

[0004] In addition, the shadows of apron equipment (such as high-mast lights and jet bridges) change dynamically over time, making it difficult for traditional static image processing algorithms to adapt in real time. This causes the analysis unit to fail to monitor the positioning status of the equipment and personnel violations, as well as reduce the accuracy of guidance and ranging.

[0005] Therefore, there is an urgent need for a processing method that can optimize image quality in glare and shadow environments to meet the high requirements of intelligent berth guidance systems for real-time performance, accuracy, and robustness. Summary of the Invention

[0006] The purpose of this invention is to provide an image processing method for improving image processing under glare and shadow environments, in order to solve the problems in the prior art mentioned in the background art, such as the inability to take into account overexposure in glare areas, inaccurate identification of transition boundaries between shadow and non-shadow areas, and the easy loss of image features caused by sudden changes in illumination.

[0007] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows:

[0008] A method for improving image processing in glare and shadow environments, the method comprising:

[0009] The original image data under glare and shadow conditions is acquired, and the image is accurately divided into shadow and non-shadow areas through a region segmentation algorithm. Based on the gray-scale distribution characteristics of pixels and the difference in neighborhood contrast, the boundary coordinates and region identification information of each region are determined.

[0010] For the shaded areas in the area identification information, the feature extraction method is used to calculate the average gray value and gray variance of each shaded area. By analyzing the statistical characteristics of the gray distribution and the histogram shape parameters, the quantitative value of the shadow intensity and the depth recognition result are obtained.

[0011] Based on the shadow intensity and depth recognition results, a parameter mapping table between shadow features and focusing parameters is established. If the shadow intensity is lower than the preset shallow threshold, a small step focusing mode is adopted; if the shadow intensity is higher than the preset deep threshold, a large step focusing mode is adopted.

[0012] By configuring the focusing parameters in the parameter mapping table, differentiated focus offset calculations are performed for different shadow areas. Based on the shadow depth level and area weight, the focus offset and convergence speed parameters for each area are determined.

[0013] A dynamic compensation algorithm is used to adjust the focus offset in real time. By monitoring the trend of contrast value changes and the convergence status of sharpness index during focusing, the correctness of the current focusing direction and the appropriateness of the focusing amplitude are determined.

[0014] If the contrast value shows an upward trend and the sharpness index continues to improve, the current focusing parameters are maintained and fine-tuning is performed. If the contrast value decreases or the sharpness index stabilizes, the focusing action in the current direction is stopped and a shadow edge enhancement algorithm is introduced.

[0015] By analyzing the transition characteristics between shadow and non-shadow areas using a shadow edge enhancement algorithm, and dynamically adjusting the direction and magnitude of focus transformation, the true position locking result of the shadow edge is obtained.

[0016] For the improved edge sharpness distribution parameters, a feature matching algorithm is used to verify the focus consistency of the overall image. By calculating the sharpness differences between different regions, the evaluation result of the global focus quality is obtained.

[0017] If the evaluation results show that the focus difference between regions exceeds the preset tolerance range, the local dynamic compensation algorithm is re-executed based on the evaluation results. The focus offset is adjusted through the dynamic compensation algorithm until all shadow areas and non-shadow areas reach a focus balance state, and the final clear image output is obtained.

[0018] According to the above technical solution, the original image data under glare and shadow environments is acquired. A region segmentation algorithm is used to accurately divide the image into shadow and non-shadow regions. Based on the grayscale distribution characteristics of pixels and the difference in neighborhood contrast, the boundary coordinates and region identification information of each region are determined, including:

[0019] The raw image data under glare environment is acquired, and the image data is processed by the preprocessing module to remove noise and equalize brightness, so as to obtain standardized image data.

[0020] The standardized image data is processed using a grayscale conversion algorithm to calculate the grayscale value distribution of each pixel and obtain complete pixel grayscale matrix information.

[0021] The neighborhood contrast value between adjacent pixels is calculated based on the pixel grayscale matrix information. If the neighborhood contrast value exceeds a preset threshold, it is determined that there is a clear boundary of illumination change in the area.

[0022] The region growing algorithm is used to perform cluster analysis on pixels with illumination change boundaries, and pixels with similar grayscale features are merged into the same region identifier to obtain preliminary region segmentation results.

[0023] A boundary detection method is used to extract the boundary coordinates of the preliminary region segmentation results, and the sequence of contour coordinate points of each segmented region is calculated to obtain accurate boundary coordinate data;

[0024] Based on boundary coordinate data and feature analysis, if the gray level distribution within the region is uniform and the contrast difference is small, then the region is marked as a non-shaded region; if the gray level value within the region is low and the contrast difference with the surrounding region is large, then the region is marked as a shaded region.

[0025] By assigning a unique identifier to each segmented region through a region identifier allocation mechanism, a database of correspondences between region identifiers and boundary coordinates is established, thus completing the task of accurately dividing the shaded and unshaded regions.

[0026] According to the above technical solution, for the shaded areas in the area identification information, a feature extraction method is used to calculate the average gray value and gray value variance of each shaded area. By analyzing the statistical characteristics of the gray value distribution and the histogram shape parameters, the quantitative value of the shadow intensity and the depth recognition result are obtained, including:

[0027] Obtain the coordinate range of the shadow area from the region identifier information, extract the grayscale pixel values ​​of each shadow area by pixel traversal, and obtain the complete grayscale dataset of the shadow area;

[0028] Statistical methods were used to process the grayscale dataset, calculating the average grayscale value μ and grayscale variance for each shaded region. , where μ represents the mean gray level of the pixels within the region. It indicates the degree of dispersion of gray values ​​and determines the basic statistical characteristics of shaded areas;

[0029] Based on statistical characteristics, grayscale histograms of each shaded region are constructed. By analyzing the histograms, shape parameters such as peak position, distribution width, and skewness are obtained, thus revealing the grayscale distribution pattern of the shaded region.

[0030] If the peak position in the shape parameter is lower than the preset threshold and the distribution width is narrow, then the shadow area is determined to be a high-intensity shadow, and the corresponding intensity quantization value is obtained.

[0031] The K-means clustering algorithm is used to classify the quantified values. The shadow intensity level is divided according to the distance between the cluster centers, and the depth level identifier of each shadow region is determined by the level mapping.

[0032] By analyzing the correlation between depth level identifiers and grayscale variance, if the variance value exceeds the preset range, the feature parameters of the region are recalculated to obtain the corrected shadow intensity evaluation result.

[0033] Based on the evaluation results, an intensity distribution map of the shadow area is generated, and the quantization value and depth level information of each area are marked to obtain complete shadow feature recognition data.

[0034] According to the above technical solution, based on the shadow intensity and depth recognition results, a parameter mapping table between shadow features and focusing parameters is established. If the shadow intensity is lower than a preset shallow threshold, a small-step focusing mode is adopted; if the shadow intensity is higher than a preset deep threshold, a large-step focusing mode is adopted, including:

[0035] The raw image data acquired by the image sensor is obtained, and the shadow intensity distribution matrix of each pixel is calculated through grayscale values.

[0036] Based on the shadow intensity distribution matrix, the gradient algorithm is used to calculate the depth information of the shadow region and obtain the shadow depth feature vector;

[0037] The shadow depth feature vector is compared with a preset shallow threshold. If the depth feature value is less than the shallow threshold, the current scene is determined to be in a shallow shadow state.

[0038] Based on the judgment result of the shallow shadow state, the focusing system automatically switches to the small step focusing mode to obtain the corresponding fine focusing parameter group;

[0039] If the shadow depth feature value is greater than the preset depth threshold, the current scene is determined to be in a deep shadow state, and the focusing system switches to the large step focusing mode.

[0040] A support vector machine algorithm was used to train a mapping model between shadow features and focus parameters, resulting in an optimized parameter mapping table.

[0041] The optimal focusing parameters corresponding to the current shadow state are retrieved from the parameter mapping table, and the focusing motor is driven to perform the corresponding focus adjustment operation.

[0042] According to the above technical solution, by configuring the focusing parameters in the parameter mapping table, differentiated focus offset calculations are performed for different shadow areas. Based on the shadow depth level and area weight, the focus offset and convergence speed parameters for each area are determined, including:

[0043] Obtain the focus configuration data from the preset parameter mapping table, parse the basic focus parameters corresponding to each shadow area, and obtain the initial focus parameter set;

[0044] An image segmentation algorithm is used to identify shadow regions in the input image, calculate the boundary coordinates and pixel distribution of each shadow region, and determine the spatial location information of the shadow region.

[0045] Based on the distribution characteristics of pixel grayscale values ​​in the shadow area, the depth level value of each area is calculated. If the average grayscale value is lower than the preset threshold, it is determined to be a deep shadow area, and the depth level is identified.

[0046] The area weight coefficient of each region is calculated by the ratio of the total number of pixels in the shadow region to the total number of pixels in the image, thus obtaining the region area weight parameter matrix.

[0047] A weighted calculation method is used, combining depth level values ​​and area weight coefficients, to calculate the focus offset value of each shadow region and determine the differentiated offset parameters;

[0048] Based on the change in the focus offset value, an adaptive adjustment strategy is used to calculate the convergence speed parameters. If the offset value exceeds the preset range, the convergence speed is reduced to obtain the final convergence control parameters.

[0049] Clustering algorithms are used to optimize the focus offset values ​​and convergence speed parameters of each shadow region, generating a set of precise regional adjustment and control commands.

[0050] According to the above technical solution, a dynamic compensation algorithm is used to adjust the focus offset in real time. By monitoring the trend of contrast value changes and the convergence state of sharpness index during focusing, the correctness of the current focusing direction and the appropriateness of the focusing amplitude are determined, including:

[0051] Obtain the pixel grayscale distribution data of the current image frame, calculate the contrast value and sharpness index of the image frame using the Laplacian operator, and obtain the initial focus state parameters;

[0052] Establish a contrast change trend sequence based on the initial focus state parameters, and use the sliding window method to record the contrast difference between consecutive frames to determine the direction of the current focusing process;

[0053] If the contrast value continues to rise in the direction of the change, it is determined that the current focusing direction is correct and a positive focusing command signal is obtained.

[0054] If the contrast value continues to decrease in the trend direction, it is determined that the current focus direction is incorrect, and a focus direction correction command is generated through the reverse control algorithm.

[0055] The sharpness convergence parameters are calculated based on the focus direction correction command, and the adjustment step size of the focus offset is optimized by the gradient descent method to obtain the dynamic compensation coefficient.

[0056] The focus offset driven by the motor is adjusted in real time by a dynamic compensation coefficient. The impact of the focus amplitude change on the sharpness index is monitored, and the suitability assessment result of the focus amplitude is judged.

[0057] Based on the suitability assessment results, the final focus position control parameters are output to complete the closed-loop control of the entire dynamic compensation focusing process.

[0058] According to the above technical solution, if the contrast value shows an upward trend and the sharpness index continues to improve, the current focusing parameters are maintained and fine-tuning is performed. If the contrast value decreases or the sharpness index stabilizes, the focusing action in the current direction is stopped and a shadow edge enhancement algorithm is introduced, including:

[0059] The system acquires raw image data from the image sensor and calculates the contrast value of the raw image using a contrast detection module.

[0060] Based on the changes in contrast value, a sharpness evaluation algorithm is used to calculate the sharpness value of the current image and obtain the trend of sharpness index changes.

[0061] If the contrast value shows an upward trend and the sharpness value continues to improve, then maintain the current focus parameter settings and obtain the execution command for fine-tuning.

[0062] The lens focal length position is adjusted by fine-tuning, new image data after adjustment is obtained, and the change in the contrast value of the new image data is judged.

[0063] If the contrast value decreases or the sharpness value stabilizes, a stop action command is generated to determine the termination condition for the current focus direction.

[0064] Based on the stop action command, the shadow edge enhancement algorithm is activated to process the current image, resulting in image data with enhanced edges.

[0065] The contrast and sharpness values ​​are recalculated using the edge-enhanced image data to determine the degree of image quality improvement and to determine the final focus parameter configuration.

[0066] Based on the above technical solution, the transition characteristics between shadow and non-shadow areas are analyzed using a shadow edge enhancement algorithm. The direction and amplitude of focus transformation are dynamically adjusted to obtain the true position locking result of the shadow edge, including:

[0067] The original image data is acquired, and the Sobel operator is used to perform edge detection processing on the image to obtain the initial edge response image.

[0068] Based on the gradient intensity distribution in the initial edge response image, the gradient direction angle θ = arctan(Gy / Gx) of each pixel is calculated, where Gx represents the horizontal gradient and Gy represents the vertical gradient, thus obtaining the direction angle matrix.

[0069] By analyzing the angle change rate of adjacent pixels using the orientation angle matrix, if the angle change rate exceeds a preset threshold, it is determined that the region has shadow transition features, and candidate shadow edge regions are obtained.

[0070] For candidate shadow edge regions, the gray value statistical analysis method is used to calculate the mean and standard deviation of pixel gray values ​​in the region. If the mean gray value is lower than the mean of the whole image and the standard deviation is greater than the preset value, then the region is determined to be a real shadow edge, and a shadow edge marker map is obtained.

[0071] Based on the edge pixel distribution in the shadow edge marker map, the center coordinates and transformation radius of the focus transformation are calculated. The sensitivity parameters of edge detection are adjusted by the transformation radius to obtain the optimized edge detection parameters.

[0072] The original image is reprocessed using optimized edge detection parameters. If the detected edge continuity index is higher than the threshold, the edge position is accurately determined, and the final set of shadow edge position coordinates is obtained.

[0073] The edge contour line is constructed by using the final set of shadow edge position coordinates. The contour line is then smoothed using a polynomial fitting method to obtain accurate shadow edge positioning results.

[0074] Based on the above technical solution, a feature matching algorithm is used to verify the focus consistency of the overall image for the improved edge sharpness distribution parameters. By calculating the sharpness differences between different regions, the evaluation result of the global focus quality is obtained, including:

[0075] Obtain the edge sharpness values ​​of each region in the image, calculate the gradient magnitude of each pixel using the gradient operator, and obtain the initial edge sharpness distribution data;

[0076] Based on the initial edge sharpness distribution data, Gaussian filtering is used to eliminate noise interference. If the gradient magnitude exceeds the preset threshold, it is marked as a valid edge point, and the optimized edge sharpness distribution parameters are obtained.

[0077] By using the optimized edge sharpness distribution parameters, the SIFT feature matching algorithm is used to extract key feature points of the image, calculate the Euclidean distance between feature points, and obtain the feature matching metric.

[0078] The image is divided into multiple sub-regions using feature matching metrics. If the difference between the feature matching metrics of adjacent regions is less than a preset difference threshold, the focus consistency of the region is judged to be good, and the focus status of the region is determined.

[0079] Based on the focus status indicators of each region, the variance of sharpness between regions is calculated, and the degree of sharpness difference between different regions is quantified by the analysis of variance method to obtain the regional sharpness difference matrix;

[0080] Using the regional sharpness difference matrix, if the overall variance value is lower than the preset consistency threshold, the global focus quality is judged to be of excellent level, and a global focus quality assessment score is obtained.

[0081] By establishing a focus quality level mapping table through global focus quality assessment scores, the final focus quality level is determined according to the score range, thus obtaining a complete image focus quality assessment result.

[0082] According to the above technical solution, if the evaluation results show that the focus difference between regions exceeds the preset tolerance range, the local dynamic compensation algorithm is re-executed based on the evaluation results. The focus offset is adjusted through the dynamic compensation algorithm until all shadowed and non-shadowed areas reach a focus balance state, obtaining the final clear image output, including:

[0083] The pixel matrix data of the input image is obtained, the boundary between shadow and non-shadow areas in the image is identified by the edge detection algorithm, and the initial focus parameters of each area are determined according to the characteristics of light intensity distribution.

[0084] The focal difference calculation method is used to quantify the difference between the focal values ​​of the shaded area and the focal values ​​of the unshaded area, and obtain the focal deviation data between the regions.

[0085] If the focus difference value exceeds the preset tolerance threshold, the local area compensation mechanism is activated. The focus distribution pattern of each local area is analyzed by the convolutional neural network model to determine the specific area coordinates that need to be compensated.

[0086] Based on the local area coordinate information, the compensation parameters are calculated using the focus offset adjustment algorithm. By adjusting the focus offset of each area, the optimized focus parameter matrix is ​​obtained.

[0087] The original image is subjected to pixel-level focus correction using a focus parameter matrix, and the focus value of each pixel is recalculated using a bilinear interpolation method to obtain the intermediate image data after focus equalization.

[0088] Re-perform focus difference detection on the intermediate image data. If the focus difference in all regions is within the tolerance range, the focus balance state verification is completed, and the final clear image output result is obtained.

[0089] Based on the clear image output, processed data containing focus compensation parameters, region distribution information, and image quality evaluation indicators is generated to complete the entire image focus balancing processing flow.

[0090] Compared with the prior art, the present invention has the following beneficial effects:

[0091] In this invention, shadow region segmentation and feature extraction algorithms are used to accurately distinguish between targets such as aircraft fuselages, boarding bridges, and vehicles and background shadows. Combined with a dynamic compensation focusing strategy, the problems of overexposure caused by glare and low contrast caused by shadows are solved.

[0092] Employing a shadow edge enhancement algorithm and real-time contrast monitoring, the system accurately locates the nose wheel coordinates and speed parameters (continuous output from 0 to stop) during aircraft taxiing, while effectively identifying the movement of personnel and vehicles between the aircraft and guidance equipment. Combined with dynamic compensation closed-loop control, the ROC system ensures real-time, zero-delay monitoring of apron equipment (such as fuel trucks and baggage carts) and jet bridge retraction positions, with alarm response times for violations meeting airport safety management standards. Attached Figure Description

[0093] Figure 1 This is a flowchart of an image processing method for improving image processing under glare and shadow environments according to the present invention;

[0094] Figure 2 This is one of the schematic diagrams of an image processing method for improving image processing under glare and shadow environments according to the present invention;

[0095] Figure 3 This is a second schematic diagram of an image processing method for improving image processing under glare and shadow environments according to the present invention. Detailed Implementation

[0096] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0097] Example 1

[0098] like Figure 1-3 As shown, an image processing method for improving images in glare and shadow environments may specifically include the following steps:

[0099] S101. Obtain the original image data under glare and shadow conditions. Use a region segmentation algorithm to accurately divide the image into shadow and non-shadow regions. Based on the grayscale distribution characteristics of pixels and neighborhood contrast differences, determine the boundary coordinates and region identification information of each region. Specifically:

[0100] The system acquires raw image data under glare conditions. A preprocessing module performs noise filtering and brightness equalization on the image data to obtain standardized image data. A grayscale conversion algorithm is then used to process the standardized image data, calculating the grayscale value distribution of each pixel to obtain complete pixel grayscale matrix information. Based on the pixel grayscale matrix information, the neighborhood contrast value between adjacent pixels is calculated. If the neighborhood contrast value exceeds a preset threshold, it is determined that there is a significant illumination change boundary in that area.

[0101] A region growing algorithm is used to cluster pixels with varying illumination boundaries, merging pixels with similar grayscale features into the same region identifier to obtain preliminary region segmentation results. A boundary detection method is then used to extract boundary coordinates from the preliminary segmentation results, calculating the contour coordinate point sequence of each segmented region to obtain precise boundary coordinate data.

[0102] Based on boundary coordinate data and feature analysis, if the grayscale distribution within a region is uniform and the contrast difference is small, the region is marked as a non-shaded region. If the grayscale value within a region is low and the contrast difference with the surrounding region is large, the region is marked as a shaded region. A region identifier allocation mechanism is used to uniquely identify and encode all segmented regions, establishing a database of correspondence between region identifiers and boundary coordinates, thus completing the task of accurately dividing shaded and non-shaded regions.

[0103] S102. For the shadowed areas in the area identification information, a feature extraction method is used to calculate the average gray value and gray value variance of each shadowed area. By analyzing the statistical characteristics of the gray value distribution and the histogram shape parameters, the quantified value of the shadow intensity and the depth recognition result are obtained. Specifically:

[0104] The coordinate range of the shaded region is obtained from the region identification information. Grayscale pixel values ​​within each shaded region are extracted through pixel traversal to obtain a complete grayscale dataset of the shaded region. Statistical calculation methods are then used to process the grayscale dataset, calculating the average grayscale value μ and grayscale variance σ² for each shaded region. μ represents the mean grayscale value of the pixels within the region, and σ² represents the dispersion of the grayscale values, thus determining the basic statistical characteristics of the shaded region.

[0105] Based on the statistical characteristics, grayscale histograms of each shadow region are constructed. Histogram analysis is used to obtain shape parameters such as peak position, distribution width, and skewness, thus revealing the grayscale distribution pattern of the shadow region. If the peak position in the shape parameters is below a preset threshold and the distribution width is narrow, the shadow region is determined to be a high-intensity shadow, and the corresponding intensity quantification value is obtained. The quantification value is then classified using a K-means clustering algorithm. Shadow intensity levels are determined based on the distance between cluster centers, and the depth level identifier of each shadow region is determined through level mapping.

[0106] By analyzing the correlation between depth level identifiers and grayscale variance, if the variance value exceeds a preset range, the feature parameters of the region are recalculated to obtain a corrected shadow intensity assessment result. Based on the assessment result, an intensity distribution map of the shadow region is generated, and the quantized values ​​and depth level information of each region are marked to obtain complete shadow feature recognition data.

[0107] S103. Based on the shadow intensity and depth recognition results, establish a parameter mapping table between shadow features and focusing parameters. If the shadow intensity is lower than a preset shallow threshold, a small-step focusing mode is used; if the shadow intensity is higher than a preset deep threshold, a large-step focusing mode is used. Specifically:

[0108] The system acquires raw image data from an image sensor and calculates the shadow intensity distribution matrix for each pixel using grayscale values. Based on this matrix, a gradient algorithm is used to calculate the depth information of the shadow region, resulting in a shadow depth feature vector. This feature vector is compared to a preset shallow shadow threshold. If the feature vector is less than the threshold, the scene is determined to be in a shallow shadow state. Based on this, the focusing system automatically switches to a small-step focusing mode and acquires the corresponding fine-tuning parameter set. If the feature vector is greater than the preset deep shadow threshold, the scene is determined to be in a deep shadow state, and the focusing system switches to a large-step focusing mode.

[0109] A support vector machine algorithm is used to train a mapping model between shadow features and focusing parameters, resulting in an optimized parameter mapping table. The optimal focusing parameters corresponding to the current shadow state are then retrieved from the parameter mapping table, driving the focusing motor to perform the corresponding focus adjustment operation.

[0110] S104. By configuring the focusing parameters in the parameter mapping table, perform differentiated focus offset calculations for different shadow areas. Based on the shadow depth level and area weight, determine the focus offset and convergence speed parameters for each area. Specifically:

[0111] The process begins by acquiring focus configuration data from a preset parameter mapping table, parsing the basic focus parameters corresponding to each shadow region, and obtaining an initial set of focus parameters. An image segmentation algorithm is then used to identify shadow regions in the input image, calculating the boundary coordinates and pixel distribution of each shadow region to determine its spatial location. Based on the pixel grayscale value distribution characteristics of the shadow regions, the depth level value of each region is calculated. If the average grayscale value is lower than a preset threshold, it is identified as a deep shadow region, and a depth level identifier is obtained. The area weight coefficient of each region is calculated using the ratio of the total number of pixels in the shadow region to the total number of pixels in the image, resulting in a region area weight parameter matrix. Finally, a weighted calculation method is used, combining the depth level value and the area weight coefficient, to calculate the focus offset value of each shadow region, determining the differentiated offset parameters.

[0112] Based on the variation of the focus offset value, an adaptive adjustment strategy is used to calculate the convergence speed parameters. If the offset value exceeds a preset range, the convergence speed is reduced to obtain the final convergence control parameters. A clustering algorithm is then used to group and optimize the focus offset values ​​and convergence speed parameters of each shaded region, generating a regionalized set of precise adjustment control commands.

[0113] S105. A dynamic compensation algorithm is used to adjust the focus offset in real time. By monitoring the trend of contrast value changes and the convergence state of sharpness index during focusing, the correctness of the current focusing direction and the appropriateness of the focusing amplitude are determined. Specifically:

[0114] The process involves acquiring pixel grayscale distribution data of the current image frame, calculating the contrast and sharpness indices of the image frame using the Laplacian operator, and obtaining initial focus state parameters. Based on these initial focus state parameters, a contrast change trend sequence is established. A sliding window method is used to record the contrast difference between consecutive frames to determine the direction of the current focusing process. If the trend shows a continuous increase in contrast value, the current focusing direction is considered correct, and a positive focusing command signal is obtained. If the trend shows a continuous decrease in contrast value, the current focusing direction is considered incorrect, and a focusing direction correction command is generated using a reverse control algorithm. Based on the focusing direction correction command, sharpness convergence state parameters are calculated, and the gradient descent method is used to optimize the adjustment step size of the focus offset, resulting in a dynamic compensation coefficient.

[0115] The focus offset driven by the motor is adjusted in real time by a dynamic compensation coefficient. The impact of changes in focus amplitude on sharpness is monitored to determine the suitability of the focus amplitude. Based on the suitability assessment results, the final focus position control parameters are output, completing the closed-loop control of the entire dynamic compensation focusing process.

[0116] S106. If the contrast value shows an upward trend and the sharpness index continues to improve, maintain the current focusing parameters and continue fine-tuning. If the contrast value decreases or the sharpness index stabilizes, stop the focusing action in the current direction and introduce a shadow edge enhancement algorithm. Specifically:

[0117] The system acquires raw image data from the image sensor and calculates the contrast value of the raw image using a contrast detection module. Based on the changes in the contrast value, a sharpness evaluation algorithm is used to calculate the sharpness value of the current image, obtaining the trend of the sharpness index. If the contrast value shows an upward trend and the sharpness value continues to improve, the current focus parameter settings are maintained, and a fine-tuning operation is executed.

[0118] The lens focal length is adjusted through fine-tuning, and new image data is acquired after the adjustment. The contrast value of the new image data is then analyzed. If the contrast value decreases or the sharpness value stabilizes, a stop command is generated to determine the termination condition for the current focus direction. Based on the stop command, a shadow edge enhancement algorithm is activated to process the current image, resulting in edge-enhanced image data. The contrast and sharpness values ​​are recalculated using the edge-enhanced image data to assess the degree of image quality improvement and determine the final focus parameter configuration.

[0119] S107. The transition characteristics between shadow and non-shadow areas are analyzed using a shadow edge enhancement algorithm. The direction and amplitude of focus transformation are dynamically adjusted to obtain the true position locking result of the shadow edge. Specifically:

[0120] The original image data is acquired, and edge detection is performed on the image using the Sobel operator to obtain an initial edge response image. Based on the gradient intensity distribution in the initial edge response image, the gradient direction angle of each pixel is calculated, specifically as follows:

[0121] θ = arctan(Gy / Gx)

[0122] Where Gx represents the horizontal gradient and Gy represents the vertical gradient, the direction angle matrix is ​​obtained.

[0123] By analyzing the angular change rate of adjacent pixels using an directional angle matrix, if the angular change rate exceeds a preset threshold, the region is determined to have shadow transition characteristics, resulting in candidate shadow edge regions. For these candidate shadow edge regions, a grayscale statistical analysis method is used to calculate the mean and standard deviation of pixel grayscale values ​​within the region. If the mean grayscale value is lower than the overall image mean and the standard deviation is greater than a preset value, the region is determined to be a true shadow edge, resulting in a shadow edge marker map. Based on the edge pixel distribution in the shadow edge marker map, the center coordinates and transformation radius of the focus transformation are calculated. The sensitivity parameters for edge detection are adjusted using the transformation radius to obtain optimized edge detection parameters.

[0124] The original image is reprocessed using optimized edge detection parameters. If the detected edge continuity index is higher than a threshold, the edge position is considered accurate, and the final set of shadow edge position coordinates is obtained. An edge contour line is constructed using the final set of shadow edge position coordinates, and a polynomial fitting method is used to smooth the contour line, resulting in accurate shadow edge localization.

[0125] S108. For the improved edge sharpness distribution parameters, a feature matching algorithm is used to verify the focus consistency of the overall image. By calculating the sharpness differences between different regions, the evaluation result of the global focus quality is obtained. Specifically:

[0126] The image process involves acquiring edge sharpness values ​​for each region and calculating the gradient magnitude of each pixel using a gradient operator to obtain initial edge sharpness distribution data. Based on this initial distribution, Gaussian filtering is applied to eliminate noise interference. If the gradient magnitude exceeds a preset threshold, it is marked as a valid edge point, resulting in optimized edge sharpness distribution parameters. Using these optimized parameters, the SIFT feature matching algorithm is employed to extract key image features, and the Euclidean distance between these features is calculated to obtain a feature matching metric. The image is then divided into multiple sub-regions using this metric. If the difference in feature matching metrics between adjacent regions is less than a preset difference threshold, the region is considered to have good focus consistency, and its focus status is identified. Based on these focus status identifiers, the inter-region sharpness variance is calculated, and analysis of variance (ANOVA) is used to quantify the degree of sharpness difference between different regions, resulting in a regional sharpness variance matrix. Finally, if the overall variance of this matrix is ​​below a preset consistency threshold, the global focus quality is assessed as excellent, yielding a global focus quality evaluation score. By establishing a focus quality level mapping table through global focus quality assessment scores, the final focus quality level is determined according to the score range, thus obtaining a complete image focus quality assessment result.

[0127] S109. If the evaluation results show that the focus difference between regions exceeds the preset tolerance range, the local dynamic compensation algorithm is re-executed based on the evaluation results. The focus offset is adjusted through the dynamic compensation algorithm until all shadowed and non-shadowed areas reach a focus balance, resulting in the final clear image output. Specifically:

[0128] The pixel matrix data of the input image is acquired. An edge detection algorithm is used to identify the boundaries between shadow and non-shadow regions in the image. Initial focus parameters for each region are determined based on the illumination intensity distribution characteristics. The focus value for the shadow region is then calculated using a focus difference formula. Focus value of non-shaded areas The difference is quantified using the following formula:

[0129]

[0130] in This represents the focus difference value, yielding focus deviation data between regions. If the focus difference value exceeds a preset tolerance threshold... If the local region compensation mechanism is activated, a convolutional neural network model is used to analyze the focal distribution pattern of each local region and determine the coordinates of the specific region requiring compensation. Based on the local region coordinate information, a focal offset adjustment algorithm is used to calculate the compensation parameters, and the focal offset of each region is adjusted using the following formula:

[0131]

[0132] Where α is the adjustment coefficient. Using the region weighting factor, an optimized focus parameter matrix is ​​obtained. Pixel-level focus correction is performed on the original image using the focus parameter matrix, and the focus value of each pixel is recalculated using bilinear interpolation to obtain intermediate image data after focus balancing. Focus difference detection is re-performed on the intermediate image data. If the focus differences in all regions are within the tolerance range, the focus balance state verification is completed, and the final clear image output result is obtained. Based on the clear image output result, processing data containing focus compensation parameters, region distribution information, and image quality evaluation indicators is generated, completing the entire image focus balancing processing flow.

[0133] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.

[0134] Finally, it should be noted that the above descriptions are merely preferred embodiments of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for enhancing image processing in a glare, shadow environment, the method comprising: The method comprises: ​ Obtaining original image data in a glare shadow environment, accurately dividing the shadow area and the non-shadow area of the image through a region segmentation algorithm, determining the boundary coordinates and area identification information of each region according to the gray distribution characteristics and neighborhood contrast difference of the pixel points; For the shadow area in the area identification information, the average gray value and the gray variance of each shadow area are calculated by using a feature extraction method, the quantitative value of the shadow intensity and the depth recognition result are obtained by analyzing the statistical characteristics and histogram shape parameters of the gray distribution; According to the shadow intensity and the depth recognition result, a parameter mapping relationship table between the shadow characteristics and the focusing parameters is established, if the shadow intensity is lower than a preset shallow threshold, a small step focusing mode is adopted, if the shadow intensity is higher than a preset deep threshold, a large step focusing mode is adopted; Through the focusing parameter configuration in the parameter mapping relationship table, the focal point offset calculation of different shadow areas is performed, the focal point offset and the convergence speed parameters of each region are determined according to the shadow depth level and the area area weight; The focal point offset is adjusted in real time by using a dynamic compensation algorithm, the correctness of the current focusing direction and the suitability of the focusing amplitude are judged by monitoring the change trend of the contrast value and the convergence state of the definition index in the focusing process; If the contrast value presents an upward trend and the definition index continuously improves, the current focusing parameter is maintained to continue the fine adjustment operation, if the contrast value decreases or the definition index tends to be stable, the focusing action in the current direction is stopped and a shadow edge enhancement algorithm is introduced; The transition characteristics of the shadow and the non-shadow area are analyzed by the shadow edge enhancement algorithm, the direction and amplitude of the focal point transformation are dynamically adjusted, and the real position locking result of the shadow edge is obtained, including: Obtaining original image data, performing edge detection processing on the image by using a Sobel operator to obtain an initial edge response image; According to the gradient intensity distribution in the initial edge response image, the gradient direction angle θ = arctan (Gy / Gx) of each pixel point is calculated, wherein Gx represents the horizontal direction gradient and Gy represents the vertical direction gradient, to obtain a direction angle matrix; The angle change rate of adjacent pixel points is analyzed through the direction angle matrix, if the angle change rate exceeds a preset threshold, it is judged that the local area where the adjacent pixel points with the angle change rate exceeding the preset threshold are located has shadow transition characteristics, and a candidate shadow edge area is obtained; For the candidate shadow edge area, the gray value statistical analysis method is used to calculate the mean and standard deviation of the pixel gray value in the area, if the mean is lower than the mean of the whole image and the standard deviation is greater than a preset value, the area is determined as the real shadow edge, and a shadow edge marking map is obtained; According to the edge pixel distribution in the shadow edge marking map, the center coordinates and the transformation radius of the focal point transformation are calculated, the sensitivity parameters of the edge detection are adjusted through the transformation radius, and the optimized edge detection parameters are obtained; The original image is reprocessed by using the optimized edge detection parameters, if the continuity index of the detected edge is higher than a threshold, it is judged that the edge position is accurate, and the final shadow edge position coordinate set is obtained; An edge contour line is constructed by the final shadow edge position coordinate set, and a polynomial fitting method is used for smoothing the contour line to obtain an accurate shadow edge positioning result; For the improved edge sharpness distribution parameters, a feature matching algorithm is used to verify the focus consistency of the overall image. By calculating the definition difference between different regions, the evaluation result of the global focus quality is obtained; If the evaluation result shows that the focus difference between regions exceeds the preset tolerance range, the dynamic compensation algorithm for the local region is re-executed according to the evaluation result, and the focus offset is adjusted by the dynamic compensation algorithm until all shadow regions and non-shadow regions reach the focus balance state, and the final clear image output is obtained.

2. The method for enhancing image processing in a glare, shadow environment according to claim 1, wherein: Obtain the original image data in the glare shadow environment, and accurately divide the shadow region and the non-shadow region of the image by the region segmentation algorithm. According to the gray distribution characteristics and neighborhood contrast difference of the pixel points, the boundary coordinates and region identification information of each region are determined, including: Obtain the original image data in the glare environment, and perform noise filtering and brightness equalization processing on the image data by the preprocessing module to obtain standardized image data; The gray scale conversion algorithm is used to process the standardized image data, and the gray scale value distribution of each pixel point is calculated to obtain the complete pixel gray scale matrix information; According to the pixel gray scale matrix information, the neighborhood contrast value between adjacent pixel points is calculated. If the neighborhood contrast value exceeds the preset threshold, it is judged that the local neighborhood of the adjacent pixel points with the neighborhood contrast value exceeding the preset threshold has an obvious light change boundary; The region growing algorithm is used to cluster analyze the pixel points with light change boundary, and the pixel points with similar gray scale characteristics are merged into the same region identification to obtain the preliminary region segmentation result; The boundary detection method is used to extract the boundary coordinates of the preliminary region segmentation result, and the contour coordinate point sequence of each segmented region is calculated to obtain the accurate boundary coordinate data; According to the boundary coordinate data and feature analysis, if the gray scale distribution in the region is uniform and the contrast difference is small, the region is marked as a non-shadow region. If the gray scale value in the region is low and the contrast difference with the surrounding region is large, the region is marked as a shadow region. Through the region identification assignment mechanism, all segmented regions are uniquely identified and coded, and the corresponding relationship database between region identification and boundary coordinates is established to complete the accurate division of shadow regions and non-shadow regions.

3. The method for enhancing image processing in a glare, shadow environment of claim 1, wherein: For the shadow regions in the region identification information, the feature extraction method is used to calculate the average gray scale value and gray scale variance of each shadow region. By analyzing the statistical characteristics and histogram shape parameters of the gray scale distribution, the quantization value of the shadow intensity and the depth recognition result are obtained, including: Obtain the shadow region coordinate range in the region identification information, and extract the gray scale pixel value in each shadow region by pixel traversal to obtain the complete shadow region gray scale data set; The statistical calculation method is used to process the gray scale data set to calculate the average gray scale value μ and the gray scale variance σ² of each shadow region, where μ represents the mean value of the pixel gray scale in the region, and σ² represents the dispersion degree of the gray scale value. The basic statistical characteristics of the shadow region are determined. According to the statistical characteristics, a gray histogram of each shadow area is constructed, and shape parameters such as peak position, distribution width and skewness are obtained by histogram analysis to obtain the gray distribution mode of the shadow area; If the peak position in the shape parameter is lower than the preset threshold and the distribution width is narrow, it is judged that the shadow area is a high-intensity shadow, and the corresponding intensity quantization value is obtained; The K-means clustering algorithm is used for classification processing of the quantization value, the shadow intensity level is divided according to the distance of the clustering center, and the depth level identifier of each shadow area is determined through level mapping; Through the correlation analysis of the depth level identifier and the gray variance, if the variance value exceeds the preset range, the feature parameters of the area are recalculated, and the corrected shadow intensity evaluation result is obtained; According to the evaluation result, the intensity distribution map of the shadow area is generated, the quantization value and the depth level information of each area are marked, and the complete shadow feature recognition data is obtained.

4. The method for enhancing image processing in a glare, shadow environment of claim 1, wherein: According to the shadow intensity and depth recognition result, a parameter mapping relationship table between the shadow feature and the focusing parameter is established, if the shadow intensity is lower than the preset shallow threshold, a small step focusing mode is used, and if the shadow intensity is higher than the preset deep threshold, a large step focusing mode is used, including: The original image data collected by the image sensor is obtained, and the shadow intensity distribution matrix of each pixel point is obtained by calculating the gray value; According to the shadow intensity distribution matrix, the depth information of the shadow area is calculated by using the gradient algorithm, and the shadow depth feature vector is obtained; By comparing the shadow depth feature vector with the preset shallow threshold, if the depth feature value is less than the shallow threshold, it is determined that the current scene is in a shallow shadow state; According to the judgment result of the shallow shadow state, the focusing system automatically switches to the small step focusing mode, and the corresponding fine focusing parameter set is obtained; If the shadow depth feature value is greater than the preset deep threshold, it is judged that the current scene is in a deep shadow state, and the focusing system switches to the large step focusing mode; The support vector machine algorithm is used to train the mapping relationship model of the shadow feature and the focusing parameter, and the optimized parameter mapping table is obtained; The best focusing parameter corresponding to the current shadow state is queried through the parameter mapping table, and the focusing motor is driven to perform the corresponding focal length adjustment operation.

5. The method for enhancing image processing in a glare, shadow environment of claim 1, wherein: Through the focusing parameter configuration in the parameter mapping relationship table, the focal point offset calculation of different shadow areas is performed, the focal point offset and the convergence speed parameters of each area are determined according to the shadow depth level and the area weight, including: The focusing configuration data in the preset parameter mapping relationship table is obtained, the basic focal point parameters corresponding to each shadow area are analyzed, and the initial focusing parameter set is obtained; The shadow area of the input image is recognized by using the image segmentation algorithm, the boundary coordinates and pixel distribution of each shadow area are calculated, and the spatial position information of the shadow area is determined; According to the pixel gray value distribution characteristics of the shadow area, the depth level value of each area is calculated, if the gray mean value is lower than the preset threshold, it is judged as a deep shadow area, and the depth level identifier is obtained; The area weight coefficient of each area is calculated by the ratio of the total number of pixels in the shadow area to the total number of pixels in the image, and the area weight parameter matrix is obtained. The focus offset value of each shadow area is calculated by using a weighted calculation method, combining the depth level value and the area weight coefficient, to determine the differentiated offset parameter; According to the change amplitude of the focus offset value, an adaptive adjustment strategy is used to calculate the convergence speed parameter, and if the offset value exceeds the preset range, the convergence speed is reduced to obtain the final convergence control parameter; The focus offset value and the convergence speed parameter of each shadow area are grouped and optimized by using a clustering algorithm to generate a regionalized precision adjustment control instruction set.

6. The method for enhancing image processing in a glare, shadow environment of claim 1, wherein: The focus offset is adjusted in real time by using a dynamic compensation algorithm, and the correctness of the current focusing direction and the suitability of the focusing amplitude are judged by monitoring the change trend of the contrast value and the convergence state of the definition index during the focusing process, including: The pixel gray scale distribution data of the current image frame is obtained, the contrast value and the definition index of the image frame are calculated by using the Laplace operator, and the initial focus state parameter is obtained; A contrast change trend sequence is established according to the initial focus state parameter, and the contrast difference value between consecutive frames is recorded by using a sliding window method to determine the change trend direction of the current focusing process; If the change trend direction shows that the contrast value is continuously rising, it is judged that the current focusing direction is correct, and a positive focusing instruction signal is obtained; If the change trend direction shows that the contrast value is continuously falling, it is judged that the current focusing direction is incorrect, and a focusing direction correction instruction is generated by using a reverse control algorithm; The definition convergence state parameter is calculated according to the focusing direction correction instruction, the adjustment step of the focus offset is optimized by using the gradient descent method, and the dynamic compensation coefficient is obtained; The focus offset driven by the motor is adjusted in real time by using the dynamic compensation coefficient, the influence degree of the focusing amplitude change on the definition index is monitored, and the suitability evaluation result of the focusing amplitude is judged; The final focus position control parameter is output according to the suitability evaluation result to complete the closed-loop control of the whole dynamic compensation focusing process.

7. The method for enhancing image processing in a glare, shadow environment of claim 1, wherein: If the contrast value shows an upward trend and the definition index continuously improves, the current focusing parameter is maintained to continue the fine tuning operation, and if the contrast value decreases or the definition index tends to be stable, the focusing action in the current direction is stopped and a shadow edge enhancement algorithm is introduced, including: The original image data collected by the image sensor is obtained, and the contrast value of the original image is calculated by using a contrast detection module; According to the contrast value change, the definition value of the current image is calculated by using a definition evaluation algorithm to obtain the change trend of the definition index; If the contrast value shows an upward trend and the definition value continuously improves, the current focusing parameter is maintained to obtain the execution instruction of the fine tuning operation; The lens focal length position is adjusted by fine tuning operation, the new image data after adjustment is obtained, and the contrast value change state of the new image data is judged; If the contrast value appears a downward state or the definition value tends to be stable, a stop action instruction is generated to determine the termination condition of the current focusing direction; According to the stop action instruction, the shadow edge enhancement algorithm is enabled to process the current image to obtain the edge enhanced image data; The contrast value and the definition value are recalculated by using the edge enhanced image data, the image quality improvement degree is judged, and the final focusing parameter configuration is determined.

8. The method for enhancing image processing in a glare, shadow environment of claim 1, wherein: For the enhanced edge sharpness distribution parameters, the feature matching algorithm is used to verify the focus consistency of the overall image. By calculating the difference in definition between different regions, the evaluation results of global focus quality are obtained, including: Obtain the edge sharpness value of each region in the image, calculate the gradient amplitude of each pixel point by gradient operator, and obtain the initial edge sharpness distribution data; According to the initial edge sharpness distribution data, use Gaussian filter to eliminate noise interference, if the gradient amplitude exceeds the preset threshold, mark it as an effective edge point, and obtain the optimized edge sharpness distribution parameters; Through the optimized edge sharpness distribution parameters, the SIFT feature matching algorithm is used to extract the key feature points of the image, and the Euclidean distance between the feature points is calculated to obtain the feature matching metric value; Using the feature matching metric value, the image is divided into multiple sub-regions, if the difference between the feature matching metric values of adjacent regions is less than the preset difference threshold, it is judged that the region has good focus consistency, and the region focus state identifier is determined; According to the focus state identifier of each region, the definition variance value between regions is calculated, and the definition difference degree of different regions is quantified by variance analysis method to obtain the region definition difference matrix; Using the region definition difference matrix, if the overall variance value is lower than the preset consistency threshold, it is judged that the global focus quality is excellent, and the global focus quality evaluation score is obtained; Through the global focus quality evaluation score, a focus quality level mapping table is established, and the final focus quality level is determined according to the score range to obtain the complete image focus quality evaluation result.

9. The method for enhancing image processing in a glare, shadow environment of claim 1, wherein: If the evaluation result shows that the focus difference between regions exceeds the preset tolerance range, the dynamic compensation algorithm of local region is re-executed according to the evaluation result, the focus offset is adjusted by the dynamic compensation algorithm until all shadow regions and non-shadow regions reach the focus balance state, and the final clear image output is obtained, including: Obtain the pixel matrix data of the input image, identify the shadow region and non-shadow region boundary in the image by edge detection algorithm, and determine the initial focus parameter of each region according to the light intensity distribution characteristics; Using focus difference calculation, the difference between the focus value of the shadow region and the focus value of the non-shadow region is quantified to obtain the focus deviation data between regions; If the focus difference value exceeds the preset tolerance threshold, the local region compensation mechanism is started, the focus distribution pattern of each local region is analyzed by convolutional neural network model, and the specific region coordinates that need to be compensated are judged; According to the local region coordinate information, the focus offset adjustment algorithm is used to calculate the compensation parameter, and the optimized focus parameter matrix is obtained by adjusting the focus offset of each region; Through the focus parameter matrix, the pixel-level focus correction is performed on the original image, the focus value of each pixel point is recalculated by using the bilinear interpolation method, and the intermediate image data after focus balance is obtained; Re-execute the focus difference detection on the intermediate image data, if the focus difference of all regions is within the tolerance range, the focus balance state verification is completed, and the final clear image output result is obtained; According to the clear image output result, the processing data containing focus compensation parameters, region distribution information and image quality evaluation index is generated, and the whole image focus balance processing flow is completed.

Citation Information

Patent Citations

  • Image processing apparatus, three-dimensional measurement system, and image processing method

    CN114341940A

  • Image processing apparatus, imaging apparatus and image processing program

    JP2015149570A