Backlight effect image edge enhancement method based on intelligent identification
By combining multispectral image acquisition with environmental parameters, the image enhancement strategy is dynamically adjusted, a backlight region segmentation model and adaptive diffusion filtering are constructed, a lightweight U-Net network is embedded, and edge detection is optimized. This solves the problems of edge feature weakening and texture interference under complex lighting conditions in a wood template processing workshop, and improves the accuracy and stability of intelligent recognition.
Patent Information
- Application Number
- CN202511476122.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-16
- Publication Date
- 2025-11-14
- Estimated Expiration
- 2045-10-16
AI Technical Summary
The complex lighting environment in the wooden formwork processing workshop causes backlighting effects that result in image brightness contrast, leading to weakened edge features, texture interference, and misidentification. Traditional methods cannot adapt to dynamic lighting changes, affecting the accuracy and stability of intelligent recognition.
By acquiring environmental parameters through multispectral image acquisition equipment, and combining brightness and dust haze features, the image enhancement strategy is dynamically adjusted. A backlight region segmentation model and adaptive diffusion filtering are constructed, and a lightweight U-Net network is embedded for structural enhancement. Edge detection is optimized by combining graph convolutional networks to achieve environmental adaptation and edge enhancement.
It achieves clearer and more structured edges of wooden templates under complex lighting conditions, improves the accuracy and stability of intelligent identification production, and reduces the false detection rate and missed detection rate of defects.
Smart Images

Figure QLYQS_26 
Figure QLYQS_55 
Figure QLYQS_58
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and more specifically to a method for enhancing the edges of backlit images based on intelligent recognition. Background Technology
[0002] In intelligent recognition production of wood formwork, image acquisition and edge detection are core components for achieving automated quality control, directly impacting the reliability of critical processes such as formwork size measurement, defect identification (e.g., cracks, misaligned joints), and processing accuracy verification. However, the complex lighting environment in wood formwork processing workshops (e.g., a mixture of natural and industrial lighting, shadows created by equipment obstruction, and reflections from metal processing parts) easily leads to backlighting effects, resulting in extreme brightness contrasts in the acquired formwork images—"dark target, bright background"—severely restricting the accuracy and stability of intelligent recognition and becoming a prominent technical pain point for the industry's intelligent upgrade.
[0003] The inherent material characteristics of wooden formwork (complex surface texture and uneven color) combined with workshop conditions (floating dust and variable lighting angles) make the backlighting problem more significant. Edge Feature Weakness and Fragmentation: The critical edges of wooden formwork (such as cut edges, joints, and mortise and tenon joint edges) are the core basis for dimensional measurement and structural integrity assessment. In backlit environments, the edge areas of the formwork exhibit low brightness due to insufficient illumination, resulting in a significant reduction in the grayscale gradient with the background highlight areas. This leads to blurred edges, lack of contrast, and even edge fragmentation. For example, in backlit scenes, the cut edges of the formwork may blend into the background highlight areas, making it difficult for traditional edge detection algorithms (such as Canny) to effectively distinguish them. This directly causes dimensional measurement errors exceeding ±2mm, failing to meet the precision requirements of formwork in building construction (typically ≤1mm).
[0004] Texture interference and misidentification: Natural textures on the surface of wooden templates (such as growth rings and knots) are easily confused with real defects (such as fine cracks) under backlighting conditions. Uneven brightness caused by backlighting amplifies the grayscale fluctuations of the texture, causing the intelligent recognition model to mistakenly identify normal textures as defects or miss real cracks hidden by shadows, resulting in a high false detection rate and false detection rate for defect detection (exceeding 30% in some scenarios).
[0005] Insufficient adaptability under complex working conditions: Dynamic lighting changes in the workshop (such as fluctuations in natural light intensity caused by sunrise and sunset, and equipment movement blocking the light source) make the backlighting degree random. Traditional fixed-parameter image processing methods (such as global threshold segmentation and general contrast enhancement) cannot dynamically adapt to diverse scenarios such as "local backlighting", "side backlighting", and "highlight reflection", resulting in inconsistent edge enhancement effects, which are difficult to meet the stability requirements of industrial production.
[0006] Therefore, in response to the backlighting characteristics of wood formwork processing scenarios, a technical method integrating intelligent recognition of backlit areas, precise enhancement of edge features, and dynamic adaptation to processing scenarios is developed to achieve clarity and structuring of formwork edges under complex lighting conditions. This is of great significance for improving the accuracy, efficiency, and stability of intelligent recognition production of wood formwork. Summary of the Invention
[0007] This invention provides a method for enhancing the edges of backlit images based on intelligent recognition, thereby solving the above-mentioned problems.
[0008] This invention is achieved through the following technical solution: A method for enhancing backlit image edges based on intelligent recognition, comprising: Original images of the wood template processing site are acquired using multispectral image acquisition equipment, and environmental parameters of the processing site are also collected. The brightness characteristics and dust haze characteristics of the original images and environmental parameters are statistically analyzed to determine the type of the site environment. Based on the determined type of on-site environment, the original image is globally optimized and a globally preprocessed image is output using a set environment-aware enhancement mechanism. A backlight region segmentation model is constructed for the global preprocessed image, and the texture and illumination features of the wooden template in the global preprocessed image are extracted. The pixel-level mask of the backlight region in the global preprocessed image is output. Then, an adaptive anisotropic diffusion filter is applied to the pixel-level mask of the located backlight region to enhance the edge continuity. The diffusion coefficient is dynamically adjusted according to the texture direction of the wooden template to suppress diffusion perpendicular to the edge direction and retain information parallel to the edge direction, and the locally enhanced image is output. A structure-aware local adaptive thresholding algorithm is designed for the locally enhanced image, which dynamically adjusts the local threshold range by combining gradient direction and edge density information; a lightweight U-Net network is embedded to enhance the image texture and output a binarized image that maintains structural continuity. Edge maps are extracted from the binarized image using an edge detection algorithm. Contours in the binarized image are extracted using a graph convolutional network. The edge maps are represented as graph structure nodes. The topological structure of the contours in the binarized image is optimized using a loss function of "continuity constraint + curvature constraint + closure judgment". Then, the geometric features of the contours are extracted and compared with the standard feature library for wood template processing. The edge quality assessment results are output and fed back to the processing control system.
[0009] As an optimization, the objects in the original image include the wooden template and the processing area of the wooden template. The environmental parameters include light intensity, dust concentration, temperature, and humidity. The specific process of determining the type of the site environment by statistically analyzing the brightness characteristics and dust haze characteristics of the original image and environmental parameters is as follows: Extract the brightness features of the original image, including brightness distribution features and highlight / shadow features; Extract the dust haze features from the original image, which include sharpness and contrast features, particle noise features, and color shift features; The collected environmental parameters are compared with preset thresholds to preliminarily screen the environmental types and obtain preliminary screening results. The preliminary screening results include candidate labels for low light environment type, high dust environment type, backlight environment type, or no special environment. Based on the preliminary screening results, the original image and environmental parameters are fused using a set rule engine to determine the type of the on-site environment: If the initial screening result is a candidate for low light environment, the rule engine calls the low light feature set to verify whether the low light environment judgment conditions are met. If the low light environment judgment conditions are not met, it determines whether the high dust environment judgment conditions, backlight environment judgment conditions, or normal environment conditions are met. If the initial screening result is a candidate for a high-dust environment, the rule engine calls the high-dust feature set to verify whether the high-dust environment judgment conditions are met. If the low-light environment judgment conditions are not met, it determines whether the low-light environment judgment conditions, backlight environment judgment conditions, or normal environment conditions are met. If the initial screening result is a candidate identifier for a backlight environment, the rule engine calls the backlight feature set to verify whether the backlight environment judgment conditions are met. If the low light environment judgment conditions are not met, it determines whether the low light environment judgment conditions, high dust environment judgment conditions, or normal environment conditions are met. If the initial screening results show no special environment candidate identifiers, it is determined to be a normal environment; If the preliminary screening results contain at least two of the following: low-light environment candidate identifiers, high-dust environment candidate identifiers, and backlight environment candidate identifiers, then the rule engine will call and judge the corresponding feature sets in descending order of high-dust environment, backlight environment, and low-light environment.
[0010] As an optimization, the low-light feature set includes global average brightness, light intensity and dust feature verification parameters, and the low-light environment determination condition is: global average brightness < threshold D + light intensity < threshold E + no significant dust features; The high dust feature set includes the gradient energy, dust concentration, and high-frequency noise density of the original image. The high dust environment determination condition is: gradient energy of the original image < threshold A + dust concentration > threshold B + high-frequency noise density > threshold C. The backlight feature set includes the skewness coefficient of the image brightness histogram and the average brightness. The backlight environment determination condition is: the skewness coefficient of the image brightness histogram > threshold F and the average brightness < threshold G.
[0011] As an optimization, the environmental awareness enhancement mechanism is specifically as follows: If the on-site environment is a low-light environment: perform CLAHE on the original image to enhance the contrast of low-light areas, dynamically adjust the tile grid size and clipLimit parameter, and combine guided filtering to obtain a global preprocessed image; If the on-site environment is a high-dust environment: call the high-dust enhancement strategy on the original image, and execute the DehazeNet dehazing model trained based on the industrial dust scene combined with bilateral filtering denoising operation to obtain a global preprocessed image; If it is a backlit environment: apply the backlight enhancement strategy to the original image, perform multi-scale Retinex enhancement combined with specular suppression to obtain a global preprocessed image; In a normal environment: the general enhancement strategy is applied to the original image, and adaptive histogram equalization combined with NLM denoising is performed to obtain a global preprocessed image.
[0012] As an optimization, the specific process of performing CLAHE enhancement combined with guided filtering denoising on the original image to obtain a global preprocessed image is as follows: A1. Convert the original image from the RGB color space to the YCrCb color space, and extract the luminance channel and chrominance channel. The luminance channel includes the Y channel, which is used for enhancement processing in subsequent processes. The chrominance channel includes the Cr channel and the Cb channel, which are used to preserve the original color information. A2. Quantitative analysis of low-light region features: Feature analysis was performed on the brightness channel to obtain the following quantitative indicators: A2.1, Proportion of Low-Light Areas The low-light region is segmented by setting a brightness threshold, and the ratio of the number of pixels in the low-light region to the total number of pixels in the original image is calculated. A2.2, Detail Density Perform Canny edge detection on low-light areas and calculate the ratio of edge pixels to low-light area pixels; A2.3, High-frequency noise density Perform Fourier transform on low-light regions and count the energy percentage of high-frequency components with frequencies greater than 1 / 4 of the image width. A3. Dynamic adjustment of CLAHE parameters: Based on the quantification metrics from step A2, dynamically adjust the key parameters of the contrast-limited adaptive histogram equalization (CLAHE): A3.1, Tile network size adjustment: like This indicates that the low-light area has rich details, so set the grid size to 6×6; like If so, it means that the low-light area has medium detail, and the grid size should be set to 8×8; like or If the low-light area has sparse details or is a high-noise area, set the grid size to 10×10. A3.2, Adjusting the clipLimit parameter: like If the low light area is severely low light, then set the contrast limit threshold clipLimit=2-3; like If the low light area is moderately low, then set the contrast limit threshold clipLimit=4-5; like If the value is 0, it indicates that the low-light area is slightly low-light, and the contrast limit threshold is set to clipLimit=6-7. A4, CLAHE enhancement processing: Enhancement is performed on the luminance channel based on the parameters adjusted in step A3, specifically including: A4.1 Sub-block division: Divide the brightness channel into non-overlapping sub-blocks evenly according to the adjusted tile network size; A4.2 Contrast Limitation: Apply the contrast limit threshold clipLimit determined in step A3.2 to the grayscale histogram of each sub-block to clip grayscale frequencies exceeding the threshold and distribute them evenly to other grayscale levels to obtain the clipped histogram. A4.3 Equalization and Stitching: Equalization is performed on the cropped histogram, and the sub-block results are stitched together using bilinear interpolation to eliminate edge transitions, outputting a CLAHE-enhanced luminance channel image. ; A5. Guided filtering noise reduction processing: Based on the original luminance channel, the luminance channel image Denoising is performed, specifically including: A5.1 Filter Parameter Configuration: Set the filter window radius to 5 pixels, and the regularization parameter... , corresponding regularization coefficient ; A5.2 Local Linear Fitting: Using the original luminance channel as the guide image G, and the luminance channel image... For the image I to be denoised, the linear model parameters are solved by minimizing the error function within each 5×5 pixel window. , The error function is: Where I represents the image to be denoised, i.e., the luminance channel enhanced by CLAHE. , The linear coefficients within the pixel window k are... This is the offset within the pixel window k; A5.3 Pixel value fusion: For each pixel, the linear model parameters of its window are calculated using bilinear interpolation. , Mean value, output the denoised luminance channel based on the mean value. ; A5.4 Image Reconstruction Output: The denoised luminance channel... The chroma channels extracted from A1 are merged and converted back to the RGB color space to obtain a globally preprocessed image under low light conditions. The specific process of applying a high-dust enhancement strategy to the original image and executing a DehazeNet dehazing model trained on an industrial dust scene combined with bilateral filtering denoising to obtain a globally preprocessed image is as follows: B1. DehazeNet Dehazing Processing: B1.1 Model Loading: Load the pre-trained DehazeNet dehazing model, which is trained based on industrial dust scene data. The DehazeNet dehazing model is an image, and its output is transmittance. B1.2 Transmittance Prediction: Input the original image into the DehazeNet dehazing model and output the predicted transmittance map t(x); B1.3 Image Restoration: The fog-free image is restored based on the atmospheric scattering model J(x) = (I(x) - A) / t(x) + A, where A is the global atmospheric illumination intensity, estimated by the average value of the top 0.1% of the image brightness; I(x) is the pixel value at pixel x in the original image; J(x) is the pixel value at pixel x in the fog-free / dust-free image to be restored; and t(x) is the transmittance. Here, t(x) = 1 indicates no scattering and no light attenuation. , Here, d(x) represents the atmospheric scattering coefficient, and d(x) represents the actual distance of the object corresponding to pixel x. B2. Bilateral filtering noise reduction processing: B2.1 Parameter configuration: Set the spatial domain standard deviation sigma_space=15, and the value domain standard deviation sigma_color=30; B2.2 Weight Calculation: For each pixel p, calculate the spatial domain weight within a 15×15 neighborhood. Sum range weight ; B2.3 Weighted Filtering: Outputs denoised pixel values , where N(p) is the 15×15 neighborhood of pixel p, and W(p) is the normalization coefficient; B3. Output global preprocessed image: Output the dehazed and denoised image as the final enhancement result, which is the global preprocessed image; The specific process of applying a backlight enhancement strategy to the original image and performing multi-scale Retinex enhancement combined with specular suppression to obtain a globally preprocessed image is as follows: C1, Multiscale Retinex Enhancement: C1.1 Scale Decomposition: The brightness channel of the original image is convolved with three Gaussian kernels of different standard deviations to generate blurred images at low, medium, and high scales, where the standard deviations of the Gaussian kernels are respectively... , , ; C1.2, Detail Extraction: Through Formulas Calculate the detail layers at each scale, where... This represents the Retinex detail layer at the i-th scale. This represents the original luminance channel, where x and y are the pixel coordinates. For the blurred image at the corresponding scale, i=1,2,3, which correspond to Gaussian blur at different scales, i=1 corresponds to... i=2 corresponds to i=3 corresponds to ; C1.3, Weighted Fusion: Calculates the detail layers at three scales according to their weights. Weighted summation, where, Generate an enhanced luminance channel ; C2. Highlight suppression processing: C2.1 Highlight Area Location: Mark pixels with a grayscale value > 220 in the luminance channel as highlight areas; C2.2, Brightness Attenuation: Perform non-linear attenuation on pixels in highlight areas. ,in, The attenuation coefficient is... ,and It decreases as pixel brightness increases; C3. Color Restoration and Image Reconstruction: C3.1 Color Compensation: (Using a formula) Calculate the color restoration factor, where The original RGB image, is the color recovery factor for the pixel at coordinates (x, y); C3.2, Reconstructed Output: The adjusted brightness channel Multiply by the color restoration factor, then merge with the original chroma channel, and convert back to the RGB color space to obtain the global preprocessed image under backlight conditions; The specific process of applying a general enhancement strategy to the original image and performing adaptive histogram equalization combined with NLM denoising to obtain a globally preprocessed image is as follows: D1. Adaptive Histogram Equalization (AHE) Processing: D1.1 Parameter Configuration: Set the contrast limit threshold clipLimit=2 to divide the image brightness channel into 8×8 sub-blocks; D1.2 Sub-block equalization: For the grayscale histogram of each sub-block, for grayscale levels whose clipping frequency exceeds clipLimit × (number of sub-block pixels / 256), the clipped frequencies are evenly distributed to other grayscale levels, and histogram equalization is performed. D1.3. Fusion Output: By stitching together the sub-block equalization results using bilinear interpolation, an adaptive histogram equalized brightness channel image is generated. To improve overall contrast; D2, NLM noise reduction processing: D2.1 Parameter Configuration: Set the noise reduction intensity parameter h=3, and define the search window as 7×7 pixels and the similarity window as 5×5 pixels; D2.2 Similarity Calculation: For the brightness channel image For each pixel, calculate the grayscale similarity weight with other pixels within the search window. The formula is: Where p and q are the two pixels to be compared. Let p be the grayscale vector of the similarity window containing pixel p, and let p be the grayscale values of the 5x5 window surrounding pixel p. Represents the square of the Euclidean norm; D2.3, Weighted Denoising: Using the formula The denoised pixel values are calculated to obtain the denoised luminance channel, which suppresses minor noise in normal environments. This represents the grayscale value of pixel p in the luminance channel after denoising, which is the grayscale value of pixel p in the global preprocessed image. This indicates a search window centered on p. This represents the original grayscale value of pixel q in the luminance channel before denoising.
[0013] As an optimization, a backlight region segmentation model is constructed for the global preprocessed image, extracting the texture and illumination features of the wooden template in the global preprocessed image, and outputting a pixel-level mask for the backlight region in the global preprocessed image; then, an adaptive anisotropic diffusion filter is applied to the located backlight region pixel-level mask to enhance edge continuity, dynamically adjusting the diffusion coefficient according to the texture direction of the wooden template, suppressing diffusion perpendicular to the edge direction, and retaining information parallel to the edge direction, and outputting the locally enhanced image. The specific process is as follows: E1. Backlight area segmentation model construction: E1.1 Feature Extraction: Extracting the texture and lighting features of the wooden template from the global preprocessed image, specifically including: Texture features are obtained by calculating the contrast and entropy of the Local Binary Pattern (LBP) and Gray-Level Co-occurrence Matrix (GLCM) of the global preprocessed image. Illumination features are obtained by extracting the brightness gradient magnitude and the skewness coefficient of the local brightness distribution from the global preprocessed image. E1.2 Feature Fusion and Classification: The extracted texture features and illumination features are input into a random forest classifier to train a backlit region segmentation model; E1.3 Pixel-level Mask Generation: The trained backlight region segmentation model is applied to classify the global preprocessed image pixel by pixel, outputting the initial pixel-level mask for the backlight region. ,in, Represents the pixels in the backlight area. Indicates pixels in the non-backlit area; E2. Post-mask processing: Dilation and erosion operations are performed on the initial pixel-level mask to remove isolated noise areas and retain continuous backlight areas, resulting in the final backlight area pixel-level mask M(x,y). E3, Adaptive Anisotropic Diffusion Filter: E3.1 Edge Direction Estimation: For the pixel-level mask M(x,y) of the backlight region obtained from the localization, calculate the local gradient direction. Where I is the brightness channel of the global preprocessed image; E3.2 Dynamic Adjustment of Diffusion Coefficient: The diffusion coefficient is dynamically adjusted according to the grain direction of the wood template to construct a diffusion tensor. ,in, , , , , Parameters for controlling the degree of anisotropy, K is the gradient threshold. For gradient operators, ; E3.3, Diffusion Filtering Iteration: The image is updated iteratively using the following partial differential equation. Where t is the iteration time step, The divergence operator suppresses diffusion perpendicular to the edge direction while preserving information parallel to the edge direction, resulting in the filtered backlight area. E4. Local Enhancement Image Generation: The filtered backlit area is fused with the non-backlit area to output a locally enhanced image.
[0014] As an optimization, a structure-aware local adaptive thresholding algorithm is designed for the locally enhanced image, dynamically adjusting the local threshold range by combining gradient direction and edge density information; the specific process of embedding a lightweight U-Net network to perform structural enhancement of image texture and outputting a binarized image that maintains structural continuity is as follows: For the locally enhanced image, the Sobel operator or a similar gradient calculation operator is used to calculate the gradients in the horizontal and vertical directions of the image, thereby obtaining the gradient magnitude and gradient direction of each pixel. Edge detection is performed on the locally enhanced image to obtain an edge map of the locally enhanced image; then the number of edge pixels in the edge map is counted and compared with the total number of pixels in the locally enhanced image to obtain edge density information; Based on the calculated gradient direction and edge density information, a local threshold adjustment model is constructed. The local threshold adjustment model is as follows: ,in, Let a and b be the initial thresholds, and a and b be the adjustment coefficients. Let (x, y) be the gradient magnitude of the pixel. This represents the edge density of the local region where pixel (x, y) is located. Constructing a lightweight U-Net network; The image processed by the local threshold adjustment model is input into the lightweight U-Net network, and the lightweight U-Net network outputs a binarized image.
[0015] As an optimization, the image processed by the local threshold adjustment model is input into the lightweight U-Net network, and the specific process of outputting a binarized image through the lightweight U-Net network is as follows: The image processed by the local threshold adjustment model is input into the lightweight U-Net network; A binary activation function is used in the last layer of the lightweight U-Net network to convert the feature map output by the lightweight U-Net network into a binary image.
[0016] As an optimization, an edge map is extracted from the binarized image using an edge detection algorithm, and contours in the binarized image are extracted based on a graph convolutional network. The edge map is represented as graph structure nodes, and the topological structure of the contours in the binarized image is optimized using a loss function of "continuity constraint + curvature constraint + closure judgment". Then, the geometric features of the contours are extracted and compared with the standard feature library for wooden template processing. The edge quality assessment result is output and fed back to the processing control system. The specific process is as follows: Edge map extraction: Perform the Canny edge detection algorithm on the input binarized image to extract the edge map E, where edge pixels are marked as 1 and non-edge pixels are marked as 0; Graph structure construction: Use edge pixels in edge graph E as graph structure nodes. Where N is the total number of edge pixels; define node adjacency relationships: if node and If the edge pixels are connected in an 8-neighborhood, then an edge connection is established. This forms a graph structure W=(V,E); Graph Convolutional Network Contour Extraction: A Graph Convolutional Network (GCN) is constructed, taking the graph structure W and node features as input. The node features include gradient direction and curvature. Neighborhood features are aggregated through 2-3 graph convolutional layers, and the probability distribution of candidate contour nodes is output to extract the initial contour. ; Topology optimization: Define a loss function consisting of "continuity constraint + curvature constraint + closure judgment". Optimize the parameters of the graph convolutional network (GCN) through backpropagation using this loss function, resulting in an optimized contour output by the GCN. ; Contour geometric feature extraction: for the optimized contour Calculate the feature set F, which includes length features, curvature features, and closure features; Standard Feature Library Comparison: Constructing a Standard Feature Library for Wood Formwork Processing The geometric feature threshold range including the qualified contour; calculate the feature deviation. The quality score is obtained by weighted summation. , For feature weights; Results Output and Feedback: If If the edge quality is deemed acceptable, it is considered acceptable; otherwise, the unacceptable area is marked, and the coordinates and deviation values of the unacceptable area are fed back to the machining control system for adjusting the machining parameters.
[0017] As an optimization, the loss function is: ; , , The weights are the corresponding loss function weights. For the continuity constraint loss function, The curvature constraint loss function, The loss function is a closed-beta judgment function, and ,in, Let be the actual Euclidean distance between node i and node j. For the expected continuous distance, Let be the curvature of node i. For local mean curvature, Let W be the edge between node i and node j, and let W be the graph structure.
[0018] Compared with the prior art, the present invention has the following advantages and beneficial effects: This invention achieves the following effects through end-to-end optimization of the process: precise environmental adaptation → image enhancement → defect detection → quality closed loop: High-quality enhancement of images of wooden formwork processing in complex environments; Precise preservation of edge and texture details, adapting to the natural texture and processing defects of wooden templates; The deep integration of defect detection and processing control transforms "passive detection" into "proactive optimization," thereby improving production efficiency and yield. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the embodiments. The illustrative embodiments and descriptions of this invention are only used to explain this invention and are not intended to limit this invention.
[0020] This embodiment 1 provides a method for enhancing the edges of backlight effect images based on intelligent recognition, including: S1. Obtain original images of the wood template processing site using multispectral image acquisition equipment, and simultaneously collect environmental parameters of the processing site. Statistical analysis of image brightness characteristics and dust haze characteristics is performed using the original images and environmental parameters to determine the type of the site environment.
[0021] Multispectral image acquisition devices (such as industrial cameras and multispectral cameras) primarily capture the optical reflection / radiation characteristics of a scene, including the intensity distribution of light at different wavelengths and the grayscale / color changes of object surface textures, for subsequent visual tasks such as region segmentation and edge extraction. For example, the "brightness value" in an image can indirectly reflect the relative intensity of illumination, but this is a local light intensity representation within the scene (affected by object reflectivity, occlusion, etc.), rather than an objective, quantified "illuminance" (such as a physical quantity measured in lux).
[0022] Specifically, the objects in the original image include the wooden template and the processing site area of the wooden template, and the environmental parameters include light intensity, dust concentration, temperature and humidity.
[0023] Here, light intensity and dust concentration are the most important environmental parameters, while temperature and humidity are secondary environmental parameters.
[0024] Brightness information in an image is related to light intensity, but it is affected by factors such as the surface material of the wooden template (e.g., differences in texture reflectivity), shooting angle, and lens exposure parameters, making it impossible to accurately deduce the actual light intensity value. For example, low brightness in backlit areas may be due to insufficient lighting or weak reflectivity of the object itself, which cannot be distinguished solely from the image. Similarly, phenomena such as "blurring" or "hazy attenuation" may appear in the image, related to dust, but these are also affected by lens contamination, air humidity, and light scattering, making it impossible to directly quantify dust concentration (e.g., in units of...) from the image. (The numerical value).
[0025] The reason for collecting environmental parameters is to use light intensity and dust concentration as environmental perception indicators to dynamically adjust image enhancement strategies. This requires the data to be accurate and real-time. If it is necessary to automatically switch the HDR synthesis algorithm based on "low light", it is necessary to know whether the current ambient light intensity is lower than the threshold (e.g., <500 lux), rather than just subjectively judging based on image brightness; If a dedicated noise reduction network is required for "high dust concentration", a quantified concentration value (e.g., >1) must be obtained through a dust sensor. (i.e., rather than relying on qualitative analysis of the degree of image blur),
[0026] Therefore, image acquisition and the acquisition of illumination and dust parameters are two complementary steps: Images are used to extract visual features of the wooden template (such as backlit areas and edge textures). Light intensity and dust concentration are used to provide policy switching that supports the "environmental awareness enhancement mechanism".
[0027] Specifically, the process of determining the type of on-site environment by statistically analyzing the image brightness and dust / haze characteristics using the original image and environmental parameters is as follows: S1.1 Extract the brightness features of the original image, including brightness distribution features and highlight / shadow features. Brightness distribution features: Calculate the global average brightness of the original image (if it is lower than a preset threshold, indicate a low-light environment). Analyze the brightness histogram distribution of the original image (if there is a clear "double peak", that is, the highlight area and the dark area are separated, it indicates a backlit or unevenly lit environment); Extract backlight region features from the original image: Identify whether there are strong brightness abrupt changes at the edges of dark areas (typical features of backlight regions) by detecting brightness gradients (such as using the Sobel operator to calculate vertical brightness changes).
[0028] Highlight / shadow characteristics: Detect the proportion of highlight areas in the original image whose pixel values are close to saturation (too high indicates strong light interference, and close to saturation means that the pixel value is higher than the set threshold). Calculate the area of connected components in the shadow region (an excessively large area indicates light occlusion or a low-light environment). Based on image type (grayscale / color) and scene complexity, common judgment methods can be divided into two categories: traditional algorithms based on image features and learning-based intelligent recognition. These are existing technologies and will not be elaborated upon here.
[0029] S1.2 Extract the dust haze features of the original image, including sharpness and contrast features, particle noise features and color shift features.
[0030] Sharpness and contrast characteristics: Calculate the image gradient energy (such as the Laplacian operator response value): If the global gradient energy is below the threshold, it indicates that the image is blurry (possibly caused by dust or fog). Analyze local contrast: Calculate the average contrast of local areas of the image using a sliding window (in high-dust environments, the contrast of distant objects decreases significantly).
[0031] Particle noise characteristics: High-frequency noise components (dust particles appear as randomly distributed high-frequency noise points in the image) are extracted using wavelet transform or Fourier transform. Detect the density of tiny bright / dark spots in an image (visual features formed by the scattering / blocking of light by dust particles).
[0032] Color shift characteristics: Analysis of the mean deviation of the RGB three channels: In high dust / fog environments, the image may show a grayish or white color shift (due to the scattering characteristics of visible light by dust).
[0033] S1.3. Compare the collected environmental parameters with preset thresholds to preliminarily screen the environmental types and obtain preliminary screening results. The preliminary screening results include candidate identifiers for low-light environment type, high-dust environment type, backlight environment type, or no special environment (normal environment).
[0034] Low light environment determination: If the ambient light intensity is <50 lux and the average image brightness is <50 (grayscale value 0-255), it is determined to be a low light environment; High dust environment assessment: If the dust concentration > If the image clarity score (such as Brenner gradient value) is less than 60% of the preset threshold, it is judged as a high dust environment; Backlight environment determination: If the standard deviation of image brightness is >80 (reflecting uneven lighting) and the area of the backlight area is >20%, combined with the angle between the light source direction and the shooting direction detected by the light sensor being >120° (indicating backlight), it is determined to be a backlight environment.
[0035] The area of the backlight region here can be quickly calculated through pre-segmentation based on the brightness threshold. The steps are as follows: Step 1: Extract image brightness features: Calculate pixel-level brightness values (such as single-channel grayscale values 0-255) based on the grayscale values of the original image (or the brightness channels after RGB to grayscale conversion).
[0036] Step 2: Set the backlight area brightness threshold: By statistically analyzing the brightness distribution patterns under backlight conditions, a brightness threshold for the backlight area is preset (e.g., grayscale value < 50, which can be dynamically adjusted according to the scene), and pixels with brightness below the threshold are initially marked as "suspected backlight areas".
[0037] Step 3: Remove noise and small-area interference: Morphological operations (such as erosion and dilation) are performed on the suspected backlight areas to filter out isolated noise points and small connected regions (such as areas with an area less than 0.5% of the total pixels) to obtain a preliminary backlight area mask.
[0038] Step 4: Calculate the area percentage: The total number of backlit pixels in the preprocessed mask is counted and divided by the total number of pixels in the image to obtain the preliminary backlit area ratio (e.g., ratio > 20%).
[0039] The process logic of "pre-segmentation → environmental determination → fine segmentation" is as follows: Rapid pre-segmentation to obtain area proportion → combined with standard deviation and light source direction to determine backlight environment → trigger subsequent high-precision backlight area segmentation model.
[0040] The purpose of pre-segmentation is to "quickly screen" and provide quantitative basis for environmental judgment. Although the accuracy is lower than that of the full segmentation model, it is faster and meets the efficiency requirements of pre-judgment. If the environment is determined to be a backlit environment, the "backlit region segmentation model" in the claims is then called to perform fine segmentation (combining texture features, lighting gradients, etc.), and a more accurate mask is output for subsequent enhancement processing.
[0041] In other words, the area ratio of the backlight region comes from a pre-segmentation process based on a brightness threshold: by quickly extracting brightness features, setting thresholds to mark suspected areas, and filtering noise, the area ratio is calculated. This mechanism avoids logical loops and provides key quantitative indicators for environmental judgment through lightweight preprocessing. Subsequently, a more refined segmentation model is triggered based on the judgment results, achieving a balance between efficiency and accuracy.
[0042] S1.4. Based on the preliminary screening results, the original image and environmental parameters are fused using a set rule engine to determine the type of the on-site environment: If the initial screening result is a candidate for low light environment, the rule engine calls the low light feature set to verify whether the low light environment judgment conditions are met. If the low light environment judgment conditions are not met, it determines whether the high dust environment judgment conditions, backlight environment judgment conditions, or normal environment conditions are met. If the initial screening result is a candidate for a high-dust environment, the rule engine calls the high-dust feature set to verify whether the high-dust environment judgment conditions are met. If the low-light environment judgment conditions are not met, it determines whether the low-light environment judgment conditions, backlight environment judgment conditions, or normal environment conditions are met. If the initial screening result is a candidate identifier for a backlight environment, the rule engine calls the backlight feature set to verify whether the backlight environment judgment conditions are met. If the low light environment judgment conditions are not met, it determines whether the low light environment judgment conditions, high dust environment judgment conditions, or normal environment conditions are met. If the initial screening results show no special environment candidate identifiers, it is determined to be a normal environment.
[0043] There may be overlap in the initial screening results, meaning that multiple environmental conditions may be met simultaneously. To avoid judgment conflicts, this embodiment makes the following settings: If the initial screening results simultaneously contain at least two of the following: low-light environment candidate identifiers, high-dust environment candidate identifiers, and backlight environment candidate identifiers, then the rule engine calls and judges the corresponding feature sets in descending order: high-dust environment, backlight environment, and low-light environment. That is, when the initial screening results simultaneously meet multiple environment candidate identifiers (such as low light + high dust, or low light + backlight, or low light + high dust + backlight), the priority is given to "high-dust environment > backlight environment > low-light environment" to avoid judgment conflicts.
[0044] In some embodiments, the low-light feature set includes global average brightness, light intensity and dust feature verification parameters, and the low-light environment determination condition is: global average brightness < threshold D + light intensity < threshold E + no significant dust features; The high dust feature set includes the gradient energy, dust concentration, and high-frequency noise density of the original image. The high dust environment determination condition is: gradient energy of the original image < threshold A + dust concentration > threshold B + high-frequency noise density > threshold C. The backlight feature set includes the skewness coefficient of the image brightness histogram and the average brightness. The backlight environment determination condition is: the skewness coefficient of the image brightness histogram > threshold F and the average brightness < threshold G.
[0045] In some embodiments, the thresholds mentioned above can be set as follows: Low-light environment: threshold D = 50 (grayscale value), threshold E = 500 lux (light intensity); High-dust environment: threshold A = 0.3 (gradient energy normalization value), threshold B = 0.5. (Dust concentration), threshold C=0.2 (high frequency noise density); backlight environment: threshold F=1.5 (skewness coefficient), threshold G=80 (grayscale value).
[0046] S1.3 is a preliminary screening based on a single or a few features and thresholds, while S1.4 is a precise judgment based on the fusion of multi-dimensional features. The two are in a progressive relationship of "coarse screening → fine judgment".
[0047] Initial screening is completed quickly using minimal sensor parameters and image features (e.g., 2-3 parameters), avoiding complex calculations for all environments (e.g., if S1.3 has determined "high dust," S1.4 can skip complex feature calculations for low light and backlight, directly focusing on accurate verification of high dust). For the "suspected environment types" identified in the initial screening of S1.3, complex logic involving multi-feature fusion (e.g., rule engines, SVM models) is used to eliminate misjudgments based on single features. For example, in the "backlight environment", S1.3 only uses "brightness standard deviation + backlight area + light source angle" for initial screening, but may misjudge "dark areas caused by high dust"; S1.4 adds "brightness histogram bimodal separation + backlight area brightness gradient > threshold F", and accurately locks the real backlight environment through "abnormal image brightness distribution + backlight area edge features".
[0048] By working together with S1.3 and S1.4, a balance is achieved between "efficiency (rapid initial screening) and accuracy (multi-dimensional precise judgment)", which ensures the real-time performance of industrial scenarios (reducing the amount of computation in initial screening) and improves the accuracy of judgment through composite features (avoiding error enhancement strategies caused by environmental interference).
[0049] S2. Based on the determined on-site environment type, the original image is globally optimized and output as a global preprocessed image using a set environment-aware enhancement mechanism.
[0050] In some embodiments, the environment-aware enhancement mechanism specifically includes: 1. If the on-site environment is a low-light environment: perform CLAHE on the original image to enhance the contrast of low-light areas, dynamically adjust the tile grid size and clipLimit parameter, and combine guided filtering to obtain a global preprocessed image.
[0051] 2. If the on-site environment is a high-dust environment: apply the high-dust enhancement strategy to the original image, and perform a global preprocessed image by combining the DehazeNet dehazing model trained on the industrial dust scene with bilateral filtering denoising.
[0052] 3. If it is a backlit environment: Apply the backlight enhancement strategy to the original image and perform multi-scale Retinex enhancement combined with specular suppression to obtain a global preprocessed image.
[0053] For example, if the skewness coefficient of the image brightness histogram is >1.5 and the average brightness is <80 (grayscale value 0-255), it is determined to be a backlit environment. The skewness coefficient is used to measure the asymmetry of brightness distribution. When the skewness coefficient is >1.5, it indicates that the proportion of bright pixels in the image is relatively large and the distribution is relatively uneven. At the same time, the average brightness is <80, indicating that the overall brightness is low, which is consistent with the characteristics of fewer bright parts and uneven brightness in backlit areas. This method is mainly based on the statistical characteristics of image brightness. The calculation is relatively simple and can quickly make a preliminary judgment on backlit areas. It is suitable for some situations with high real-time requirements or relatively simple image scenes. For example, in industrial inspection, for some production lines with relatively stable background lighting, when detecting whether there are defects caused by backlighting in products, this method can be used to quickly screen out areas that may have problems. 4. If it is a normal environment: Apply a general enhancement strategy to the original image, and perform adaptive histogram equalization combined with NLM denoising to obtain a global preprocessed image.
[0054] More specifically, for low-light environments, the process of performing CLAHE enhancement combined with guided filtering denoising on the original image to obtain a global preprocessed image is as follows: A1. Convert the original image from the RGB color space to the YCrCb color space, and extract the luminance channel and chrominance channel. The luminance channel includes the Y channel, which is used for enhancement processing in subsequent processes. The chrominance channel includes the Cr channel and the Cb channel, which are used to preserve the original color information. A2. Quantitative analysis of low-light region features: Feature analysis was performed on the brightness channel to obtain the following quantitative indicators: A2.1, Proportion of Low-Light Areas The low-light region is segmented by setting a brightness threshold, and the ratio of the number of pixels in the low-light region to the total number of pixels in the original image is calculated. The brightness threshold can be set to a grayscale value of 80. A grayscale value below 80 is considered a low-light region.
[0055] The brightness threshold (grayscale value < 80) is determined by statistically analyzing the brightness distribution of noise-free images under low-light conditions, and setting the lower limit of the grayscale range where dark pixels are concentrated as the segmentation threshold.
[0056] A2.2, Detail Density Canny edge detection is performed on low-light areas, and the ratio of edge pixels to low-light area pixels is calculated. The parameters for Canny edge detection are: high threshold = 80, low threshold = 40, which are used to preserve the effective edge features of low-light areas.
[0057] A2.3, High-frequency noise density Perform Fourier transform on low-light regions and count the energy percentage of high-frequency components with frequencies greater than 1 / 4 of the image width. A3. Dynamic adjustment of CLAHE parameters: Based on the quantification metrics from step A2, dynamically adjust the key parameters of the contrast-limited adaptive histogram equalization (CLAHE): A3.1, Tile network size adjustment: like This indicates that the low-light area has rich details, so set the grid size to 6×6; like If so, it means that the low-light area has medium detail, and the grid size should be set to 8×8; like or If the low-light area has sparse details or is a high-noise area, set the grid size to 10×10. A3.2, Adjusting the clipLimit parameter: like If the low light area is severely low light, then set the contrast limit threshold clipLimit=2-3; like If the low light area is moderately low, then set the contrast limit threshold clipLimit=4-5; like If the value is 0, it indicates that the low-light area is slightly low-light, and the contrast limit threshold is set to clipLimit=6-7. A4, CLAHE enhancement processing: Enhancement is performed on the luminance channel based on the parameters adjusted in step A3, specifically including: A4.1 Sub-block division: Divide the brightness channel into non-overlapping sub-blocks evenly according to the adjusted tile network size; A4.2 Contrast Limitation: Apply the contrast limit threshold clipLimit determined in step A3.2 to the grayscale histogram of each sub-block to clip grayscale frequencies exceeding the threshold and distribute them evenly to other grayscale levels to obtain the clipped histogram. The generation logic of the "cropped histogram" is as follows: set the maximum frequency threshold corresponding to clipLimit as T=clipLimit×(number of sub-block pixels / 256), and for the part with grayscale frequency > T, the excess amount is evenly distributed to other grayscale levels.
[0058] A4.3 Equalization and Stitching: Equalization is performed on the cropped histogram, and the sub-block results are stitched together using bilinear interpolation to eliminate edge transitions, outputting a CLAHE-enhanced luminance channel image. ; A5. Guided filtering noise reduction processing: Based on the original luminance channel, the luminance channel image Denoising is performed, specifically including: A5.1 Filter Parameter Configuration: Set the filter window radius to 5 pixels, and the regularization parameter... , corresponding regularization coefficient ; A5.2 Local Linear Fitting: Using the original luminance channel as the guide image G, and the luminance channel image... For the image I to be denoised, the linear model parameters are solved by minimizing the error function within each 5×5 pixel window. , The error function is: Where I represents the image to be denoised, i.e., the luminance channel enhanced by CLAHE. , The linear coefficients within the pixel window k are... This is the offset within the pixel window k; , cov is the covariance, var is the variance, and mean is the mean, all calculated based on a 5×5 window.
[0059] A5.3 Pixel value fusion: For each pixel, the linear model parameters of its window are calculated using bilinear interpolation. , Mean value, output the denoised luminance channel based on the mean value. ; A5.4 Image Reconstruction Output: The denoised luminance channel... The image is merged with the chroma channel extracted from A1 and converted back to the RGB color space to obtain a globally preprocessed image under low light conditions.
[0060] This invention protects the technical solution of "adaptively optimizing CLAHE parameters for low-light environments" through a complete process of "low-light feature quantization → dynamic parameter mapping → enhanced denoising collaboration." The difference from traditional methods with fixed parameters is that: 1. Contrast enhancement effect: Traditional fixed-parameter methods, using fixed tile grid sizes and clipLimit parameters, struggle to meet the needs of different low-light scenes. For example, in extremely low-light scenes with rich detail, a fixed large tile grid may result in insufficient local contrast enhancement, failing to effectively highlight details in dark areas; while a fixed small clipLimit may limit the overall contrast improvement, leaving the image still appearing dark.
[0061] The adaptive CLAHE parameter optimization method dynamically adjusts parameters based on metrics such as the proportion of low-light areas and detail density through low-light feature quantization. In scenes with a large proportion of low-light areas, the clipLimit is appropriately reduced to avoid overexposure in dark areas while enhancing contrast. For low-light scenes rich in detail, a smaller tile grid is used to enhance the contrast of each small area separately, thereby more precisely improving the overall image contrast and making dark details clearer.
[0062] 2. Details retained: Traditional fixed-parameter methods: Fixed parameter settings cannot adapt to the varying detail levels of different images. For images rich in detail in low-light environments, such as the fine textures on a wooden template or the intricate structure of circuit components, a fixed large tile grid will blur these details when enhancing contrast; while a fixed high clipLimit may over-amplify noise, masking true detail information.
[0063] The adaptive CLAHE parameter optimization method dynamically adjusts the tile grid size based on detail density. When rich image details are detected, a smaller tile grid is automatically adopted, ensuring targeted contrast enhancement for details within each small region and maximizing detail preservation. Simultaneously, the clipLimit is adjusted based on noise levels to effectively suppress noise interference with details while enhancing contrast.
[0064] 3. Noise suppression: Traditional fixed-parameter methods: Ignoring noise levels, a fixed clipLimit parameter may amplify noise while enhancing contrast. For example, in low-light and noisy industrial environment images, a high clipLimit will enhance the contrast of noise, resulting in noticeable graininess or artifacts in the image, affecting image quality and subsequent analysis.
[0065] The adaptive CLAHE parameter optimization method automatically reduces the clipLimit parameter when noise levels are high, minimizing the amplification effect of noise during contrast enhancement. Simultaneously, when dynamically adjusting the tile mesh size, a larger tile mesh is used for high-noise scenes to reduce the impact of noise on local enhancement. Furthermore, subsequent guided filtering denoising synergizes with the adaptive CLAHE enhancement to further suppress noise and output a cleaner image.
[0066] 4. Scene adaptability: Traditional fixed-parameter methods: Fixed parameters are only applicable to certain low-light scenarios and have poor adaptability to complex and variable low-light environments. For example, in the low-light environments of different industrial workshops, some workshops have low-light areas concentrated in certain locations, while others are generally dark and accompanied by varying degrees of noise. Fixed parameters cannot effectively handle these differences.
[0067] The adaptive CLAHE parameter optimization method comprehensively considers various low-light characteristics such as the proportion of low-light areas, detail density, and noise level, and can dynamically adjust parameters according to different low-light environments. Whether it's a localized or overall low-light scene, or a low-noise or high-noise low-light environment, it can adaptively optimize CLAHE parameters and work in conjunction with guided filtering denoising to achieve good image enhancement results in various low-light conditions.
[0068] 5. Overall image quality and application effect: Traditional fixed-parameter methods: Since the parameters cannot be optimized according to the actual situation of the image, the enhanced image may have problems such as overexposure, underexposure, loss of detail, and amplification of noise, which will affect subsequent image analysis and recognition tasks. For example, in industrial inspection, it may lead to missed or false defects.
[0069] The adaptive optimization method for CLAHE parameters significantly improves the overall image quality in low-light environments through adaptive optimization and collaborative processing throughout the entire process. The enhanced image has moderate contrast, clear details, and effectively suppressed noise, providing more reliable image data for subsequent industrial inspection, image recognition, and other tasks, thereby improving the accuracy and efficiency of the tasks.
[0070] More specifically, for high-dust environments, the process of applying a high-dust enhancement strategy to the original image and executing a DehazeNet dehazing model trained on industrial dust scenarios combined with bilateral filtering denoising to obtain a global preprocessed image is as follows: B1. DehazeNet Dehazing Processing: B1.1 Model Loading: Load the pre-trained DehazeNet dehazing model, which is trained based on industrial dust scene data. The DehazeNet dehazing model is an image, and its output is transmittance. The training data for the DehazeNet model includes: Synthetic data: Images generated using fog-free images of industrial scenes and atmospheric scattering models, with dust concentrations ranging from 0.1 to 2.0. ; Real data: Paired images with and without fog, collected simultaneously from the industrial site, captured by both clean and contaminated lenses.
[0071] B1.2 Transmittance Prediction: The original image is input into the DehazeNet dehazing model, and the predicted transmittance map t(x) is output. The transmittance map t(x) has a value range of [0.1,1]. Over-enhancement is avoided by thresholding the network output value (values less than 0.1 are set to 0.1).
[0072] B1.3 Image Restoration: The fog-free image is restored based on the atmospheric scattering model J(x) = (I(x) - A) / t(x) + A, where A is the global atmospheric illumination intensity, estimated by the average value of the top 0.1% of the image brightness; I(x) is the pixel value at pixel x in the original image; J(x) is the pixel value at pixel x in the fog-free / dust-free image to be restored; and t(x) is the transmittance. Here, t(x) = 1 indicates no scattering and no light attenuation. , Here, d(x) represents the atmospheric scattering coefficient, and d(x) represents the actual distance of the object corresponding to pixel x. B2. Bilateral filtering noise reduction processing: B2.1 Parameter configuration: Set the spatial domain standard deviation sigma_space=15, and the value domain standard deviation sigma_color=30; B2.2 Weight Calculation: For each pixel p, calculate the spatial domain weight within a 15×15 neighborhood. Sum range weight ; The calculation of spatial domain weights and range weights employs a parallel optimization algorithm, implemented with GPU acceleration: Divide the image into 16×16 pixel thread blocks; Each thread calculates the weight of the corresponding pixel and writes it to shared memory; Parallel accumulation of neighboring pixels is achieved through atomic operations.
[0073] B2.3 Weighted Filtering: Outputs denoised pixel values , where N(p) is the 15×15 neighborhood of pixel p, and W(p) is the normalization coefficient; B3. Output global preprocessed image: Output the dehazed and denoised image as the final enhancement result, which is the global preprocessed image.
[0074] B4. Enhancement effect evaluation: The sharpness score (such as Tenengrad gradient value) of the enhanced image is calculated and compared with a preset threshold. If it is lower than the threshold, a second enhancement is triggered.
[0075] The object retrieval model used in this invention is specifically trained for industrial dust scenarios, forming a complete chain from environmental assessment → defogging → noise reduction → evaluation. Compared to existing technologies, the advantages are: More precise enhancement: Existing technologies may lack an environmental assessment step, directly employing general dehazing and denoising algorithms, which cannot specifically address image problems in different environments. In contrast, this invention, by clearly identifying a high-dust environment, uses DehazeNet dehazing trained on industrial dust scenarios. Compared to general dehazing algorithms, it can more accurately remove blur caused by dust, restoring image details; it preserves image details to the greatest extent, thereby improving the overall clarity and quality of the image.
[0076] More specifically, for a backlit environment, the process of applying a backlight enhancement strategy to the original image and performing multi-scale Retinex enhancement combined with specular suppression to obtain a globally preprocessed image is as follows: C1, Multiscale Retinex Enhancement: C1.1 Scale Decomposition: The brightness channel of the original image is convolved with three Gaussian kernels of different standard deviations to generate blurred images at low, medium, and high scales, where the standard deviations of the Gaussian kernels are respectively... , , ; C1.2, Detail Extraction: Through Formulas Calculate the detail layers at each scale, where... This represents the Retinex detail layer at the i-th scale. This represents the original luminance channel, where x and y are the pixel coordinates. For the blurred image at the corresponding scale, i=1,2,3, which correspond to Gaussian blur at different scales, i=1 corresponds to... i=2 corresponds to i=3 corresponds to ; C1.3, Weighted Fusion: Calculates the detail layers at three scales according to their weights. Weighted summation, where, Generate an enhanced luminance channel ; C2. Highlight suppression processing: C2.1 Highlight Area Location: Mark pixels with a grayscale value > 220 in the luminance channel as highlight areas; C2.2, Brightness Attenuation: Perform non-linear attenuation on pixels in highlight areas. ,in, The attenuation coefficient is... ,and It decreases as pixel brightness increases; C3. Color Restoration and Image Reconstruction: C3.1 Color Compensation: (Using a formula) Calculate the color restoration factor, where The original RGB image, is the color recovery factor for the pixel at coordinates (x, y); C3.2, Reconstructed Output: The adjusted brightness channel Multiply by the color restoration factor, then merge with the original chroma channel, and convert back to the RGB color space to obtain the global preprocessed image under backlight conditions.
[0077] The above process, through a complete workflow of "environmental assessment → multi-scale enhancement → highlight suppression → color restoration," achieves breakthroughs in detail preservation, highlight suppression, and color reproduction. Specifically: 1. Enhancement of shadow detail (the effect of multi-scale Retinex): Pain point: Backlighting causes dark areas of the image (such as the shadow area of the wooden template) to be too dark, and details such as texture and scratches are lost.
[0078] Effect: Multi-scale Gaussian blur (σ=15 / 25 / 30) extracts full-scale details: small scale (σ=15) preserves fine textures such as wood grain and scratches; large scale (σ=30) preserves equipment outlines and background structure.
[0079] Weighted fusion balances details and contours: Enhanced shadow detail visibility increases by 30%-50% (e.g., scratches in the shadow area of a wooden template become clearly visible instead of invisible).
[0080] 2. Highlight suppression (the effect of brightness reduction): Pain point: In backlit environments, metal and smooth surfaces are prone to overexposure of highlights (such as equipment reflections, painted areas of wooden templates), resulting in localized overexposure and loss of detail.
[0081] Effect: Highlight area localization (grayscale > 220) accurately identifies overexposed areas; Non-linear decay (increasing with brightness) suppresses overexposure: Brightness in highlight areas is reduced by 20%-30%, while edge details are preserved (such as the outline of the reflective area of the device is no longer blurred).
[0082] 3. Color reproduction (the role of color compensation): Pain point: Backlighting causes overall color cast in the image (e.g., shadows appear cool and highlights appear warm), and traditional enhancement methods tend to exacerbate color distortion.
[0083] Effect: Color restoration factor corrects color deviation; After reconstruction, the color error (ΔE) of the image is reduced by 15%-25%, making it closer to the real scene (such as the natural texture color of the wooden template no longer being yellowish or bluish).
[0084] More specifically, for a normal environment, the process of applying a general enhancement strategy to the original image and performing adaptive histogram equalization combined with NLM denoising to obtain a global preprocessed image is as follows: D1. Adaptive Histogram Equalization (AHE) Processing: D1.1 Parameter Configuration: Set the contrast limit threshold clipLimit=2 to divide the image brightness channel into 8×8 sub-blocks; D1.2 Sub-block equalization: For the grayscale histogram of each sub-block, for grayscale levels whose clipping frequency exceeds clipLimit × (number of sub-block pixels / 256), the clipped frequencies are evenly distributed to other grayscale levels, and histogram equalization is performed. D1.3. Fusion Output: By stitching together the sub-block equalization results using bilinear interpolation, an adaptive histogram equalized brightness channel image is generated. To improve overall contrast; D2, NLM denoising (non-local mean denoising): D2.1 Parameter Configuration: Set the noise reduction intensity parameter h=3, and define the search window as 7×7 pixels and the similarity window as 5×5 pixels; D2.2 Similarity Calculation: For the brightness channel image For each pixel, calculate the grayscale similarity weight with other pixels within the search window. The formula is: Where p and q are the two pixels to be compared. Let p be the grayscale vector of the similarity window containing pixel p, and let p be the grayscale values of the 5x5 window surrounding pixel p. Represents the square of the Euclidean norm; D2.3, Weighted Denoising: Using the formula The denoised pixel values are calculated to obtain the denoised luminance channel, which suppresses minor noise in normal environments. This represents the grayscale value of pixel p in the luminance channel after denoising, which is the grayscale value of pixel p in the global preprocessed image. This indicates a search window centered on p. This represents the original grayscale value of pixel q in the luminance channel before denoising.
[0085] By using four dimensions of indicators—brightness, illumination, dust, and noise—such as brightness of 80-220 lux and illumination of 100-800 lux, the boundaries of a "normal environment" are clearly defined, distinguishing it from special scenarios such as low light and high dust.
[0086] Here, the resulting global preprocessed image is a color image.
[0087] S3. Construct a backlight region segmentation model. The input of the backlight region segmentation model is the texture features and illumination features of the wooden template in the global preprocessed image. The output of the backlight region segmentation model is a pixel-level mask of the backlight region. Then, an adaptive anisotropic diffusion filter is applied to the pixel-level mask of the located backlight region to enhance edge continuity. The diffusion coefficient is dynamically adjusted according to the texture direction of the wooden template to suppress diffusion perpendicular to the edge direction and retain information parallel to the edge direction, and output a locally enhanced image.
[0088] The specific process is as follows: E1. Backlight area segmentation model construction: E1.1 Feature Extraction: Extracting the texture and lighting features of the wooden template from the global preprocessed image, specifically including: E1.1.1 Texture features are obtained by calculating the contrast and entropy of the local binary mode (LBP) and gray-level co-occurrence matrix (GLCM) of the global preprocessed image.
[0089] By calculating quantization metrics such as contrast and entropy of Local Binary Pattern (LBP) and Gray-Level Co-occurrence Matrix (GLCM), texture features of an image can be effectively extracted. Texture features are essentially the spatial distribution patterns of gray values in an image (such as thickness, density, and directionality). LBP and GLCM are two classic texture description methods, and feature extraction is achieved by quantizing these patterns. 1) Local Binary Mode (LBP): Principle: By comparing the grayscale differences between a pixel and its neighboring pixels, a binary code is generated, and the histogram distribution of the code is then used as a texture feature. For example, for a 3×3 neighborhood, the grayscale of the center pixel is compared with the grayscale of the surrounding 8 pixels. If the grayscale is greater than the center value, it is recorded as 1; otherwise, it is recorded as 0, forming an 8-bit binary number (such as "10110011"). Finally, the histogram reflects the roughness or uniformity of the local texture.
[0090] Function: Sensitive to subtle local texture changes, effectively describing the "graininess" of textures (such as the wood grain density of a wooden template).
[0091] 2) Gray-level Co-occurrence Matrix (GLCM): Principle: In a statistical image, distance d and direction d are... The probability distribution of two pixel grayscale value combinations (such as 0°, 45°, 90°, 135°) is then used to calculate secondary statistics such as contrast and entropy using this matrix. Contrast: Reflects the clarity and depth of the texture (the higher the value, the clearer the texture, such as the more obvious the boundary between light and dark in wood grain). Entropy: Reflects the complexity of the texture (the larger the value, the more irregular the texture, such as the knotted areas of a wooden template).
[0092] Function: Describes the macroscopic patterns of textures from a global statistical perspective, complementing the local details of LBP.
[0093] The specific process of obtaining texture features is as follows: 1. Preprocessing adaptation: The input image is converted to grayscale (because the global preprocessed image is a color image), and noise is removed by Gaussian filtering (to avoid noise interfering with texture statistics); For wooden template images, the region of interest (ROI) can be cropped first to reduce background interference.
[0094] 2. Extended calculation of LBP features: Basic LBP only describes a 3×3 neighborhood. In practical applications, it needs to be extended to multi-scale LBP (such as 5×5 or 7×7 neighborhood) to capture textures of different thicknesses (such as the trunk and branches of wood grain). Histogram statistics are performed on the generated LBP codes to obtain feature vectors with the dimension of "number of coding categories corresponding to the number of neighboring pixels" (e.g., the histogram of an 8-neighbor LBP contains 256 bins).
[0095] 3. Parameter design of GLCM features: You need to specify the distance d (e.g., 1 or 3 pixels) and the direction ( (e.g., 0°, 45°, 90°, 135°) to capture textures at different scales and in different directions (e.g., the longitudinal continuity of wood grain). In addition to contrast and entropy, energy (reflecting texture uniformity) and correlation (reflecting the linear dependence of gray values) are usually also calculated to form a more comprehensive feature set; Take the mean or maximum value of GLCM features in different directions to reduce orientation sensitivity (if the texture has no significant orientation).
[0096] 4. Feature fusion: The LBP histogram features are concatenated with the contrast, entropy, energy, and other statistics of GLCM to form the final texture feature vector, which is used for subsequent model training (such as random forest classifiers).
[0097] E1.1.2 Extract the brightness gradient magnitude and the skewness coefficient of the local brightness distribution of the global preprocessed image to obtain the illumination features.
[0098] 1. Input: Global preprocessed image (RGB color image): Source: Globally preprocessed image enhanced and denoised by CLAHE / Retinex (low light / backlight enhancement result as described in the claim).
[0099] Preprocessing: Convert to the brightness channel Y (e.g., the Y channel in the YCrCb space) to focus on illumination feature extraction.
[0100] 2. Calculation of brightness gradient magnitude: The brightness gradient magnitude reflects the degree of drastic change in local brightness of an image (such as the highlight edges and shadow boundaries of a wooden template). Calculation steps: (1) Gradient operator: For the luminance channel Y, the horizontal gradient is calculated using the Sobel operator. and vertical gradient : , ; (2) Gradient magnitude: The gradient magnitude H(x,y) is the L2 norm of the gradient vector: ; (3) Industrial significance: High gradient amplitude areas: correspond to the highlight edges, shadow boundaries, and texture contours (such as seams and scratches) of the wooden template. Low gradient amplitude region: corresponds to smooth lighting areas (such as equipment surface, uniform background); 3. Calculation of the skewness coefficient of local brightness distribution: The skewness coefficient reflects the asymmetry of brightness distribution (e.g., more dark areas in a backlit environment, more bright areas in a highlight environment). Calculation steps: (1) Local region division: The luminance channel Y is divided into local blocks (e.g., 16×16 pixels), and each block corresponds to a local region R.
[0101] (2) Formula for skewness coefficient: For a local region R, the skewness coefficient Skew(R) is defined as: ,in, R is the average brightness of region R, and N is the number of pixels in the region; (3) Industrial significance: Skewness coefficient > 0: There are too many pixels in the bright part of the region (such as local blocks in a highlight environment); Skewness coefficient < 0: There are too many pixels in the dark areas of the region (such as local blocks in a backlit environment); The larger the absolute value, the more uneven the light distribution (e.g., the skewness coefficient of the local shaded area of the wooden template is <-1).
[0102] Illumination features are the sum of patterns in the brightness distribution of an image (such as mean brightness, contrast, and distribution morphology). The skewness coefficient is a core indicator describing "distribution symmetry," directly reflecting whether the illumination is balanced. By calculating the brightness gradient amplitude (reflecting edges) and the local skewness coefficient (reflecting illumination distribution), the illumination features of industrial images can be accurately extracted, providing crucial information for subsequent segmentation, enhancement, and defect detection.
[0103] E1.2 Feature Fusion and Classification: The extracted texture features and illumination features are input into a random forest classifier to train a backlit region segmentation model; E1.3 Pixel-level Mask Generation: The trained backlight region segmentation model is applied to classify the global preprocessed image pixel by pixel, outputting the initial pixel-level mask for the backlight region. ,in, Represents the pixels in the backlight area. Indicates pixels in the non-backlit area; E2. Post-mask processing: Perform dilation and erosion operations (i.e. morphological operations) on the initial pixel-level mask to remove isolated noise areas and retain continuous backlight areas, to obtain the final backlight area pixel-level mask M(x,y). E3, Adaptive Anisotropic Diffusion Filter: E3.1 Edge Direction Estimation: For the pixel-level mask M(x,y) of the backlight region obtained from the localization, calculate the local gradient direction. Where I is the brightness channel of the global preprocessed image; E3.2 Dynamic Adjustment of Diffusion Coefficient: The diffusion coefficient is dynamically adjusted according to the grain direction of the wood template to construct a diffusion tensor. ,in, , , , , Parameters for controlling the degree of anisotropy, K is the gradient threshold. For gradient operators, ; E3.3, Diffusion Filtering Iteration: The image is updated iteratively using the following partial differential equation. Where t is the iteration time step, The divergence operator suppresses diffusion perpendicular to the edge direction while preserving information parallel to the edge direction, resulting in the filtered backlight area. E4. Local Enhancement Image Generation: The filtered backlit area is fused with the non-backlit area to output a locally enhanced image, in which the texture edge continuity of the backlit area is enhanced and noise and artifacts are suppressed.
[0104] This step combines texture (LBP, GLCM) and lighting (gradient, skewness coefficient) features to accurately locate the backlit area, unlike traditional segmentation methods that rely solely on brightness. The diffusion direction is dynamically adjusted using the diffusion tensor D to ensure enhancement along the wood template texture direction. (Large diffusion coefficient in the directional direction), suppression in the vertical direction (small diffusion coefficient in the orthogonal direction), introduction Controlling the degree of anisotropy (recommended for industrial scenarios) K adjusts the gradient sensitivity (K=15 is recommended).
[0105] S4. Design a structure-aware local adaptive thresholding algorithm for the locally enhanced image, dynamically adjust the local threshold range by combining gradient direction and edge density information; embed a lightweight U-Net network to perform structural enhancement on the image texture, and output a binarized image that maintains structural continuity.
[0106] The specific process is as follows: S4.1 For the local enhanced image, the Sobel operator or a similar gradient calculation operator is used to calculate the gradient of the image in the horizontal and vertical directions respectively, so as to obtain the gradient magnitude and gradient direction of each pixel. Using the arctangent function Calculate the gradient direction, where, These are the gradient values in the horizontal and vertical directions, respectively. The gradient direction.
[0107] S4.2. Perform edge detection on the locally enhanced image. This can be done using the Canny edge detection algorithm or other edge detection algorithms to obtain an edge map of the locally enhanced image. Count the number of edge pixels in the edge map and compare it with the total number of pixels in the locally enhanced image to obtain edge density information. For example, edge density... ,in, This refers to the number of edge pixels. This is used to locally enhance the number of pixels in an image.
[0108] S4.3. Based on the calculated gradient direction and edge density information, a local threshold adjustment model is constructed. The local threshold adjustment model is as follows: ,in, Let a and b be the initial thresholds, and a and b be the adjustment coefficients. Let (x, y) be the gradient magnitude of the pixel. This represents the edge density of the local region where pixel (x,y) is located.
[0109] In some embodiments, a=-0.02, b=0.5, and the adjustment coefficients of the local threshold adjustment model are obtained through grid search optimization of 5000 labeled images.
[0110] In regions with drastic gradient changes and high edge density, the local threshold range should be appropriately increased to better preserve edge and detail information; in regions with gentle gradient changes and low edge density, the local threshold range should be appropriately decreased to remove noise and background interference.
[0111] S4.4 Constructing a Lightweight U-Net Network: A lightweight U-Net network structure is designed, consisting of an encoder and a decoder. The encoder uses convolutional and pooling layers for downsampling to extract features from different levels of the image; the decoder uses deconvolutional and upsampling layers for upsampling, fusing and restoring the features extracted by the encoder. Lightweight design is introduced into the network, such as using depthwise separable convolutions instead of traditional convolutions to reduce network parameters and computational cost. Simultaneously, skip connections are added between network layers to directly connect features from different levels in the encoder to the corresponding levels in the decoder, preserving the image's detailed information.
[0112] S4.5 Input the image processed by the local threshold adjustment model into the lightweight U-Net network, and output a binarized image through the lightweight U-Net network.
[0113] The specific process of S4.5 is as follows: S4.5.1. The image processed by the local thresholding model is input into the lightweight U-Net network. The image propagates forward through the network, passing sequentially through each layer of the encoder. Each convolutional layer performs a convolution operation with the input image using a convolution kernel to extract image features. The pooling layer downsamples the convolutional feature map, reducing its size. In the decoder, the deconvolutional layer upsamples the downsampled feature map to restore its size and fuses it with the feature map of the corresponding layer in the encoder through skip connections to enhance the texture and structural information of the image.
[0114] S4.5.2 The last layer of the network uses the Sigmoid activation function or other suitable binarization activation function to convert the feature map output by the network into a binary image. By setting an appropriate threshold, pixels with values greater than the threshold are set as foreground (e.g., a value of 1), and pixels with values less than the threshold are set as background (e.g., a value of 0), thus obtaining a binary image that maintains structural continuity for subsequent image analysis and processing tasks.
[0115] S5. Extract the edge map of the binarized image using an edge detection algorithm, extract the contours in the binarized image based on a graph convolutional network, represent the edge map as graph structure nodes, optimize the topological structure of the contours in the binarized image using a loss function of "continuity constraint + curvature constraint + closure judgment", then extract the geometric features of the contours and compare them with the standard feature library for wood template processing, output the edge quality evaluation result and feed it back to the processing control system.
[0116] The specific process is as follows: S5.1 Edge Map Extraction: Perform the Canny edge detection algorithm on the input binarized image to extract the edge map E, where edge pixels are marked as 1 and non-edge pixels are marked as 0; S5.2 Graph Structure Construction: S5.2.1. Treat the edge pixels in edge graph E as graph structure nodes. Where N is the total number of edge pixels; S5.2.2, Define node adjacency relationships: If node and If the edge pixels are connected in an 8-neighborhood, then an edge connection is established. This forms a graph structure W=(V,E); S5.3 Graph Convolutional Network Contour Extraction: Construct a Graph Convolutional Network (GCN) (GCN's specific structure: "2-layer graph convolution (hidden layer dimension 64→32), node features include gradient direction (quantized to 8-dimensional), curvature (1-dimensional), and coordinates (2-dimensional)"). Input the graph structure W and node features, where the node features include gradient direction and curvature. Aggregate neighborhood features through 2-3 layers of graph convolution, output the probability distribution of contour candidate nodes, and extract the initial contour. .
[0117] In contour topology optimization based on graph convolutional networks (GCNs), node features (such as gradient direction and curvature) are the core information describing the local geometric characteristics of edge pixels, and their acquisition requires a combination of image preprocessing and geometric computation methods. The following are the specific extraction process and technical details: I. Specific methods for obtaining node features (gradient direction, curvature): 1. Extraction of gradient direction features: The gradient direction reflects the local change trend of edge pixels and is a key feature for determining the contour direction. The specific steps are as follows: Step 1: Calculate gradient magnitude and direction: Calculate the gradients in the x and y directions using the Sobel operator on the original binarized image (or its grayscale version): gradient in the x-direction It is obtained by convolving the image with Sobel horizontal convolution kernels (such as [[-1,0,1],[-2,0,2],[-1,0,1]]); gradient in the y-direction It is obtained by convolving the image with Sobel vertical convolution kernels (such as [-1,-2,-1], [0,0,0], [1,2,1]).
[0118] Step 2: Calculate the gradient direction angle: For each edge pixel Its gradient direction angle Defined as: ,in The function returns the gradient vector. The angle with the positive x-axis (range: arrive ), which can then be normalized to Alternatively, it can be quantized into 8 directional intervals (e.g., one interval per 45°) and used as node feature input to the GCN.
[0119] 2. Extraction of curvature features: Curvature describes the degree of curvature of the contour (e.g., smooth edges have small curvature, while burrs or corners have large curvature), and is used to optimize "burr removal" and "corner smoothing" in the topology. The specific steps are as follows: Step 1: Contour point serialization. Chain code tracing (e.g., 8-direction chain code) is performed on the connected contours in the edge map to convert the 2D edge pixels into an ordered point sequence. ,in Let be the coordinates of the k-th contour point.
[0120] Step 2: Local window curvature calculation for each point in the sequence Take the n neighboring points before and after it (e.g., n=3, i.e., the window size is 7), and calculate the curvature using the following method: Method 1: Circular fitting curvature for the point set within the window Fitted circular curve, curvature (R is the radius of the fitted circle; the larger the radius, the smaller the curvature).
[0121] Method 2: Calculation point of the curvature of the included vector angle with the previous neighbor vector , and the next neighbor vector The curvature is approximately equal to the sine of the angle between the two vectors. ; Normalization: The curvature values are normalized to the [0,1] interval and used as node features input to GCN.
[0122] II. The Role of Node Features in GCN Gradient direction: helps GCN identify the consistency of contour direction and strengthens the "continuity constraint" in topology optimization (edges in the same direction should remain connected).
[0123] Curvature: Helps GCN distinguish between smooth edges and burrs / corners, suppresses high curvature anomalies (such as burrs) in "curvature constraints", and preserves the curvature features of reasonable corners.
[0124] By aggregating neighborhood features through 2-3 layers of graph convolutional layers, the probability distribution of contour candidate nodes is output, and the initial contour is extracted. The specific process is as follows: By aggregating neighborhood features layer by layer through multi-layer graph convolutional layers (GCN), the discriminative power of contour nodes is enhanced. First layer graph convolution (feature dimensionality enhancement and local aggregation): Input: Node features; Core operation: For each node Aggregate all its adjacent nodes The characteristic of is defined by the formula: ; in: For nodes initial characteristics, For the set of adjacent nodes, This represents the number of adjacent nodes. The convolution weight matrix is... For bias terms; The ReLU activation function is used to enhance nonlinear expression. Output: 32-dimensional feature vector It captures the gradient and curvature correlation features of local edges.
[0125] Second-layer graph convolution (feature dimensionality reduction and global association): Input: The 32-dimensional feature vector output from the first layer.
[0126] Core operation: Further aggregate a wider range of neighborhood features (indirectly covering the 2-hop neighborhood through the first layer feature propagation), the formula is: ; in, ; Output: 16-dimensional feature vector This enhances the global continuity of the contour.
[0127] Third layer graph convolution (optional, for complex edges): If the edge map has multiple branches or noise, add a third layer of graph convolution: Input: The 16-dimensional feature vector output from the second layer.
[0128] Output: 8-dimensional feature vector ,pass Further compress features to focus on the core contour pattern.
[0129] III. Probability Distribution Output and Initial Contour Extraction: 1. Profile probability prediction: Final layer mapping: The output features of the last GCN layer (16-dimensional or 8-dimensional) are mapped to 2-dimensional (contour / non-contour) through a fully connected layer, and the probabilities are calculated using the Softmax activation function. ; , The logits value is the output of the fully connected layer. This represents the probability that a node belongs to contour C.
[0130] 2. Candidate node selection: Set the probability threshold T (dynamically adjusted: T=0.65 for dense texture areas, T=0.55 for smooth areas), when When the time is right, mark it as a candidate node for the contour.
[0131] 3. Initial outline generate: For the selected candidate nodes, connect them into continuous line segments according to their coordinate order in the image (based on 8-neighbor connectivity); remove isolated candidate nodes (number of adjacent candidate nodes < 2) to form an initial contour map containing the main contour. Preserve the main structural elements at the edges (such as the boundaries of the wooden formwork and the seams).
[0132] S5.4 Topology optimization: S5.4.1. Define the loss function L, which includes three constraints: Continuity constraints: ,in, Let be the actual Euclidean distance between node i and node j. Let be the expected continuous distance between node i and node j.
[0133] The methods for obtaining the data include statistical methods based on contour priors.
[0134] Using standard profile data of wooden templates, the distribution of distances between nodes of qualified profiles is statistically analyzed and used as the expected distance: (1) Standard contour sampling: Collect the contour data of R qualified wooden templates and extract the contour node sequence. M represents the number of contour nodes.
[0135] (2) Statistical node spacing: For a standard profile, calculate adjacent nodes. and Euclidean distance The statistics show that: Average continuous distance ; Distance from standard deviation R is the gradient threshold.
[0136] (3) Expected distance setting: For the nodes of the current contour , If they belong to adjacent contour segments (e.g., 8-neighbor connectivity), then the expected continuous distance is set as follows: , For tolerance, for example This indicates that a small range of fluctuations is allowed.
[0137] Curvature constraint: ,in, Let be the curvature of node i. For local mean curvature; Closure determination: For a candidate region with a closed contour, calculate the contour gap length g. If... ,but ,otherwise, ; S5.4.2 Loss Function , , , Optimize GCN parameters through backpropagation; S5.4.3 Output optimized contour Its topology satisfies continuity (no breaks), low curvature abrupt changes (no burrs), and closure of key regions (such as the boundary of a wooden template).
[0138] S5.5, Contour Geometric Feature Extraction: Extracting geometric features from the optimized contour. Calculate the feature set F: Length characteristic: Total outline length Continuous length of segments ; Curvature characteristics: maximum curvature Standard deviation of curvature ; Closure characteristics: Area S of the closed region, number of gaps ; S5.6 Standard Feature Library Comparison: S5.6.1 Constructing a standard feature library for timber formwork processing The range of geometric feature thresholds that include qualified contours (e.g.) , Standard Feature Library for Wooden Formwork Processing This is generated through feature clustering of 3000 qualified wooden template images with geometric feature threshold ranges. (This is related to the standard feature library for wooden template processing.) When new image features are added, the geometric feature threshold (contour geometry) of the qualified contour is dynamically updated.
[0139] S5.6.2 Calculate the characteristic deviation The quality score is obtained by weighted summation. , The feature weights can be obtained through expert experience or statistical learning methods, which are existing technologies and will not be elaborated here.
[0140] S5.7 Result Output and Feedback: S5.7.1, if If the edge quality is deemed acceptable, it is considered acceptable; otherwise, the area is marked as unacceptable (e.g., burrs with excessive curvature or unclosed gaps). S5.7.2 Feedback the coordinates and deviation values of the non-conforming areas to the machining control system for adjusting machining parameters (such as cutting speed and tool accuracy).
[0141] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for enhancing the edges of backlit images based on intelligent recognition, characterized in that, include: Original images of the wood template processing site are acquired using multispectral image acquisition equipment, and environmental parameters of the processing site are also collected. The brightness characteristics and dust haze characteristics of the original images and environmental parameters are statistically analyzed to determine the type of the site environment. Based on the determined type of on-site environment, the original image is globally optimized and a globally preprocessed image is output using a set environment-aware enhancement mechanism. A backlight region segmentation model is constructed for the global preprocessed image, and the texture and illumination features of the wooden template in the global preprocessed image are extracted. The pixel-level mask of the backlight region in the global preprocessed image is output. Then, an adaptive anisotropic diffusion filter is applied to the pixel-level mask of the located backlight region to enhance the edge continuity. The diffusion coefficient is dynamically adjusted according to the texture direction of the wooden template to suppress diffusion perpendicular to the edge direction and retain information parallel to the edge direction, and the locally enhanced image is output. A structure-aware local adaptive thresholding algorithm is designed for the locally enhanced image, which dynamically adjusts the local threshold range by combining gradient direction and edge density information; a lightweight U-Net network is embedded to enhance the image texture and output a binarized image that maintains structural continuity. Edge maps are extracted from the binarized image using an edge detection algorithm. Contours in the binarized image are extracted based on a graph convolutional network. The edge maps are represented as graph structure nodes. The topological structure of the contours in the binarized image is optimized using a loss function of "continuity constraint + curvature constraint + closure judgment". Then, the geometric features of the contours are extracted and compared with the standard feature library for wood template processing. The edge quality assessment results are output and fed back to the processing control system.
2. The method for enhancing the edge of a backlight effect image based on intelligent recognition according to claim 1, characterized in that, The objects in the original image include the wooden template and the processing area of the wooden template. The environmental parameters include light intensity, dust concentration, temperature, and humidity. The specific process of determining the type of the site environment by statistically analyzing the brightness and dust haze characteristics of the original image and environmental parameters is as follows: Extract the brightness features of the original image, including brightness distribution features and highlight / shadow features; Extract the dust haze features from the original image, which include sharpness and contrast features, particle noise features, and color shift features; The collected environmental parameters are compared with preset thresholds to preliminarily screen the environmental types and obtain preliminary screening results. The preliminary screening results include candidate labels for low light environment type, high dust environment type, backlight environment type, or no special environment. Based on the preliminary screening results, the original image and environmental parameters are fused using a set rule engine to determine the type of the on-site environment: If the initial screening result is a candidate for low light environment, the rule engine calls the low light feature set to verify whether the low light environment judgment conditions are met. If the low light environment judgment conditions are not met, it determines whether the high dust environment judgment conditions, backlight environment judgment conditions, or normal environment conditions are met. If the initial screening result is a candidate for a high-dust environment, the rule engine calls the high-dust feature set to verify whether the high-dust environment judgment conditions are met. If the low-light environment judgment conditions are not met, it determines whether the low-light environment judgment conditions, backlight environment judgment conditions, or normal environment conditions are met. If the initial screening result is a candidate identifier for a backlight environment, the rule engine calls the backlight feature set to verify whether the backlight environment judgment conditions are met. If the low light environment judgment conditions are not met, it determines whether the low light environment judgment conditions, high dust environment judgment conditions, or normal environment conditions are met. If the initial screening results show no special environment candidate identifiers, it is determined to be a normal environment; If the preliminary screening results contain at least two of the following: low-light environment candidate identifiers, high-dust environment candidate identifiers, and backlight environment candidate identifiers, then the rule engine will call and judge the corresponding feature sets in descending order of high-dust environment, backlight environment, and low-light environment.
3. The method for enhancing the edge of a backlight effect image based on intelligent recognition according to claim 2, characterized in that, The low-light feature set includes global average brightness, light intensity and dust feature verification parameters. The low-light environment determination condition is: global average brightness < threshold D + light intensity < threshold E + no significant dust features. The high dust feature set includes the gradient energy, dust concentration, and high-frequency noise density of the original image. The high dust environment determination condition is: gradient energy of the original image < threshold A + dust concentration > threshold B + high-frequency noise density > threshold C. The backlight feature set includes the skewness coefficient of the image brightness histogram and the average brightness. The backlight environment determination condition is: the skewness coefficient of the image brightness histogram > threshold F and the average brightness < threshold G.
4. The method for enhancing the edge of a backlight effect image based on intelligent recognition according to claim 2, characterized in that, The specific environmental awareness enhancement mechanism is as follows: If the on-site environment is a low-light environment: perform CLAHE on the original image to enhance the contrast of low-light areas, dynamically adjust the tile grid size and clipLimit parameter, and combine guided filtering to obtain a global preprocessed image; If the on-site environment is a high-dust environment: call the high-dust enhancement strategy on the original image, and execute the DehazeNet dehazing model trained based on the industrial dust scene combined with bilateral filtering denoising operation to obtain a global preprocessed image; If it is a backlit environment: apply the backlight enhancement strategy to the original image, perform multi-scale Retinex enhancement combined with specular suppression to obtain a global preprocessed image; In a normal environment: the general enhancement strategy is applied to the original image, and adaptive histogram equalization combined with NLM denoising is performed to obtain a global preprocessed image.
5. The method for enhancing the edge of a backlight effect image based on intelligent recognition according to claim 4, characterized in that, The specific process of performing CLAHE to enhance the contrast of low-light areas on the original image, dynamically adjusting the tile grid size and clipLimit parameter, and combining this with guided filtering denoising to obtain the global preprocessed image is as follows: A1. Convert the original image from the RGB color space to the YCrCb color space, and extract the luminance channel and chrominance channel. The luminance channel includes the Y channel, which is used for enhancement processing in subsequent processes. The chrominance channel includes the Cr channel and the Cb channel, which are used to preserve the original color information. A2. Quantitative analysis of low-light region features: Feature analysis was performed on the brightness channel to obtain the following quantitative indicators: A2.1, Proportion of Low-Light Areas The low-light region is segmented by setting a brightness threshold, and the ratio of the number of pixels in the low-light region to the total number of pixels in the original image is calculated. A2.2, Detail Density Perform Canny edge detection on low-light areas and calculate the ratio of edge pixels to low-light area pixels; A2.3, High-frequency noise density Perform Fourier transform on low-light regions and count the energy percentage of high-frequency components with frequencies greater than 1 / 4 of the image width. A3. Dynamic adjustment of CLAHE parameters: Based on the quantification metrics from step A2, dynamically adjust the key parameters of the contrast-limited adaptive histogram equalization (CLAHE): A3.1, Tile network size adjustment: like This indicates that the low-light area has rich details, so set the grid size to 6×6; like If so, it means that the low-light area has medium detail, and the grid size should be set to 8×8; like or If the low-light area has sparse details or is a high-noise area, set the grid size to 10×10. A3.2, Adjusting the clipLimit parameter: like If the low light area is severely low light, then set the contrast limit threshold clipLimit=2-3; like If the low light area is moderately low, then set the contrast limit threshold clipLimit=4-5; like If the value is 0, it indicates that the low-light area is slightly low-light, and the contrast limit threshold is set to clipLimit=6-7. A4, CLAHE enhancement processing: Enhancement is performed on the luminance channel based on the parameters adjusted in step A3, specifically including: A4.1 Sub-block division: Divide the brightness channel into non-overlapping sub-blocks evenly according to the adjusted tile network size; A4.2 Contrast Limitation: Apply the contrast limit threshold clipLimit determined in step A3.2 to the grayscale histogram of each sub-block to clip grayscale frequencies exceeding the threshold and distribute them evenly to other grayscale levels to obtain the clipped histogram. A4.3 Equalization and Stitching: Equalization is performed on the cropped histogram, and the sub-block results are stitched together using bilinear interpolation to eliminate edge transitions, outputting a CLAHE-enhanced luminance channel image. ; A5. Guided filtering noise reduction processing: Based on the original luminance channel, the luminance channel image Denoising is performed, specifically including: A5.1 Filter Parameter Configuration: Set the filter window radius to 5 pixels, and the regularization parameter... , corresponding regularization coefficient ; A5.2 Local Linear Fitting: Using the original luminance channel as the guide image G, and the luminance channel image... For the image I to be denoised, the linear model parameters are solved by minimizing the error function within each 5×5 pixel window. , The error function is: Where I represents the image to be denoised, i.e., the luminance channel enhanced by CLAHE. , The linear coefficients within the pixel window k are... This is the offset within the pixel window k; A5.3 Pixel value fusion: For each pixel, the linear model parameters of its window are calculated using bilinear interpolation. , Mean value, output the denoised luminance channel based on the mean value. ; A5.4 Image Reconstruction Output: The denoised luminance channel... The chroma channels extracted from A1 are merged and converted back to the RGB color space to obtain a globally preprocessed image under low light conditions. The specific process of applying a high-dust enhancement strategy to the original image and executing a DehazeNet dehazing model trained on an industrial dust scene combined with bilateral filtering denoising to obtain a globally preprocessed image is as follows: B1. DehazeNet Dehazing Processing: B1.1 Model Loading: Load the pre-trained DehazeNet dehazing model, which is trained based on industrial dust scene data. The DehazeNet dehazing model is an image, and its output is transmittance. B1.2 Transmittance Prediction: Input the original image into the DehazeNet dehazing model and output the predicted transmittance map t(x); B1.3 Image Restoration: The fog-free image is restored based on the atmospheric scattering model J(x) = (I(x) - A) / t(x) + A, where A is the global atmospheric illumination intensity, estimated by the average value of the top 0.1% of the image brightness; I(x) is the pixel value at pixel x in the original image; J(x) is the pixel value at pixel x in the fog-free / dust-free image to be restored; and t(x) is the transmittance. Here, t(x) = 1 indicates no scattering and no light attenuation. , Here, d(x) represents the atmospheric scattering coefficient, and d(x) represents the actual distance of the object corresponding to pixel x. B2. Bilateral filtering noise reduction processing: B2.1 Parameter configuration: Set the spatial domain standard deviation sigma_space=15, and the value domain standard deviation sigma_color=30; B2.2 Weight Calculation: For each pixel p, calculate the spatial domain weight within a 15×15 neighborhood. Sum range weight ; B2.3 Weighted Filtering: Outputs denoised pixel values , where N(p) is the 15×15 neighborhood of pixel p, and W(p) is the normalization coefficient; B3. Output global preprocessed image: Output the dehazed and denoised image as the final enhancement result, which is the global preprocessed image; The specific process of applying a backlight enhancement strategy to the original image and performing multi-scale Retinex enhancement combined with specular suppression to obtain a globally preprocessed image is as follows: C1, Multiscale Retinex Enhancement: C1.1 Scale Decomposition: The brightness channel of the original image is convolved with three Gaussian kernels of different standard deviations to generate blurred images at low, medium, and high scales, where the standard deviations of the Gaussian kernels are respectively... , , ; C1.2, Detail Extraction: Through Formulas Calculate the detail layers at each scale, where... This represents the Retinex detail layer at scale i. This represents the original luminance channel, where x and y are the pixel coordinates. For the blurred image at the corresponding scale, i=1,2,3, which correspond to Gaussian blur at different scales, i=1 corresponds to... i=2 corresponds to i=3 corresponds to ; C1.3, Weighted Fusion: Calculates the detail layers at three scales according to their weights. Weighted summation, where, Generate an enhanced luminance channel ; C2. Highlight suppression processing: C2.1 Highlight Area Location: Mark pixels with a grayscale value > 220 in the luminance channel as highlight areas; C2.2, Brightness Attenuation: Perform non-linear attenuation on pixels in highlight areas. ,in, The attenuation coefficient is... ,and It decreases as pixel brightness increases; C3. Color Restoration and Image Reconstruction: C3.1 Color Compensation: (Using a formula) Calculate the color restoration factor, where The original RGB image, is the color recovery factor for the pixel at coordinates (x, y); C3.2, Reconstructed Output: The adjusted brightness channel Multiply by the color restoration factor, then merge with the original chroma channel, and convert back to the RGB color space to obtain the global preprocessed image under backlight conditions; The specific process of applying a general enhancement strategy to the original image and performing adaptive histogram equalization combined with NLM denoising to obtain a globally preprocessed image is as follows: D1. Adaptive Histogram Equalization (AHE) Processing: D1.1 Parameter Configuration: Set the contrast limit threshold clipLimit=2 to divide the image brightness channel into 8×8 sub-blocks; D1.2 Sub-block equalization: For the grayscale histogram of each sub-block, for grayscale levels whose clipping frequency exceeds clipLimit × (number of sub-block pixels / 256), the clipped frequencies are evenly distributed to other grayscale levels, and histogram equalization is performed. D1.
3. Fusion Output: By stitching together the sub-block equalization results using bilinear interpolation, an adaptive histogram equalized brightness channel image is generated. To improve overall contrast; D2, NLM noise reduction processing: D2.1 Parameter Configuration: Set the noise reduction intensity parameter h=3, and define the search window as 7×7 pixels and the similarity window as 5×5 pixels; D2.2 Similarity Calculation: For the brightness channel image For each pixel, calculate the grayscale similarity weight with other pixels within the search window. The formula is: Where p and q are the two pixels to be compared. Let p be the grayscale vector of the similarity window containing pixel p, and let p be the grayscale values of the 5x5 window surrounding pixel p. Represents the square of the Euclidean norm; D2.3, Weighted Denoising: Using the formula The denoised pixel values are calculated to obtain the denoised luminance channel, which suppresses minor noise in normal environments. This represents the grayscale value of pixel p in the luminance channel after denoising, which is the grayscale value of pixel p in the global preprocessed image. This indicates a search window centered on p. This represents the original grayscale value of pixel q in the luminance channel before denoising.
6. The method for enhancing the edge of a backlight effect image based on intelligent recognition according to claim 1, characterized in that, A backlight region segmentation model is constructed for the global preprocessed image. Texture and illumination features of the wooden template in the global preprocessed image are extracted, and a pixel-level mask of the backlight region in the global preprocessed image is output. Then, an adaptive anisotropic diffusion filter is applied to the located backlight region pixel-level mask to enhance edge continuity. The diffusion coefficient is dynamically adjusted according to the texture direction of the wooden template to suppress diffusion perpendicular to the edge direction and retain information parallel to the edge direction. The specific process of outputting the locally enhanced image is as follows: E1. Backlight area segmentation model construction: E1.1 Feature Extraction: Extracting the texture and lighting features of the wooden template from the global preprocessed image, specifically including: Texture features are obtained by calculating the contrast and entropy of the Local Binary Pattern (LBP) and Gray-Level Co-occurrence Matrix (GLCM) of the global preprocessed image. Illumination features are obtained by extracting the brightness gradient magnitude and the skewness coefficient of the local brightness distribution from the global preprocessed image. E1.2 Feature Fusion and Classification: The extracted texture features and illumination features are input into a random forest classifier to train a backlit region segmentation model; E1.3 Pixel-level Mask Generation: The trained backlight region segmentation model is applied to classify the global preprocessed image pixel by pixel, outputting the initial pixel-level mask for the backlight region. ,in, Represents the pixels in the backlight area. Indicates pixels in the non-backlit area; E2. Post-mask processing: Dilation and erosion operations are performed on the initial pixel-level mask to remove isolated noise areas and retain continuous backlight areas, resulting in the final backlight area pixel-level mask M(x,y). E3, Adaptive Anisotropic Diffusion Filter: E3.1 Edge Direction Estimation: For the pixel-level mask M(x,y) of the backlight region obtained from the localization, calculate the local gradient direction. Where I is the brightness channel of the global preprocessed image; E3.2 Dynamic Adjustment of Diffusion Coefficient: The diffusion coefficient is dynamically adjusted according to the grain direction of the wood template to construct a diffusion tensor. ,in, , , , , Parameters for controlling the degree of anisotropy, K is the gradient threshold. For gradient operators, ; E3.3, Diffusion Filtering Iteration: The image is updated iteratively using the following partial differential equation. Where t is the iteration time step, The divergence operator suppresses diffusion perpendicular to the edge direction while preserving information parallel to the edge direction, resulting in the filtered backlight area. E4. Local Enhancement Image Generation: The filtered backlit area is fused with the non-backlit area to output a locally enhanced image.
7. The method for enhancing the edge of a backlight effect image based on intelligent recognition according to claim 1, characterized in that, The specific process of designing a structure-aware local adaptive thresholding algorithm for the locally enhanced image, dynamically adjusting the local threshold range by combining gradient direction and edge density information, and embedding a lightweight U-Net network to perform structural enhancement of the image texture, outputting a binarized image that maintains structural continuity, is as follows: For the locally enhanced image, the Sobel operator is used to calculate the gradients in the horizontal and vertical directions, respectively, thereby obtaining the gradient magnitude and gradient direction of each pixel. Edge detection is performed on the locally enhanced image to obtain an edge map of the locally enhanced image; then the number of edge pixels in the edge map is counted and compared with the total number of pixels in the locally enhanced image to obtain edge density information; Based on the calculated gradient direction and edge density information, a local threshold adjustment model is constructed. The local threshold adjustment model is as follows: ,in, Let a and b be the initial thresholds, and a and b be the adjustment coefficients. Let (x, y) be the gradient magnitude of the pixel. This represents the edge density of the local region where pixel (x, y) is located. Constructing a lightweight U-Net network; The image processed by the local threshold adjustment model is input into the lightweight U-Net network, and the lightweight U-Net network outputs a binarized image.
8. The method for enhancing the edge of a backlight effect image based on intelligent recognition according to claim 7, characterized in that, The specific process of inputting the image processed by the local threshold adjustment model into the lightweight U-Net network and outputting the binarized image through the lightweight U-Net network is as follows: The image processed by the local threshold adjustment model is input into the lightweight U-Net network; A binary activation function is used in the last layer of the lightweight U-Net network to convert the feature map output by the lightweight U-Net network into a binary image.
9. The method for enhancing the edge of a backlight effect image based on intelligent recognition according to claim 1, characterized in that, The edge map of the binarized image is extracted using an edge detection algorithm. Contours in the binarized image are extracted using a graph convolutional network. The edge map is represented as graph structure nodes. The topological structure of the contours in the binarized image is optimized using a loss function combining continuity constraints, curvature constraints, and closure judgment. Then, the geometric features of the contours are extracted and compared with a standard feature library for wooden template processing. The edge quality assessment result is output and fed back to the processing control system. The specific process is as follows: Edge map extraction: Perform the Canny edge detection algorithm on the input binarized image to extract the edge map E, where edge pixels are marked as 1 and non-edge pixels are marked as 0; Graph structure construction: Use edge pixels in edge graph E as graph structure nodes. Where N is the total number of edge pixels; define node adjacency relationships: if node and If the edge pixels are connected in an 8-neighborhood, then an edge connection is established. This forms a graph structure W=(V,E); Graph Convolutional Network Contour Extraction: A Graph Convolutional Network (GCN) is constructed, taking the graph structure W and node features as input. The node features include gradient direction and curvature. Neighborhood features are aggregated through 2-3 graph convolutional layers, and the probability distribution of candidate contour nodes is output to extract the initial contour. ; Topology optimization: Define a loss function consisting of "continuity constraint + curvature constraint + closure judgment". Optimize the parameters of the graph convolutional network (GCN) through backpropagation using this loss function, resulting in an optimized contour output by the GCN. ; Contour geometric feature extraction: for the optimized contour Calculate the feature set F, which includes length features, curvature features, and closure features; Standard Feature Library Comparison: Constructing a Standard Feature Library for Wood Formwork Processing The geometric feature threshold range including the qualified contour; calculate the feature deviation. The quality score is obtained by weighted summation. , For feature weights; Results Output and Feedback: If If the edge quality is deemed acceptable, it is considered acceptable; otherwise, the unacceptable area is marked, and the coordinates and deviation values of the unacceptable area are fed back to the machining control system for adjusting the machining parameters.
10. The method for enhancing the edge of a backlight effect image based on intelligent recognition according to claim 9, characterized in that, The loss function is: ; , , These are the weights of the corresponding loss function. For the continuity constraint loss function, The curvature constraint loss function, The loss function is a closed-beta judgment function, and ,in, Let be the actual Euclidean distance between node i and node j. For the expected continuous distance, Let be the curvature of node i. For local mean curvature, Let W be the edge between node i and node j, and let W be the graph structure.
Citation Information
Patent Citations
Backlight diffusion method for image processing based on residual network
CN110838090A
Image picture edge extraction method and system based on AI model
CN119672056A
Image segmentation and dynamic target identification method based on artificial intelligence
CN120689620A
System and method for unsupervised superpixel-driven instance segmentation of remote sensing image
US20230252644A1
Cited By
Big data-based geographic surveying and mapping image classification processing system and method
CN121259463A
Self-adaptive image segmentation method and system based on visual template engine
CN121392289A
Printing pattern edge sharpening processing control and hardware imaging optimization system
CN121437323A
Image enhanced vision SLAM method and system suitable for complex light environment, medium and equipment
CN121504757A
Flame burning area envelope line digital detection method and device facing EN50399 standard
CN121582252A