Intelligent recognition-based backlight effect image edge enhancement method

By combining multispectral image acquisition with environmental parameters, the image enhancement strategy is dynamically adjusted to solve the problems of edge feature weakening and texture interference caused by backlighting in wood template processing, and to achieve high-quality image enhancement and defect detection in complex lighting environments.

CN120953153BActive Publication Date: 2026-02-10四川省建筑机械化工程有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511476122.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-16
Publication Date
2026-02-10
Estimated Expiration
2045-10-16

AI Technical Summary

Technical Problem

In intelligent recognition of wood template processing, the backlighting effect caused by complex lighting environment leads to extreme contrast in image brightness, resulting in weakened edge features, texture interference and misrecognition. Traditional methods cannot adapt to dynamic lighting changes, affecting the accuracy and stability of intelligent recognition.

Method used

Environmental parameters are acquired using multispectral image acquisition equipment. Combined with brightness and dust/haze features, the image enhancement strategy is dynamically adjusted. Adaptive anisotropic diffusion filtering and a lightweight U-Net network are used to extract and enhance edge features. Finally, a graph convolutional network is used to optimize the contour topology.

Benefits of technology

It achieves high-quality enhancement of wooden template images under complex lighting conditions, accurately preserves edge and texture details, and improves the accuracy of defect detection and production stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure QLYQS_11
    Figure QLYQS_11
  • Figure QLYQS_21
    Figure QLYQS_21
  • Figure QLYQS_45
    Figure QLYQS_45
Patent Text Reader

Abstract

The present application relates to the technical field of image processing, and discloses a backlight effect image edge enhancement method based on intelligent identification, which comprises the following steps: determining the type of the on-site environment; performing global optimization on the original image based on a set environment perception type enhancement mechanism according to the determined type of the on-site environment to output a global pretreatment image; constructing a backlight area segmentation model for the global pretreatment image; outputting a local enhancement image; designing a structure perception type local adaptive threshold algorithm for the local enhancement image to output a binary image that maintains the continuity of the structure; extracting an edge map of the binary image through an edge detection algorithm to optimize the topological structure of the contour in the binary image; comparing with a wooden template processing standard feature library to output an edge quality evaluation result and feed back to a processing control system. The present application realizes the deep linkage of defect detection and processing control, changes from passive detection to active optimization, and improves the production efficiency and the yield.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image processing, and particularly relates to a backlight effect image edge enhancement method based on intelligent identification. BACKGROUND

[0002] In the intelligent identification production of wood template processing, image acquisition and edge detection are the core links to realize automatic quality control, and directly affect the reliability of key processes such as template size measurement, defect identification (such as cracks, misalignment of splicing joints), and processing precision verification. However, the complex lighting environment in the wood template processing workshop (such as mixed natural light and industrial lighting, shadow formed by equipment blocking, metal processing parts reflection, etc.) is prone to cause backlight effect, resulting in the collected template image with extreme brightness contrast of "target dark and background bright", which seriously restricts the precision and stability of intelligent identification, and becomes a prominent technical pain point of the industry intelligent upgrading.

[0003] The superposition of the material characteristics of the wood template itself (complex surface texture, uneven color) and the workshop working conditions (dust floating, variable lighting angle) makes the influence of backlight problem more significant:

[0004] Edge feature weakening and fracture: the key edges of the wood template (such as cutting edges, splicing joints, and mortise and tenon structure edges) are the core basis for size measurement and structural integrity judgment. Under the backlight environment, the edge area of the template presents low brightness due to insufficient lighting, and the gray scale gradient with the background high light area is greatly reduced, resulting in edge blur, contrast loss, and even edge fracture. For example, the cutting edge of the template under backlight scene may be integrated with the background high light area, and traditional edge detection algorithms (such as Canny) cannot effectively distinguish, directly causing the size measurement error to exceed ±2mm, which cannot meet the requirements of template precision (usually ≤1mm) for building construction.

[0005] Texture interference and misidentification: the natural texture (such as growth rings, knots) on the surface of the wood template is easily confused with real defects (such as fine cracks) under backlight conditions. The brightness unevenness caused by backlight will amplify the gray scale fluctuation of the texture, causing the intelligent identification model to misidentify normal texture as defects, or miss the real cracks hidden by shadows, resulting in high false detection rate and missed detection rate (more than 30% in some scenes).

[0006] Insufficient adaptability under complex working conditions: the dynamic lighting changes in the workshop (such as the fluctuation of natural light intensity caused by sunrise and sunset, the movement of equipment blocking light source) make the backlight degree random, and the traditional fixed parameter image processing methods (such as global threshold segmentation, general contrast enhancement) cannot dynamically adapt to diversified scenes such as "local backlight", "side backlight", and "high light reflection", resulting in inconsistent edge enhancement effect, which is difficult to meet the stability requirements of industrial production.

[0007] Therefore, aiming at the backlight characteristics of the wood template processing scene, a technical method is developed by integrating intelligent recognition of the backlight area, accurate enhancement of the edge features, and dynamic adaptation of the processing scene, so as to realize the clearness and structuring of the template edge under complex illumination, which is of great significance to improve the precision, efficiency and stability of the intelligent recognition production of the wood template. SUMMARY

[0008] The application provides a backlight effect image edge enhancement method based on intelligent recognition, which solves the above problems.

[0009] The application is implemented by the following technical solutions:

[0010] A backlight effect image edge enhancement method based on intelligent recognition, comprising:

[0011] An original image of a wood template processing site is acquired by a multispectral image acquisition device, and environmental parameters of the processing site are also acquired, and the brightness features and dust haze features are counted based on the original image and the environmental parameters to determine the type of the site environment;

[0012] The original image is globally optimized based on a set environment perception type enhancement mechanism according to the determined type of the site environment, and a globally preprocessed image is output;

[0013] A backlight area segmentation model is constructed for the globally preprocessed image, the texture features and illumination features of the wood template in the globally preprocessed image are extracted, and a pixel-level mask of the backlight area in the globally preprocessed image is output; then the pixel-level mask of the located backlight area is enhanced in edge continuity by using an adaptive anisotropic diffusion filter, the diffusion coefficient is dynamically adjusted according to the texture direction of the wood template, the diffusion perpendicular to the edge direction is suppressed, the information parallel to the edge direction is retained, and a locally enhanced image is output;

[0014] A structure perception type local adaptive threshold algorithm is designed for the locally enhanced image, the local threshold range is dynamically adjusted in combination with the gradient direction and edge density information; a lightweight U-Net network is embedded to strengthen the structure of the image texture, and a binarized image maintaining structure continuity is output;

[0015] An edge map of the binarized image is extracted by an edge detection algorithm, a contour in the binarized image is extracted based on a graph convolution network, the edge map is represented as a graph structure node, and the topology structure of the contour in the binarized image is optimized by a “continuity constraint + curvature constraint + closedness judgment” loss function; then the geometric features of the contour are extracted and compared with a wood template processing standard feature library, an edge quality evaluation result is output and fed back to a processing control system.

[0016] As optimization, the objects of the original image include a wood template and a processing site area of the wood template, the environmental parameters include illumination intensity, dust concentration, temperature and humidity, and the specific process for determining the site environment type is that: brightness features and dust haze features are counted through the original image and the environmental parameters.

[0017] The brightness features of the original image are extracted, and the brightness features include brightness distribution features and highlight / shadow features.

[0018] The dust haze features of the original image are extracted, and the dust haze features include definition and contrast features, grain noise features and color offset features.

[0019] The collected environmental parameters are compared with preset threshold values, and the environment type is preliminarily screened to obtain a preliminary screening result, and the preliminary screening result includes a low-light environment type, a high-dust environment type, a backlight environment type or a candidate identifier of no special environment.

[0020] Based on the preliminary screening result, the original image and the environmental parameters are fused through a set rule engine to determine the site environment type.

[0021] If the preliminary screening result is a low-light environment candidate identifier, the rule engine calls a low-light feature set to verify whether the low-light environment determination condition is met, and if the low-light environment determination condition is not met, it is determined whether the high-dust environment determination condition, the backlight environment determination condition or the normal environment is met.

[0022] If the preliminary screening result is a high-dust environment candidate identifier, the rule engine calls a high-dust feature set to verify whether the high-dust environment determination condition is met, and if the low-light environment determination condition is not met, it is determined whether the low-light environment determination condition, the backlight environment determination condition or the normal environment is met.

[0023] If the preliminary screening result is a backlight environment candidate identifier, the rule engine calls a backlight feature set to verify whether the backlight environment determination condition is met, and if the low-light environment determination condition is not met, it is determined whether the low-light environment determination condition, the high-dust environment determination condition or the normal environment is met.

[0024] If the preliminary screening result is a candidate identifier of no special environment, it is determined as a normal environment.

[0025] If the preliminary screening result simultaneously contains at least two of the low-light environment candidate identifier, the high-dust environment candidate identifier and the backlight environment candidate identifier, then the rule engine calls the corresponding feature set in the order of high-dust environment, backlight environment and low-light environment from high to low for determination.

[0026] As optimization, the low-light feature set comprises a global average brightness, an illumination intensity, and a dust feature check parameter, and the low-light environment determination condition is: global average brightness < threshold value D + illumination intensity < threshold value E + no significant dust feature;

[0027] The high-dust feature set comprises a gradient energy of the original image, a dust concentration, and a high-frequency noise density, and the high-dust environment determination condition is: gradient energy of the original image < threshold value A + dust concentration > threshold value B + high-frequency noise density > threshold value C;

[0028] The backlight feature set comprises a skewness coefficient and an average brightness of an image brightness histogram, and the backlight environment determination condition is: skewness coefficient of the image brightness histogram > threshold value F and average brightness < threshold value G.

[0029] As optimization, the environment-aware enhancement mechanism specifically comprises:

[0030] If the on-site environment type is a low-light environment: performing CLAHE enhancement on a low-light region contrast of the original image, dynamically adjusting a tile grid size and a clipLimit parameter, and combining a guided filter denoising operation to obtain a global preprocessed image;

[0031] If the on-site environment type is a high-dust environment: calling a high-dust enhancement strategy on the original image, performing a DehazeNet defogging model based on industrial dust scene training combined with a bilateral filter denoising operation to obtain a global preprocessed image;

[0032] If it is a backlight environment: calling a backlight enhancement strategy on the original image, performing a multi-scale Retinex enhancement combined with a highlight suppression operation to obtain a global preprocessed image;

[0033] If it is a normal environment: calling a general enhancement strategy on the original image, performing adaptive histogram equalization combined with NLM denoising operation to obtain a global preprocessed image.

[0034] As optimization, the specific process of performing CLAHE enhancement combined with a guided filter denoising operation on the original image to obtain a global preprocessed image is as follows:

[0035] A1, converting the original image from an RGB color space to a YCrCb color space, extracting a brightness channel and a chroma channel, wherein the brightness channel comprises a Y channel, which is used for subsequent enhancement processing, and the chroma channel comprises a Cr channel and a Cb channel, which are used for retaining original color information;

[0036] A2, low-light region feature quantitative analysis:

[0037] Performing feature analysis on the brightness channel to obtain the following quantitative indicators:

[0038] A2.1, Low-light area proportion : The low-light area is segmented by the set brightness threshold, and the ratio of the number of low-light area pixels to the total number of original image pixels is calculated;

[0039] A2.2, Detail density : Canny edge detection is performed on the low-light area, and the ratio of the number of edge pixels to the number of low-light area pixels is calculated;

[0040] A2.3, High-frequency noise density : Fourier transform is performed on the low-light area, and the proportion of high-frequency component energy with frequency>1 / 4 of the image width is calculated;

[0041] A3, Dynamic adjustment of CLAHE parameters:

[0042] According to the quantitative indicators of step A2, the key parameters of contrast limited adaptive histogram equalization (CLAHE) are dynamically adjusted:

[0043] A3.1, tile network size adjustment:

[0044] If , it means that the low-light area is rich in details, and the grid size is set to 6x6;

[0045] If , it means that the low-light area is medium in detail, and the grid size is set to 8x8;

[0046] If or , it means that the low-light area is sparse in detail or is a high-noise area, and the grid size is set to 10x10;

[0047] A3.2, clipLimit parameter adjustment:

[0048] If , it means that the low-light area is severely low-light, and the contrast limit threshold clipLimit=2-3 is set;

[0049] If , it means that the low-light area is moderately low-light, and the contrast limit threshold clipLimit=4-5 is set;

[0050] If , it means that the low-light area is slightly low-light, and the contrast limit threshold clipLimit=6-7 is set;

[0051] A4, CLAHE enhancement processing:

[0052] Based on the parameters adjusted in step A3, the brightness channel is enhanced, which specifically includes:

[0053] A4.1, sub-block division: divide the luminance channel into non-overlapping sub-blocks uniformly according to the adjusted tile network size;

[0054] A4.2, contrast restriction: apply the contrast restriction threshold clipLimit determined in step A3.2 to the gray level histogram of each sub-block, clip the gray level frequency exceeding the threshold and average distribute to other gray levels, to obtain the clipped histogram;

[0055] A4.3, equalization and splicing: perform equalization on the clipped histogram, splice the sub-block results by bilinear interpolation, eliminate the edge transition traces, and output the CLAHE enhanced luminance channel image ;

[0056] A5, guided filter denoising processing:

[0057] Based on the original luminance channel, the luminance channel image is denoised, specifically including:

[0058] A5.1, filter parameter configuration: set the filter window radius to 5 pixels, and the regularization parameter , corresponding to the regularization coefficient ;

[0059] A5.2, local linear fitting: taking the original luminance channel as the guide image G, and the luminance channel image as the image to be denoised I, the linear model parameters (a, b) , ) are solved by minimizing the error function in each 5x5 pixel window, and the error function is: ; wherein I is the image to be denoised, i.e. the luminance channel after CLAHE enhancement , is the linear coefficient in the pixel window k, and is the offset in the pixel window k;

[0060] A5.3, pixel value fusion: for each pixel, the mean value of the linear model parameters (a, b) , ) of the window where the pixel is located is calculated by bilinear interpolation, and the denoised luminance channel is output based on the mean value;

[0061] A5.4, image reconstruction output: combine the denoised luminance channel with the chrominance channel extracted in A1, convert back to the RGB color space, and obtain the global pre-processed image in low light environment;

[0062] A high-dust enhancement strategy is called for the original image, and a specific process of obtaining a global preprocessed image by combining a DehazeNet defogging model trained based on an industrial dust scene with a bilateral filter denoising operation is as follows:

[0063] B1. DehazeNet defogging processing:

[0064] B1.1. Model loading: a pre-trained DehazeNet defogging model is loaded, the DehazeNet defogging model being trained based on industrial dust scene data, wherein the DehazeNet defogging model is an image, and an output of the DehazeNet defogging model is a transmittance;

[0065] B1.2. Transmittance prediction: the original image is input into the DehazeNet defogging model, and a predicted transmittance map t(x) is output;

[0066] B1.3. Image restoration: a haze-free image is restored based on an atmospheric scattering model J(x) = (I(x) - A) / t(x) + A, wherein A is a global atmospheric light intensity, which is estimated by an average value of a 0.1% region in front of an image brightness, I(x) is a pixel value of the original image at a pixel point x, J(x) is a pixel value of the haze-free / dust-free image to be restored at the pixel point x, and t(x) is the transmittance, wherein t(x) = 1 indicates complete non-scattering, and light has no attenuation, , is an atmospheric scattering coefficient, and d(x) represents an actual distance of a pixel point x to an object;

[0067] B2. Bilateral filter denoising processing:

[0068] B2.1. Parameter configuration: a spatial domain standard deviation sigma_space = 15 and a value domain standard deviation sigma_color = 30 are set;

[0069] B2.2. Weight calculation: for each pixel p, a spatial domain weight and a value domain weight are calculated in a 15x15 neighborhood;

[0070] B2.3. Weighted filtering: an output pixel value after denoising is , wherein N(p) is a 15x15 neighborhood of the pixel p, and W(p) is a normalization coefficient;

[0071] B3. Output of a global preprocessed image: the defogging and denoising image is output as a final enhancement result, and the final enhancement result is the global preprocessed image;

[0072] A backlight enhancement strategy is called on the original image, and a specific process for obtaining a global preprocessed image by performing multi-scale Retinex enhancement combined with highlight suppression operation is as follows:

[0073] C1, multi-scale Retinex enhancement:

[0074] C1.1, scale decomposition: the luminance channel of the original image is respectively convolved with three different standard deviation Gaussian kernels to generate low, medium and high scale blurred images, wherein the standard deviation of the Gaussian kernel is , , ;

[0075] C1.2, detail extraction: the detail layer of each scale is calculated by the formula , wherein represents the Retinex detail layer of the i-th scale, is the original luminance channel, x and y are the coordinates of the pixel, is the blurred image corresponding to the scale, i=1,2,3, respectively corresponding to the Gaussian blur of different scales, i=1 corresponds to , i=2 corresponds to , and i=3 corresponds to ;

[0076] C1.3, weight fusion: the detail layers of the three scales are weighted and summed according to the weight , wherein , to generate the enhanced luminance channel ;

[0077] C2, highlight suppression processing:

[0078] C2.1, highlight region positioning: the pixels with a gray value >220 in the luminance channel are marked as highlight regions;

[0079] C2.2, luminance attenuation: the nonlinear attenuation is performed on the pixels in the highlight region, wherein is the attenuation coefficient, , and decreases with the increase of the pixel luminance;

[0080] C3, color recovery and image reconstruction:

[0081] C3.1, color compensation: the color recovery factor is calculated by the formula , wherein is the original RGB image, is the color recovery factor of the pixel at coordinates (x, y);

[0082] C3.2, reconstruction output: the adjusted luminance channel multiplying with the color restoration factor, and merging with the original chroma channel to convert back to RGB color space to obtain the global pre-processed image under the backlight environment;

[0083] The specific process of calling the general enhancement strategy on the original image to perform adaptive histogram equalization combined with NLM denoising operation to obtain the global pre-processed image is as follows:

[0084] D1, adaptive histogram equalization AHE processing:

[0085] D1.1, parameter configuration: setting the contrast limit threshold clipLimit=2, and dividing the image brightness channel into 8*8 sub-blocks;

[0086] D1.2, sub-block equalization: for the gray scale histogram of each sub-block, the gray scale level whose frequency exceeds clipLimit*(sub-block pixel number / 256) is clipped, and the frequency after clipping is evenly distributed to other gray scale levels, and histogram equalization is performed;

[0087] D1.3. fusion output: the sub-block equalization results are spliced by bilinear interpolation to generate the adaptive histogram equalized brightness channel image to improve the global contrast;

[0088] D2, NLM denoising processing:

[0089] D2.1, parameter configuration: setting the denoising strength parameter h=3, and defining the search window as 7*7 pixels and the similarity window as 5*5 pixels;

[0090] D2.2, similarity calculation: for each pixel in the brightness channel image , the gray scale similarity weight with other pixels in the search window is calculated , the formula is: wherein p and q are two pixels to be compared, is the gray scale vector of the similarity window in which pixel p is located, taking the gray scale values of the 5*5 window around pixel p, represents the square of the Euclidean norm;

[0091] D2.3, weighted denoising: the pixel value after denoising is calculated by the formula to obtain the denoised brightness channel to suppress small noise under normal environment, wherein is the gray scale value of pixel p in the denoised brightness channel, i.e. the gray scale value of pixel p in the global pre-processed image, represents the search window centered on p, represents the original gray scale value of pixel q in the brightness channel before denoising.

[0092] As optimization, a backlight area segmentation model is constructed for the global preprocessed image, texture features and illumination features of the wood template in the global preprocessed image are extracted, and a pixel-level mask of the backlight area in the global preprocessed image is output; then, the pixel-level mask of the located backlight area is subjected to adaptive anisotropic diffusion filtering to enhance edge continuity, the diffusion coefficient is dynamically adjusted according to the texture direction of the wood template, diffusion perpendicular to the edge direction is inhibited, information parallel to the edge direction is reserved, and the specific process of outputting a local enhanced image is as follows:

[0093] E1, backlight area segmentation model construction:

[0094] E1.1, feature extraction: texture features and illumination features of the wood template are extracted from the global preprocessed image, specifically including:

[0095] texture features are obtained by calculating local binary pattern (LBP) and contrast and entropy of a gray level co-occurrence matrix (GLCM) of the global preprocessed image;

[0096] illumination features are obtained by extracting an amplitude of a brightness gradient and a skewness coefficient of a local brightness distribution of the global preprocessed image;

[0097] E1.2, feature fusion and classification: the extracted texture features and illumination features are input into a random forest classifier, and a backlight area segmentation model is trained;

[0098] E1.3, pixel-level mask generation: the trained backlight area segmentation model is applied to classify the global preprocessed image pixel by pixel, and an initial backlight area pixel-level mask is output wherein, represents a backlight area pixel, represents a non-backlight area pixel;

[0099] E2, mask post-processing: dilation and corrosion operations are performed on the initial pixel-level mask, isolated noise areas are removed, continuous backlight areas are retained, and a final backlight area pixel-level mask M(x, y) is obtained;

[0100] E3, adaptive anisotropic diffusion filtering:

[0101] E3.1, edge direction estimation: the local gradient direction of the located backlight area pixel-level mask M(x, y) is calculated wherein, I is a brightness channel of the global preprocessed image;

[0102] E3.2, dynamic adjustment of diffusion coefficient: the diffusion coefficient is dynamically adjusted according to the texture direction of the wood template, and a diffusion tensor is constructed: wherein, , , , , a parameter for controlling the degree of anisotropy, K is a gradient threshold value, is a gradient operator,

[0103] E3.3, diffusion filtering iteration: iteratively update the image by the following partial differential equation where t is the iteration time step, is a divergence operator, suppresses diffusion perpendicular to the edge direction, preserves information parallel to the edge direction, and obtains a filtered backlight area;

[0104] E4, local enhancement image generation: fuse the filtered backlight area and the non-backlight area to output a local enhancement image.

[0105] As an optimization, a structure-aware local adaptive threshold algorithm is designed for the local enhancement image, which dynamically adjusts the local threshold range in combination with the gradient direction and edge density information. The specific process of embedding a lightweight U-Net network to structure the texture of the image and output a binary image that maintains structure continuity is as follows:

[0106] For the local enhancement image, a Sobel operator or similar gradient calculation operator is used to calculate the gradient of the image in the horizontal and vertical directions, respectively, and then the gradient amplitude and gradient direction of each pixel point are obtained

[0107] Edge detection is performed on the local enhancement image to obtain an edge map of the local enhancement image. Then, the number of edge pixels in the edge map is counted and compared with the total number of pixels in the local enhancement image, thereby obtaining edge density information.

[0108] According to the calculated gradient direction and edge density information, a local threshold adjustment model is constructed, and the local threshold adjustment model is: where, is an initial threshold value, a and b are adjustment coefficients, is the gradient amplitude of the pixel point (x, y), is the edge density of the local region where the pixel point (x, y) is located;

[0109] A lightweight U-Net network is constructed.

[0110] The image processed by the local threshold adjustment model is input into the lightweight U-Net network, and a binary image is output through the lightweight U-Net network.

[0111] As an optimization, the image processed by the local threshold adjustment model is input into the lightweight U-Net network, and a binary image is output through the lightweight U-Net network.​

[0112] The image processed by the local threshold adjustment model is input into a lightweight U-Net network;

[0113] 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.

[0114] As an optimization, an edge map of the binary image is extracted by an edge detection algorithm, a contour in the binary image is extracted based on a graph convolution network, the edge map is represented as a graph structure node, and the topology of the contour in the binary image is optimized by a "continuity constraint + curvature constraint + closedness judgment" loss function; then the geometric features of the contour are extracted and compared with a wood template processing standard feature library, and an edge quality evaluation result is output and fed back to a specific process of a processing control system:

[0115] Edge map extraction: performing a Canny edge detection algorithm on the input binary image to extract an edge map E, wherein edge pixels are marked as 1 and non-edge pixels are marked as 0;

[0116] Graph structure construction: taking the edge pixels in the edge map E as graph structure nodes , wherein N is the total number of edge pixels; defining node adjacency relationship: if nodes and are 8-neighbor connected edge pixels, then an edge connection is established to form a graph structure W=(V,E);

[0117] Graph convolution network contour extraction: constructing a graph convolution network GCN, inputting the graph structure W and node features including gradient direction and curvature, aggregating neighborhood features through 2-3 layers of graph convolution layers, outputting probability distribution of contour candidate nodes, and extracting an initial contour ;

[0118] Topology optimization: defining a "continuity constraint + curvature constraint + closedness judgment" loss function, and optimizing the parameters of the graph convolution network GCN through back propagation of the loss function, so that the graph convolution network GCN outputs an optimized contour ;

[0119] Contour geometric feature extraction: calculating a feature set F from the optimized contour , wherein the feature set F includes length features, curvature features, and closedness features;

[0120] Standard feature library comparison: constructing a wood template processing standard feature library containing the geometric feature threshold range of qualified contours; calculating a feature deviation , the quality score is obtained by weighted summation , is a feature weight;

[0121] Result output and feedback: if , it is determined that the edge quality is qualified; otherwise, the unqualified area is marked, and the unqualified area coordinates and deviation value are fed back to the processing control system for adjusting the processing parameters.

[0122] As optimization, the loss function is:

[0123] ;

[0124] , , is the weight of the corresponding loss function, is a continuity constraint loss function, is a curvature constraint loss function, is a closedness judgment loss function, and wherein, is the actual Euclidean distance between node i and node j, is the expected continuous distance, is the curvature of node i, is the local average curvature, is the edge between node i and node j, and W is the graph structure.

[0125] Compared with the prior art, the present application has the following advantages and beneficial effects:

[0126] The present application realizes the following effects through the whole process optimization of environmental precise adaptation→image enhancement→defect detection→quality closed loop:

[0127] High-quality enhancement of wood template processing images in complex environments;

[0128] Precise preservation of edge and texture details, adapting to the natural texture and processing defect features of wood templates;

[0129] Deep linkage of defect detection and processing control, from "passive detection" to "active optimization", improving production efficiency and yield. DETAILED DESCRIPTION

[0130] In order to make the purpose, technical scheme and advantages of the present application clearer and more apparent, the present application will be further described in detail below with reference to the embodiments, and the illustrative embodiments of the present application and their descriptions are only used to explain the present application, and not as a limitation of the present application.

[0131] This embodiment 1 provides a backlight effect image edge enhancement method based on intelligent identification, comprising:

[0132] S1, acquire original images of a wood mold processing site by a multi-spectrum image acquisition device, and acquire environmental parameters of the processing site, and perform statistics of image brightness features and dust haze features based on the original images and the environmental parameters to determine the type of the site environment.

[0133] The multi-spectrum image acquisition device (such as an industrial camera or a multi-spectrum camera) mainly captures the optical reflection / radiation features of a scene, including the light intensity distribution of different wavelengths, the gray / color change of the texture of an object surface, etc., which are used for subsequent visual tasks such as region segmentation and edge extraction. For example, the "brightness value" in the image can indirectly reflect the relative strength of the light, but this is the local light intensity performance in the scene (affected by the reflectivity of the object, shielding, etc.), rather than the objective and quantitative "light intensity" (such as the physical quantity in lux).

[0134] Specifically, the objects of the original images include the wood mold and the processing site area of the wood mold, and the environmental parameters include the light intensity, the dust concentration, the temperature, and the humidity.

[0135] Here, the light intensity and the dust concentration are the most important environmental parameters, and the temperature and the humidity are auxiliary environmental parameters.

[0136] The brightness information in the image is related to the light intensity, but is disturbed by the surface material of the wood mold (such as the difference in the texture reflectivity), the shooting angle, the lens exposure parameter, etc., and cannot accurately reflect the actual light intensity value. For example, the image brightness of the backlight area is low, which may be caused by insufficient light or weak reflection of the object itself, and cannot be distinguished by the image alone. The image may appear "blurred" and "fog-like attenuation", which is related to dust, but is also affected by lens contamination, air humidity, and light scattering, and cannot directly quantify the dust concentration (such as the value in ).

[0137] The reason for collecting the environmental parameters is to use the light intensity and the dust concentration as environmental perception indicators to dynamically adjust the image enhancement strategy, which requires accuracy and real-time performance of the data:

[0138] If the HDR synthesis algorithm needs to be automatically switched according to "low light", it is necessary to know whether the current environmental light intensity is lower than the threshold (such as <500 lux), rather than making a subjective judgment based on the image brightness;

[0139] If a special denoising network needs to be enabled for "high dust concentration", it is necessary to obtain the quantitative concentration value (such as >1 ) through the dust sensor, rather than relying on the qualitative analysis of the image blur degree.

[0140] Therefore, the image acquisition and the light and dust parameter acquisition are two complementary links:

[0141] The image is used to extract visual features of the wooden template (such as backlight area, edge texture);

[0142] The light intensity and dust concentration are used to provide a strategy switch supporting the "environment-aware enhancement mechanism".

[0143] Specifically, the specific process of determining the type of the on-site environment by the original image and the environmental parameters is as follows:

[0144] S1.1, extract the brightness feature of the original image, the brightness feature includes brightness distribution feature and highlight / shadow feature. The brightness distribution feature includes:

[0145] Calculate the global average brightness of the original image (if below the preset threshold, prompt low light environment);

[0146] Analyze the brightness histogram distribution of the original image (if there is obvious "double peak", that is, the high light area and the dark area are separated, prompt backlight or uneven light environment);

[0147] Extract the backlight area feature of the original image: through the brightness gradient detection (such as Sobel operator calculation of vertical brightness change), identify whether there is strong brightness mutation (backlight area typical feature) in the edge of the dark area.

[0148] Highlight / shadow feature:

[0149] Detect the proportion of the highlight area in the original image whose pixel value is close to saturation (too high prompts strong light interference, close to saturation means that the pixel value is higher than the set threshold);

[0150] Statistical analysis of the connected domain area of the shadow area (too large prompts light shielding or low light environment). According to the image type (gray scale image / color image) and scene complexity, the common determination methods can be divided into two categories: traditional algorithm based on image features and intelligent recognition based on learning, which is prior art, and will not be repeated here.

[0151] S1.2, extract the dust haze feature of the original image, the dust haze feature includes definition and contrast feature, particle noise feature and color shift feature.

[0152] Definition and contrast feature:

[0153] Calculate the image gradient energy (such as Laplacian operator response value): if the global gradient energy is lower than the threshold, prompt the image blur (may be caused by dust or fog);

[0154] Analyze the local contrast: calculate the local contrast average of the image local area through the sliding window (in high dust environment, the contrast of distant objects decreases significantly).

[0155] Granular noise features:

[0156] Extract high-frequency noise components (granular particles appear as randomly distributed high-frequency noise points in the image) using wavelet transform or Fourier transform.

[0157] Detect the density of tiny bright / dark spots in the image (visual features formed by the scattering / blocking of light by dust particles).

[0158] Color shift features:

[0159] Analyze the mean deviation of the RGB three channels: in high dust / fog environment, the image may show color shift towards gray or white (due to the scattering characteristics of dust on visible light).

[0160] S1.3, compare the collected environmental parameters with the preset threshold, preliminarily screen the environmental type, and obtain the preliminary screening result, which includes low light environment type, high dust environment type, backlight environment type or no special environment (normal environment) candidate identification.

[0161] Low light environment determination: if the ambient light intensity < 50 lux, and the image average brightness < 50 (gray value 0-255), it is determined as low light environment.

[0162] High dust environment determination: if the dust concentration > 0.1 mg / m³, and the image definition score (such as Brenner gradient value) < 60% of the preset threshold, it is determined as high dust environment.

[0163] Backlight environment determination: if the image brightness standard deviation > 80 (reflecting uneven illumination), and the backlight area ratio > 20%, combined with the light sensor detecting the angle between the light source direction and the shooting direction > 120° (indicating backlight), it is determined as backlight environment.

[0164] The backlight area here can be quickly calculated by brightness threshold pre-segmentation, the steps are as follows:

[0165] Step 1: Extract image brightness features:

[0166] Based on the gray value of the original image (or the brightness channel after RGB to gray), calculate the pixel-level brightness value (such as single-channel gray value 0-255).

[0167] Step 2: Set the backlight area brightness threshold:

[0168] By statistical analysis of the brightness distribution law under backlight environment, preset the brightness threshold of backlight area (such as gray value < 50, which can be dynamically adjusted according to the scene), and preliminarily mark the pixels with brightness lower than the threshold as "suspected backlight area".

[0169] ​Step 3: Remove noise and small area interference:

[0170] Perform morphological operations (such as erosion, dilation) on suspected backlight areas, filter isolated noise points and small area connected domains (such as areas with an area less than 0.5% of the total pixels), and obtain a preliminary backlight area mask.

[0171] Step 4: Calculate the area ratio:

[0172] Calculate the total number of backlight pixels in the pre-processed mask, and divide it by the total number of pixels in the image to obtain the preliminary backlight area ratio (such as a ratio greater than 20%).

[0173] The logic of this "pre-segmentation → environment determination → fine segmentation" process is:

[0174] Fast pre-segmentation to obtain area ratio → combined with standard deviation and light source direction determination to determine backlight environment → trigger subsequent high-precision backlight area segmentation model.

[0175] The role of pre-segmentation is "quick screening", providing quantitative basis for environment determination, although the accuracy is lower than that of the complete segmentation model, but the speed is faster, meeting the efficiency requirements of pre-determination;

[0176] If the environment is determined to be a backlight environment, the "backlight area segmentation model" in the claim is called again for fine segmentation (combined with texture features, illumination gradient, etc.), and a more accurate mask is output for subsequent enhancement processing.

[0177] That is, the backlight area ratio comes from the pre-segmentation link based on brightness threshold: by quickly extracting brightness features, setting threshold to mark suspected areas, and filtering noise to calculate area ratio. This mechanism not only avoids logical loops, but also provides key quantitative indicators for environment determination through lightweight preprocessing, and then triggers a more detailed segmentation model based on the determination result, achieving a balance between efficiency and accuracy.

[0178] S1.4, based on the preliminary screening result, through the set rule engine to fuse the original image and environmental parameters, execute the following operation to determine the type of the scene environment:

[0179] If the preliminary screening result is a low-light environment candidate identifier, the rule engine calls the low-light feature set to verify whether it meets the low-light environment determination condition, and if it does not meet the low-light environment determination condition, it determines whether it meets the high-dust environment determination condition, the backlight environment determination condition or the normal environment;

[0180] If the preliminary screening result is a high-dust environment candidate identifier, the rule engine calls the high-dust feature set to verify whether it meets the high-dust environment determination condition, and if it does not meet the low-light environment determination condition, it determines whether it meets the low-light environment determination condition, the backlight environment determination condition or the normal environment;

[0181] If the preliminary screening result is a backlight environment candidate identifier, the rule engine calls the backlight feature set to verify whether the backlight environment determination condition is met. If the low-light environment determination condition is not met, it is determined whether the low-light environment determination condition, the high-dust environment determination condition, or the normal environment is met.

[0182] If the preliminary screening result is a non-special environment candidate identifier, it is determined to be a normal environment.

[0183] There may be a situation where the preliminary screening result overlaps, that is, multiple environments are met at the same time. In order to avoid determination conflicts, the following settings are made in this embodiment: if the preliminary screening result contains at least two of the low-light environment candidate identifier, the high-dust environment candidate identifier, and the backlight environment candidate identifier at the same time, the rule engine calls the corresponding feature set in the order of high-dust environment, backlight environment, and low-light environment from high to low. That is, when the preliminary screening result meets multiple environment candidate identifiers at the same time (such as low light + high dust or low light + backlight or low light + high dust + backlight), the priority is determined according to the priority of "high-dust environment > backlight environment > low-light environment", so as to avoid determination conflicts.

[0184] In some embodiments, the low-light feature set includes global average brightness, illumination intensity, and dust feature verification parameters, and the low-light environment determination condition is: global average brightness < threshold value D + illumination intensity < threshold value E + no significant dust features;

[0185] The high-dust feature set includes gradient energy of the original image, dust concentration, and high-frequency noise density, and the high-dust environment determination condition is: gradient energy of the original image < threshold value A + dust concentration > threshold value B + high-frequency noise density > threshold value C;

[0186] The backlight feature set includes skewness coefficient and average brightness of the image brightness histogram, and the backlight environment determination condition is: skewness coefficient of the image brightness histogram > threshold value F and average brightness < threshold value G.

[0187] In some embodiments, regarding the above threshold values, the low-light environment can be set as: threshold value D = 50 (gray value), threshold value E = 500 lux (illumination intensity); the high-dust environment can be set as: threshold value A = 0.3 (gradient energy normalization value), threshold value B = 0.5 (dust concentration), and threshold value C = 0.2 (high-frequency noise density); and the backlight environment can be set as: threshold value F = 1.5 (skewness coefficient), and threshold value G = 80 (gray value).

[0188] S1.3 is a preliminary screening based on a single or a small number of feature-threshold values, and S1.4 is a precise determination based on multi-dimensional feature fusion, and the two are in a progressive relationship of "coarse screening → precise determination".

[0189] ​The initial screening is quickly completed with the least sensor parameters and image features (such as 2-3 parameters), avoiding complex calculations for all environments (for example: if S1.3 has determined "high dust", S1.4 can skip the complex feature calculation of low light and backlight, and directly focus on the accurate verification of high dust). For the "suspected environment type" screened out by S1.3, the complex logic of multi-feature fusion (such as rule engine, SVM model) is used to eliminate the misjudgment of single feature:

[0190] For example, "backlight environment", S1.3 only uses "brightness standard deviation + backlight area + light source angle" for initial screening, but may misjudge "dark area 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 "image light and dark distribution anomaly + backlight area edge feature".

[0191] Through the cooperation of S1.3 and S1.4, the balance of "efficiency (fast initial screening) → precision (multi-dimensional accurate judgment)" is achieved, which not only ensures the real-time performance of industrial scenes (initial screening reduces the amount of calculation), but also improves the judgment accuracy through composite features (to avoid the error of enhanced strategy caused by environmental interference).

[0192] S2, for the determined on-site environment type, the original image is globally optimized based on a set of environment-aware enhancement mechanisms to output a globally preprocessed image.

[0193] In some embodiments, the environment-aware enhancement mechanism is specifically:

[0194] 1. If the on-site environment type is a low-light environment: perform CLAHE enhancement on the original image to enhance the contrast of low-light areas, dynamically adjust the tile grid size and clipLimit parameters, and combine guided filtering denoising operation to obtain a globally preprocessed image.

[0195] 2. If the on-site environment type is a high-dust environment: call the high-dust enhancement strategy for the original image, execute the DehazeNet defogging model trained based on the industrial dust scene, and combine bilateral filtering denoising operation to obtain a globally preprocessed image.

[0196] 3. If it is a backlight environment: call the backlight enhancement strategy for the original image, execute multi-scale Retinex enhancement combined with highlight suppression operation to obtain a globally preprocessed image.

[0197] For example, by calculating the skewness coefficient of the image brightness histogram > 1.5 and the average brightness < 80 (gray value 0-255), it is determined that it is a backlight environment. The skewness coefficient is used to measure the asymmetry of the brightness distribution. When the skewness coefficient > 1.5, it means that the proportion of bright pixels in the image is relatively large, and the distribution is relatively uneven, and the average brightness < 80, indicating that the overall brightness is low, which meets the characteristics of less bright part in backlight area and uneven brightness. This method is mainly based on the statistical characteristics of image brightness, and the calculation is relatively simple, which can quickly determine the backlight area. It is suitable for some cases with high real-time requirements or relatively simple image scenes. For example, in industrial detection, for some production lines with relatively stable background light, this method can be used to quickly screen out areas that may have problems caused by backlight.

[0198] More specifically, for the low-light environment, the specific process of executing CLAHE enhancement combined with guided filter denoising operation on the original image to obtain the global preprocessed image is as follows:

[0199] A1, convert the original image from RGB color space to YCrCb color space, extract the brightness channel and the chrominance channel, wherein the brightness channel includes Y channel, which is used for subsequent enhancement processing, and the chrominance channel includes Cr channel and Cb channel, which is used for preserving original color information;

[0200] A2, low-light area feature quantitative analysis:

[0201] Perform feature analysis on the brightness channel to obtain the following quantitative indicators:

[0202] A2.1, low-light area ratio : The ratio of the number of low-light area pixels to the total number of pixels in the original image is calculated by setting the brightness threshold to segment the low-light area. The brightness threshold can be set to 80 gray value, and the gray value below 80 is the low-light area.

[0203] The brightness threshold (gray value < 80) is determined by the following method: the brightness distribution of the noise-free image in the low-light environment is counted, and the lower limit of the gray scale interval where the dark pixels are concentrated is set as the segmentation threshold.

[0204] A2.2, detail density : The ratio of the number of edge pixels to the number of low-light area pixels is calculated by performing Canny edge detection on the low-light area. The parameters of Canny edge detection are: high threshold = 80, low threshold = 40, which are used to preserve the effective edge features of the low-light area.

[0205] A2.3, high-frequency noise density : low light area performs Fourier transform, and statistics the proportion of energy of high frequency component greater than 1 / 4 of image width;

[0206] A3, dynamic adjustment of CLAHE parameters:

[0207] According to the quantitative index of step A2, the key parameters of contrast limited adaptive histogram equalization (CLAHE) are dynamically adjusted:

[0208] A3.1, tile network size adjustment:

[0209] If , it indicates that the low light area is rich in details, and the grid size is set to 6x6;

[0210] If , it indicates that the low light area is medium in detail, and the grid size is set to 8x8;

[0211] If or , it indicates that the low light area is sparse in details or is a high noise area, and the grid size is set to 10x10;

[0212] A3.2, clipLimit parameter adjustment:

[0213] If , it indicates that the low light area is severe low light, and the contrast limit threshold clipLimit is set to 2-3;

[0214] If , it indicates that the low light area is moderate low light, and the contrast limit threshold clipLimit is set to 4-5;

[0215] If , it indicates that the low light area is mild low light, and the contrast limit threshold clipLimit is set to 6-7;

[0216] A4, CLAHE enhancement processing:

[0217] Based on the parameters adjusted in step A3, the luminance channel is enhanced, which specifically includes:

[0218] A4.1, sub-block division: the luminance channel is uniformly divided into non-overlapping sub-blocks according to the adjusted tile network size;

[0219] A4.2, contrast limitation: the contrast limit threshold clipLimit determined in step A3.2 is applied to the gray scale histogram of each sub-block, the gray scale frequency exceeding the threshold is clipped and evenly distributed to other gray scales, and a clipped histogram is obtained;

[0220] 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.

[0221] 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. ;

[0222] A5. Guided filtering noise reduction processing:

[0223] Based on the original luminance channel, the luminance channel image Denoising is performed, specifically including:

[0224] A5.1 Filter Parameter Configuration: Set the filter window radius to 5 pixels, and the regularization parameter... , corresponding regularization coefficient ;

[0225] 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;

[0226] , cov is the covariance, var is the variance, and mean is the mean, all calculated based on a 5×5 window.

[0227] 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. ;

[0228] 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.

[0229] The present application protects the technical scheme of "self-adaptive optimization of CLAHE parameters for low-light environment" through the whole process of "low-light feature quantization, parameter dynamic mapping, and enhanced noise reduction cooperation". The effect of the present application is different from that of the traditional method with fixed parameters:

[0230] 1. Contrast enhancement effect:

[0231] Traditional fixed parameter method: It is difficult to meet the needs of different low-light scenes with fixed tile grid size and clipLimit parameter. For example, in a scene with extremely low light and rich details, a fixed large tile grid may result in insufficient local contrast enhancement, and the details in the dark area cannot be effectively highlighted. However, a fixed small clipLimit may limit the overall contrast enhancement, and the image still appears dark.

[0232] Adaptive optimization of CLAHE parameters: Through low-light feature quantization, the parameters can be dynamically adjusted according to the low-light area ratio, detail density, etc. In a scene with a large low-light area ratio, clipLimit is appropriately reduced to avoid overexposure in the dark part while enhancing the contrast. For a low-light scene with rich details, a small tile grid is used to enhance the contrast of each small area, thereby more finely enhancing the overall contrast of the image and making the dark details more clearly displayed.

[0233] 2. Detail preservation:

[0234] Traditional fixed parameter method: The fixed parameter setting cannot adapt to the details of different images. For images with rich details in low-light environment, such as small textures on wooden templates and fine structures of circuit components, a fixed large tile grid will blur these details when enhancing the contrast. However, a fixed high clipLimit may excessively enhance the noise, covering the true detail information.

[0235] Adaptive optimization of CLAHE parameters: The tile grid size is dynamically adjusted according to the detail density. When the image details are rich, a smaller tile grid is automatically used to enhance the contrast of each small area, thereby preserving the details to the greatest extent. At the same time, clipLimit is adjusted according to the noise level to effectively suppress the interference of noise on details while enhancing the contrast.

[0236] 3. Noise suppression:

[0237] Traditional fixed parameter method: The fixed clipLimit parameter does not consider the noise level, which may amplify the noise while enhancing the contrast. For example, in an industrial environment image with low light and high noise, a high clipLimit will enhance the contrast of the noise, resulting in obvious graininess or artifacts in the image, which affects the image quality and subsequent analysis.

[0238] Adaptive optimization of CLAHE parameters: through noise level evaluation, in the case of high noise, automatically reduce the clipLimit parameter, reduce the amplification effect of noise in the contrast enhancement process; at the same time, when dynamically adjusting the tile grid size, a larger tile grid is used for high noise scenes to reduce the impact of noise on local enhancement. In addition, the subsequent guided filter denoising processing can also cooperate with the adaptive CLAHE enhancement to further suppress noise and output cleaner images.

[0239] 4. Scene adaptability:

[0240] Traditional fixed parameter method: fixed parameters are only suitable for part of the low light scene, and have poor adaptability to complex and variable low light environment. For example, in different industrial workshop low light environments, some workshops have low light areas concentrated in local, and some workshops have overall dim light with different degrees of noise, and fixed parameters cannot effectively handle these differences.

[0241] Adaptive optimization of CLAHE parameters: comprehensively considers various low light features such as low light area proportion, detail density, noise level, etc., and can dynamically adjust parameters according to different low light environments. Whether it is local low light or overall low light scene, whether it is low noise or high noise low light environment, CLAHE parameters can be adaptively optimized, and work cooperatively with guided filter denoising, so that better image enhancement effect can be achieved in various low light environments.

[0242] 5. Overall image quality and application effect:

[0243] Traditional fixed parameter method: due to the inability to optimize parameters according to the actual situation of the image, the enhanced image may have problems such as overexposure, underexposure, detail loss, noise amplification, etc., which affects the subsequent image analysis and recognition tasks, such as may cause defects in industrial detection. Missing or false detection.

[0244] Adaptive optimization of CLAHE parameters: through adaptive optimization and collaborative processing of the whole process, the overall quality of the image in the low light environment can be significantly improved, and the contrast of the enhanced image is moderate, the details are clear, and the noise is effectively suppressed, providing more reliable image data for subsequent industrial detection, image recognition and other tasks, and improving the accuracy and efficiency of the task.

[0245] More specifically, for the high dust environment type of the on-site environment, a high dust enhancement strategy is called for the original image, and the specific process of executing the DehazeNet defogging model combined with bilateral filter denoising operation based on the industrial dust scene training to obtain the global preprocessed image is as follows:

[0246] B1, DehazeNet defogging processing:

[0247] B1.1, Model loading: load a pre-trained DehazeNet defogging model trained based on industrial dust scene data, wherein the DehazeNet defogging model is for an image, and an output of the DehazeNet defogging model is transmittance;

[0248] The training data of the DehazeNet model includes:

[0249] Synthetic data: images generated by an industrial scene haze-free image + an atmospheric scattering model, with a dust concentration range of 0.1-2.0 ;

[0250] Real data: haze / no-haze paired images collected synchronously in an industrial site, obtained by simultaneously shooting a clean lens and a contaminated lens.

[0251] B1.2, Transmittance prediction: input the original image into the DehazeNet defogging model to output a predicted transmittance map t(x); the transmittance map t(x) has a value range of [0.1, 1], and threshold clipping is performed on the network output value (values less than 0.1 are set to 0.1) to avoid over-enhancement.

[0252] B1.3, Image restoration: restore a haze-free image based on an atmospheric scattering model J(x) = (I(x)-A) / t(x)+A, wherein A is a global atmospheric light intensity estimated by an average value of a 0.1% region at the front of the image brightness, I(x) is a pixel value of the original image at a pixel point x, J(x) is a pixel value of the haze-free / dust-free image to be restored at the pixel point x, and t(x) is transmittance, wherein t(x) = 1 indicates complete non-scattering and no attenuation of light, , is an atmospheric scattering coefficient, and d(x) represents an actual distance of the pixel point x to an object;

[0253] B2, Bilateral filtering denoising processing:

[0254] B2.1, Parameter configuration: set a spatial domain standard deviation sigma_space = 15 and a value domain standard deviation sigma_color = 30;

[0255] B2.2, Weight calculation: for each pixel p, calculate a spatial domain weight and a value domain weight ;

[0256] The calculation of the spatial domain weight and the value domain weight adopts a parallel optimization algorithm and is realized by GPU acceleration:

[0257] The image is divided into 16x16 pixel thread blocks;

[0258] Each thread calculates the weight of the corresponding pixel and writes it to shared memory;

[0259] Parallel accumulation of neighborhood pixels is achieved through atomic operations.

[0260] B2.3, weighted filtering: output denoised pixel value , where N(p) is the 15x15 neighborhood of pixel p, and W(p) is the normalized coefficient;

[0261] B3, output global preprocessed image: output the image after dehazing and denoising as the final enhancement result, which is the global preprocessed image.

[0262] B4, enhancement effect evaluation, by calculating the clarity score (such as Tenengrad gradient value) of the enhanced image and comparing it with the preset threshold, if it is lower than the threshold, trigger secondary enhancement.

[0263] The object model used in the present application is obtained by special training for industrial dust scene, forming a complete chain from environment judgment to dehazing, denoising and evaluation, compared with the prior art, the effect is:

[0264] More accurate enhancement: the prior art may lack the environment judgment link, directly using general dehazing and denoising algorithms, which cannot solve the problem of images in different environments. In the present application, through environment judgment, it is clear that it is a high dust environment, and DehazeNet dehazing based on industrial dust scene training is used, compared with general dehazing algorithm, it can more accurately remove the blur caused by dust and restore the image details; to the greatest extent, the image details are preserved, thereby improving the overall clarity and quality of the image.

[0265] More specifically, for the on-site environment type is backlight environment, the backlight enhancement strategy is called for the original image, and the specific process of obtaining the global preprocessed image by executing multi-scale Retinex enhancement combined with highlight suppression operation is as follows:

[0266] C1, multi-scale Retinex enhancement:

[0267] C1.1, scale decomposition: convolve the brightness channel of the original image with three different standard deviation Gaussian kernels respectively, to generate low, medium and high scale blurred images, wherein the standard deviation of the Gaussian kernel is , , ;

[0268] C1.2, detail extraction: calculate the detail layer of each scale by the formula , wherein Retinex detail layer of the i-th scale, is the original luminance channel, x, y are the coordinates of the pixel, is the blurred image corresponding to the i-th scale, i = 1, 2, 3, corresponding to Gaussian blur of different scales respectively, i = 1 corresponds to , i = 2 corresponds to , i = 3 corresponds to ;

[0269] C1.3, weight fusion: the detail layers of the three scales are weighted sum, where, , to generate the enhanced luminance channel ;

[0270] C2, highlight suppression processing:

[0271] C2.1, highlight region positioning: mark the pixels with gray value > 220 in the luminance channel as the highlight region;

[0272] C2.2, luminance attenuation: perform nonlinear attenuation on the pixels in the highlight region, where, is the attenuation coefficient, , and decreases with the increase of the pixel luminance;

[0273] C3, color restoration and image reconstruction:

[0274] C3.1, color compensation: calculate the color restoration factor by the formula , where is the original RGB image, is the color restoration factor of the pixel at coordinates (x, y);

[0275] C3.2, reconstruction output: multiply the adjusted luminance channel with the color restoration factor, and then combine it with the original chroma channel to convert back to the RGB color space, to obtain the global preprocessed image in the backlight environment.

[0276] The above process realizes breakthroughs in detail preservation, highlight suppression, color restoration, etc. through the complete process of "environment determination → multi-scale enhancement → highlight suppression → color restoration", which is specific to:

[0277] 1. Dark detail enhancement (role of multi-scale Retinex):

[0278] Pain point: backlight causes the dark part of the image (such as the shadow area of the wooden template) to be too dark, and the details such as texture and scratches are submerged.

[0279] Effect:

[0280] Multi-scale Gaussian blur (σ=15 / 25 / 30) extracts full-scale details: small-scale (σ=15) retains fine textures such as wood grain and scratches; large-scale (σ=30) retains device outlines and background structures.

[0281] Weight fusion balances details and outlines: enhanced dark details improve 30%-50% recognition (e.g., scratches in the shadow area of the wood template change from invisible to clear).

[0282] 2. High light suppression (role of brightness attenuation):

[0283] Pain point: In a backlit environment, metal and smooth surfaces are prone to high light overexposure (e.g., device reflections, painted areas of wood templates), resulting in local over-brightness and loss of details.

[0284] Effect:

[0285] High light area positioning (gray scale >220) accurately identifies overexposed areas;

[0286] Non-linear attenuation and brightness increase) suppress overexposure: high light area brightness is reduced by 20%-30%, while retaining edge details (e.g., the outline of the device reflection area is no longer blurred).

[0287] 3. Color restoration (role of color compensation):

[0288] Pain point: Backlight causes overall image color distortion (e.g., dark areas are cold, and high light areas are warm), and traditional enhancement can exacerbate color distortion.

[0289] Effect:

[0290] Color recovery factor corrects color deviation;

[0291] After reconstruction, the color error (ΔE) of the image is reduced by 15%-25%, closer to the real scene (e.g., the natural texture color of the wood template is no longer yellow or blue).

[0292] More specifically, for a normal environment, the general enhancement strategy is called for the original image, and the specific process of obtaining the global preprocessed image by performing adaptive histogram equalization combined with NLM denoising operation is as follows:

[0293] D1, adaptive histogram equalization AHE processing:

[0294] D1.1, parameter configuration: set the contrast limit threshold clipLimit=2, and divide the image brightness channel into 8x8 sub-blocks;

[0295] D1.2, sub-block equalization: for the gray scale histogram of each sub-block, clip the gray scale whose frequency exceeds clipLimit×(sub-block pixel number / 256), and evenly distribute the clipped frequency to other gray scales to perform histogram equalization;

[0296] D1.3. Fusion output: splice the sub-block equalization results by bilinear interpolation to generate the luminance channel image after adaptive histogram equalization to improve the global contrast;

[0297] D2, NLM denoising (non-local mean denoising) processing:

[0298] D2.1, parameter configuration: set the denoising strength parameter h = 3, and define the search window as 7x7 pixels and the similarity window as 5x5 pixels;

[0299] D2.2, similarity calculation: for each pixel in the luminance channel image , calculate the gray similarity weight with other pixels in the search window , the formula is: where p and q are two pixels to be compared, is the gray vector of the similarity window of pixel p, taking the gray values of the 5*5 window around pixel p, represents the square of the Euclidean norm;

[0300] D2.3, weighted denoising: calculate the pixel value after denoising by the formula to suppress small noise in normal environment, where is the gray value of pixel p in the denoised luminance channel, i.e. the gray value of pixel p in the global pre-processing image, represents the search window centered at p, represents the original gray value of pixel q in the luminance channel before denoising.

[0301] By the four-dimensional index of "luminance, illumination, dust, noise" (such as luminance 80-220, illumination 100-800 lux), the boundary of "normal environment" is clear, which is different from low light, high dust and other special scenes.

[0302] Here, the global pre-processing image obtained is a color image.

[0303] S3, construct a backlight area segmentation model, the input of the backlight area segmentation model is the texture feature and illumination feature of the wood template in the global pre-processing image, and the output of the backlight area segmentation model is a pixel-level mask of the backlight area; then, the located pixel-level mask of the backlight area is enhanced by adaptive anisotropic diffusion filtering to enhance edge continuity, the diffusion coefficient is dynamically adjusted according to the texture direction of the wood template, the diffusion perpendicular to the edge direction is suppressed, the information parallel to the edge direction is preserved, and a locally enhanced image is output.

[0304] The specific process is as follows:

[0305] E1, backlight region segmentation model construction:

[0306] E1.1, feature extraction: extract the texture features and illumination features of the wood template from the global preprocessed image, specifically including:

[0307] E1.1.1, obtain texture features by calculating the local binary pattern (LBP) and the contrast and entropy of the gray level co-occurrence matrix (GLCM) of the global preprocessed image.

[0308] By calculating the local binary pattern (LBP) and the contrast and entropy of the gray level co-occurrence matrix (GLCM), the texture features of the image can be effectively extracted. Texture features are essentially the spatial distribution of gray values in the image (such as roughness, density, directionality, etc.), and LBP and GLCM are two classic texture description methods that achieve feature extraction by quantifying these rules:

[0309] 1) Local binary pattern (LBP):

[0310] Principle: By comparing the gray value difference between a pixel and its neighborhood pixels, a binary code is generated, and the histogram distribution of the code is counted as a texture feature. For example, for a 3x3 neighborhood, compare the center pixel gray value with the surrounding 8 pixels, and if it is greater than the center value, mark it as 1, otherwise as 0, forming an 8-bit binary number (such as "10110011"), and finally reflecting the roughness or uniformity of local texture through the histogram.

[0311] Effect: sensitive to local micro-texture changes, can effectively describe the "graininess" of the texture (such as the density of the wood grain of the wood template).

[0312] 2) Gray level co-occurrence matrix (GLCM):

[0313] Principle: Statistics of the probability distribution of two pixel gray value combinations in the image with distance d and direction (such as 0°, 45°, 90°, 135°), and then calculate the contrast and entropy of the matrix:

[0314] Contrast: reflects the clarity and depth difference of the texture (the greater the value, the clearer the texture, such as the more obvious the light and dark boundary of the wood grain);

[0315] Entropy: reflects the complexity of the texture (the greater the value, the more irregular the texture, such as the scar area of the wood template).

[0316] Effect: describes the macroscopic law of texture from a global statistical perspective, complementing the local details of LBP.

[0317] The specific process of obtaining texture features is:

[0318] 1, pre-processing adaptation:

[0319] 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);

[0320] For wooden template images, the region of interest (ROI) can be cropped first to reduce background interference.

[0321] 2. Extended calculation of LBP features:

[0322] 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).

[0323] 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).

[0324] 3. Parameter design of GLCM features:

[0325] 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).

[0326] 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;

[0327] Take the mean or maximum value of GLCM features in different directions to reduce orientation sensitivity (if the texture has no significant orientation).

[0328] 4. Feature fusion:

[0329] 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).

[0330] 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.

[0331] 1. Input: Global preprocessed image (RGB color image):

[0332] Source: Globally preprocessed image enhanced and denoised by CLAHE / Retinex (low light / backlight enhancement result as described in the claim).

[0333] Preprocessing: Convert to luminance channel Y (e.g. Y channel of YCrCb space), focus on illumination feature extraction.

[0334] 2. Luminance gradient magnitude calculation:

[0335] Luminance gradient magnitude reflects the intensity of local luminance change (e.g. highlight edge, shadow boundary of wood template), calculation steps:

[0336] (1) Gradient operator:

[0337] For luminance channel Y, use Sobel operator to calculate horizontal gradient and vertical gradient :

[0338] , ;

[0339] (2) Gradient magnitude:

[0340] Gradient magnitude H(x, y) is the L2 norm of gradient vector: ;

[0341] (3) Industrial significance:

[0342] High gradient magnitude area: corresponding to highlight edge, shadow boundary, texture contour (e.g. joint seam, scratch) of wood template;

[0343] Low gradient magnitude area: corresponding to smooth illumination area (e.g. equipment surface, uniform background);

[0344] 3. Skewness coefficient calculation of local luminance distribution:

[0345] Skewness coefficient reflects the asymmetry of luminance distribution (e.g. more dark in backlit environment, more bright in highlight environment), calculation steps:

[0346] (1) Local region division:

[0347] Divide luminance channel Y into local blocks (e.g. 16x16 pixels), each block corresponds to a local region R.

[0348] (2) Skewness coefficient formula:

[0349] For local region R, skewness coefficient Skew(R) is defined as: where is the luminance mean value of region R, N is the number of pixels in the region;

[0350] (3) Industrial significance:

[0351] Skewness coefficient > 0: more bright pixels in the region (e.g. local block in highlight environment);

[0352] Skewness coefficient <0: more dark pixels in the region (e.g. local block in backlight environment);

[0353] The larger the absolute value: the more uneven the light distribution (e.g. local shadow area of wooden template skewness coefficient <-1).

[0354] The light feature is the sum of the rules of brightness distribution in the image (such as brightness mean, contrast, distribution form), and the skewness coefficient is the core index to describe the "distribution symmetry", which directly reflects whether the light is balanced. By calculating the brightness gradient amplitude (reflecting the edge) and the local skewness coefficient (reflecting the light distribution), the light features of industrial images can be accurately extracted, providing key basis for subsequent segmentation, enhancement, and defect detection.

[0355] E1.2, Feature fusion and classification: input the extracted texture features and light features into the random forest classifier to train the backlight area segmentation model;

[0356] E1.3, Pixel-level mask generation: apply the trained backlight area segmentation model to the global preprocessed image for pixel-level classification, and output the initial backlight area pixel-level mask , wherein, represents the backlight area pixel, represents the non-backlight area pixel;

[0357] E2, Mask post-processing: perform dilation and erosion operations (i.e. morphological operations) on the initial pixel-level mask to remove isolated noise regions and retain continuous backlight regions, obtaining the final backlight area pixel-level mask M(x,y);

[0358] E3, Adaptive anisotropic diffusion filtering:

[0359] E3.1, Edge direction estimation: calculate the local gradient direction for the located backlight area pixel-level mask M(x,y) , wherein I is the brightness channel of the global preprocessed image;

[0360] E3.2, Diffusion coefficient dynamic adjustment: dynamically adjust the diffusion coefficient according to the texture direction of the wooden template, and construct the diffusion tensor: , wherein, , , , , is a parameter to control the degree of anisotropy, , K is the gradient threshold, is the gradient operator, ;

[0361] E3.3, Diffusion filtering iteration: update the image by 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.

[0362] 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.

[0363] 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).

[0364] 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.

[0365] The specific process is as follows:

[0366] 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.

[0367] Using the arctangent function Calculate the gradient direction, where, These are the gradient values ​​in the horizontal and vertical directions, respectively. The gradient direction.

[0368] 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.

[0369] S4.3, constructing a local threshold adjustment model according to the calculated gradient direction and edge density information, the local threshold adjustment model being: wherein, is an initial threshold value, a and b are adjustment coefficients, is a gradient amplitude of a pixel point (x, y), is an edge density of a local region in which the pixel point (x, y) is located.

[0370] In some embodiments, a = -0.02 and b = 0.5, and the adjustment coefficients of the local threshold adjustment model are obtained by grid search optimization of 5000 labeled images.

[0371] In areas with sharp gradient changes and high edge density, the local threshold range is appropriately increased to better preserve edge and detail information; in areas with gentle gradient changes and low edge density, the local threshold range is appropriately reduced to remove noise and background interference.

[0372] S4.4, constructing a lightweight U-Net network: designing a lightweight U-Net network structure, which is composed of an encoder and a decoder. The encoder part uses convolutional layers and pooling layers for down-sampling to extract different levels of features of the image; the decoder part uses deconvolutional layers and up-sampling layers for up-sampling to fuse and restore the features extracted by the encoder. Lightweight design is introduced in the network, such as using depthwise separable convolution instead of traditional convolution, reducing network parameters and computational complexity. At the same time, skip connections are added between network layers to directly connect different levels of features in the encoder to the corresponding levels of the decoder to preserve the detail information of the image.

[0373] S4.5, inputting the image processed by the local threshold adjustment model into the lightweight U-Net network, and outputting a binary image through the lightweight U-Net network.

[0374] The specific process of S4.5 is as follows:

[0375] S4.5.1, inputting the image processed by the local threshold adjustment model into the lightweight U-Net network. The image is forward propagated in the network, sequentially passing through each layer of the encoder, and each convolutional layer extracts features of the image by convolution kernel and input image. The pooling layer down-samples the feature map after convolution to reduce the size of the feature map. In the decoder part, the deconvolutional layer up-samples the down-sampled feature map to restore the size of the feature map, and at the same time, the corresponding level of the feature map in the encoder is fused through the skip connection to enhance the texture and structure information of the image.

[0376] S4.5.2, the network last layer adopts Sigmoid activation function or other suitable binary activation function to convert the feature map output by the network into a binary image. By setting a suitable threshold, the pixel values greater than the threshold are set as foreground (for example, the value is 1), and the pixel values less than the threshold are set as background (for example, the value is 0), so as to obtain a binary image that maintains structural continuity, which is used for subsequent image analysis and processing tasks.

[0377] S5, the edge map of the binary image is extracted by an edge detection algorithm, the contours in the binary image are extracted based on a graph convolution network, the edge map is represented as a graph structure node, and the topology structure of the contours in the binary image is optimized by a "continuity constraint + curvature constraint + closedness judgment" loss function; then the geometric features of the contours are extracted and compared with a wooden template processing standard feature library, and an edge quality evaluation result is output and fed back to a processing control system.

[0378] The specific process is as follows:

[0379] S5.1, edge map extraction: performing Canny edge detection algorithm on the input binary image to extract edge map E, wherein the edge pixels are marked as 1 and the non-edge pixels are marked as 0;

[0380] S5.2, graph structure construction:

[0381] S5.2.1, the edge pixels in the edge map E are taken as graph structure nodes , wherein N is the total number of edge pixels;

[0382] S5.2.2, define node adjacency relationship: if nodes and are 8-neighbor connected edge pixels, then edge connection is established to form graph structure W=(V,E);

[0383] S5.3, graph convolution network contour extraction: constructing graph convolution network GCN (the specific structure of GCN: "2-layer graph convolution (hidden layer dimension 64→32), node features containing gradient direction (quantized to 8 dimensions), curvature (1 dimension), and coordinates (2 dimensions)), input graph structure W and node features including gradient direction and curvature, aggregate neighborhood features through 2-3 layers of graph convolution layers, output probability distribution of contour candidate nodes, and extract initial contours .

[0384] In the contour topology optimization based on graph convolution network (GCN), node features (such as gradient direction and curvature) are the core information for describing the local geometric characteristics of edge pixels, and their acquisition needs to be combined with image preprocessing and geometric calculation methods. The following is the specific extraction process and technical details:

[0385] I. Specific acquisition method of node features (gradient direction, curvature):

[0386] 1. Extraction of gradient direction features:

[0387] 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:

[0388] Step 1: Calculate the gradient magnitude and direction: Use the Sobel operator to calculate the x-direction and y-direction gradients on the original binary image (or its grayscale version):

[0389] x-direction gradient : obtained by convolution of the Sobel horizontal kernel (such as [[-1, 0, 1], [-2, 0, 2], [-1, 0, 1]]) with the image.

[0390] y-direction gradient : obtained by convolution of the Sobel vertical kernel (such as [-1, -2, -1], [0, 0, 0], [1, 2, 1]) with the image.

[0391] Step 2: Calculate the gradient direction angle:

[0392] For each edge pixel , its gradient direction angle is defined as: , where The function returns the angle between the gradient vector and the positive direction of the x-axis (ranging from to ), which can be subsequently normalized to or quantized into 8 direction intervals (such as every 45° interval) as node feature input for GCN.

[0393] 2. Extraction of curvature features:

[0394] Curvature describes the bending degree of the contour (such as small curvature for smooth edges and large curvature for burrs or corners), which is used to optimize "burr removal" and "corner smoothing" in the topology structure. The specific steps are as follows:

[0395] Step 1: Chain code tracking of connected contours in the edge map (such as 8-direction chain code) to convert two-dimensional edge pixels into an ordered point sequence , where is the coordinate of the kth contour point.

[0396] Step 2: Local window curvature calculation for each point in the sequence, take its n neighborhood points (such as n = 3, i.e. window size 7) before and after, and calculate the curvature by the following method:

[0397] 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).

[0398] 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. ;

[0399] Normalization: The curvature values ​​are normalized to the [0,1] interval and used as node features input to GCN.

[0400] II. The Role of Node Features in GCN

[0401] 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).

[0402] 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.

[0403] 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:

[0404] By aggregating neighborhood features layer by layer through multi-layer graph convolutional layers (GCN), the discriminative power of contour nodes is enhanced.

[0405] First layer graph convolution (feature dimensionality enhancement and local aggregation):

[0406] Input: Node features;

[0407] Core operation: For each node Aggregate all its adjacent nodes The characteristic of is defined by the formula: ;

[0408] 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.

[0409] Output: 32-d feature vector , capturing gradient and curvature associated features of local edges.

[0410] Second layer graph convolution (feature dimension reduction and global association):

[0411] Input: 32-d feature vector output by the first layer.

[0412] Core operation: further aggregate features of larger neighborhood (indirectly covering 2-hop neighborhood via first layer feature propagation), formula:

[0413] ;

[0414] where, ;

[0415] Output: 16-d feature vector , strengthening global continuity features of contours.

[0416] Third layer graph convolution (optional, for complex edges):

[0417] If the edge graph has multiple branches or noise, add a third layer of graph convolution:

[0418] Input: 16-d feature vector output by the second layer.

[0419] Output: 8-d feature vector , further compressing features and focusing on core contour patterns.

[0420] III. Probability distribution output and initial contour extraction:

[0421] 1. Contour probability prediction:

[0422] Final layer mapping: map the last layer GCN output feature (16-d or 8-d) to 2-d (contour / non-contour) via a fully connected layer, and calculate the probability via Softmax activation function:

[0423] ;

[0424] , logits value output by the fully connected layer, denotes the probability of the node belonging to contour C.

[0425] 2. Candidate node screening:

[0426] Set the probability threshold T (dynamic adjustment: T=0.65 for texture-dense areas, T=0.55 for smooth areas), when , mark as a contour candidate node.​

[0427] 3. Initial contour Generate:

[0428] For the selected candidate nodes, connect them into continuous segments in order of their coordinates in the image (based on 8-neighbor connectivity); remove isolated candidate nodes (number of adjacent candidate nodes < 2) to form an initial contour containing the main contour , preserving the main structure of the edge (such as the boundary of the wooden template, the joint).

[0429] S5.4, topology optimization:

[0430] S5.4.1, define the loss function L containing three constraints:

[0431] Continuity constraint: where, is the actual Euclidean distance between node i and node j, is the expected continuous distance between node i and node j.

[0432] The acquisition method includes a statistical method based on contour prior.

[0433] Using the standard contour data of the wooden template, the distance distribution between nodes of qualified contours is statistically obtained as the expected distance:

[0434] (1) Standard contour sampling:

[0435] Collect contour data of R qualified wooden templates, extract contour node sequence , M is the number of contour nodes.

[0436] (2) Statistics of node distance:

[0437] For the standard contour, calculate the Euclidean distance and of adjacent nodes , and obtain:

[0438] Average continuous distance ;

[0439] Distance standard deviation , R is the gradient threshold.

[0440] (3) Expected distance setting:

[0441] For the nodes , of the current contour, if they belong to adjacent contour segments (such as 8-neighbor connectivity), the expected continuous distance is set as: , is the tolerance, for example , which means allowing small fluctuations.

[0442] Curvature constraint: where, is the curvature of node i, is the local average curvature;

[0443] Closedness judgment: for a closed contour candidate region, calculate the contour gap length g, if then , otherwise, ;

[0444] S5.4.2, loss function , , , , optimize GCN parameters by backpropagation;

[0445] S5.4.3, output optimized contour , whose topological structure satisfies continuity (no break), low curvature mutation (no burr), and key region closure (such as wood template boundary).

[0446] S5.5, contour geometric feature extraction: for the optimized contour Calculate the feature set F:

[0447] Length feature: total contour length , segment continuous length ;

[0448] Curvature feature: maximum curvature , curvature standard deviation ;

[0449] Closed feature: closed region area S, gap number ;

[0450] S5.6, standard feature library comparison:

[0451] S5.6.1, construct wood template processing standard feature library , containing the geometric feature threshold range of qualified contours (such as , ); wood template processing standard feature library is generated by clustering the features of 3000 qualified wood contour images. When the image features in the wood template processing standard feature library are added, the geometric feature threshold of the qualified contour (contour geometric feature) is dynamically updated.

[0452] S5.6.2, calculate feature deviation , get the quality score by weighted sum , The feature weight is a characteristic weight, which can be obtained by expert experience method or statistical learning method, which is prior art and will not be described here.

[0453] S5.7, result output and feedback:

[0454] S5.7.1, if , it is determined that the edge quality is qualified; otherwise, the unqualified area (such as burr with excessive curvature, open gap) is marked;

[0455] S5.7.2, the unqualified area coordinates and deviation value are fed back to the machining control system for adjusting the machining parameters (such as cutting speed, tool precision).

[0456] The above specific embodiments further illustrate the purpose, technical scheme and beneficial effects of the present application. It should be understood that the above description is only a specific embodiment of the present application and is not used to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. within the spirit and principle of the present application should be included in the protection scope of the present application.

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. 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 noise reduction 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: apply a general enhancement strategy to the original image and perform adaptive histogram equalization combined with NLM denoising to obtain a global preprocessed image; 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. The specific process is as follows: For the local enhanced image, the Sobel 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. 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 containing pixel (x, y); 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. 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. Then, the geometric features of the contours are extracted and compared with a standard feature library for wood template processing. The edge quality assessment results are 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 the loss function, and optimize the parameters of the graph convolutional network (GCN) through backpropagation using the loss function, so that the GCN outputs an optimized contour. 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 W be the edge between node i and node j, and W be the graph structure. 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.

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 on-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 high-dust 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 backlight 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 determine 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 1, 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, calculate the linear model parameters of its window 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 p and q are the two pixels to be compared; 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.

5. 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 mode (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: Perform dilation and erosion operations on the initial backlight area 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.

6. 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 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.

Citation Information

Patent Citations

  • 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