A machine vision-based method and system for detecting surface defects of an extruded pipe
By employing a multi-directional filter bank and dynamic smooth scale mapping method, the contradiction between noise suppression and crack feature preservation in the surface inspection of low-smoke halogen-free flame-retardant pipes is resolved, achieving high-precision crack detection, reducing false alarm rate, and adapting to the production needs of different batches.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HUBEI DONGLIAN AVIATION CABLE ELECTRIC CO LTD
- Filing Date
- 2026-03-10
- Publication Date
- 2026-06-09
AI Technical Summary
Existing machine vision detection algorithms cannot simultaneously suppress high-frequency structural noise and retain extremely weak micro-crack features in the surface detection of low-smoke halogen-free flame-retardant pipes, leading to false alarms or missed detections.
A multi-directional filter bank is used to extract texture energy response values, calculate the local spatial anisotropy index, use the exponential function for dynamic smoothing scale mapping, and combine Gaussian kernel function and Hessian matrix processing to perform adaptive smoothing and confidence enhancement response calculation, so as to accurately extract real crack defects.
It achieves high-precision crack detection on the surface of low-smoke halogen-free flame-retardant pipes, reduces false alarm rate, improves detection accuracy, adapts to the production needs of different batches, and has good stability.
Smart Images

Figure CN122175938A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image processing technology, specifically relating to a method and system for detecting surface defects in extruded pipes based on machine vision. Background Technology
[0002] With the rapid development of the specialty cable and heat-shrink tubing industry, low-smoke halogen-free flame-retardant materials, due to their excellent environmental protection and fire resistance properties, are widely used in high-end manufacturing fields such as aerospace and new energy. During the continuous extrusion production of these tubing materials, the surface of the tubing occasionally develops extremely fine cracks due to the combined effects of various process factors, such as uneven distribution of equipment traction force, sudden temperature changes in the cooling water tank, or the release of internal physical stress in the material. These defects seriously threaten the insulation and sealing performance and service life of the product. To strictly ensure product quality and improve industrial automation, manufacturers typically deploy machine vision inspection systems to continuously photograph the surface of the tubing on the high-speed extrusion line in real time and rely on underlying image processing algorithms to detect appearance defects.
[0003] For extracting linear defects on the surface of extruded pipes, traditional algorithms such as Hessian matrix ridge detection or edge gradient detection are commonly used in the field of industrial visual inspection. The core computational logic of these methods is to solve the second-order partial derivatives of image pixels to find the direction with the maximum brightness curvature in local space, thereby locating and depicting the contour of the crack. Since the calculation of higher-order derivatives is extremely sensitive to random noise in the image itself, traditional algorithms must introduce a Gaussian filter of a fixed scale to perform pre-smoothing and blurring processing on the original grayscale image before performing partial derivative calculations in order to eliminate interference signals.
[0004] However, the surface morphology of low-smoke halogen-free flame-retardant special pipes is not absolutely smooth. Due to the special chemical formula and the crystallization characteristics of the polymer materials, their surface naturally exhibits a unique microscopic frosted or matte texture. Under the combined illumination of industrial high-resolution cameras and high-intensity uniform light sources, this inherent microscopic three-dimensional texture of the material is transformed into extremely dense, high-frequency, and completely randomly distributed micro-particle texture noise in two-dimensional digital images. At the same time, the width of real physical cracks often ranges from a few micrometers to tens of micrometers, and the direction of extension exhibits irregular variations in depth, with extremely weak signals.
[0005] Faced with the extremely complex imaging conditions described above, traditional image processing algorithms that rely on fixed-scale smoothing reveal insurmountable physical limitations. If the set filter scale is too small, while it may barely preserve the edge sharpness of micron-level cracks, the contours of most microscopic material particles will also be preserved simultaneously or even enhanced by partial derivative operations, directly leading to a massive number of false positives in the detection system. Conversely, if the set filter scale is too large, it can effectively blur and suppress the noise of frosted particles in the background, but this large-scale pixel averaging effect will cause the already extremely weak true crack gradient features to completely blend with the surrounding rough background, resulting in missed detections. Summary of the Invention
[0006] The purpose of this invention is to propose a machine vision-based method and system for detecting surface defects in extruded pipes, in order to solve the technical problem that existing machine vision image processing algorithms that use fixed-scale smoothing cannot simultaneously suppress high-frequency structural noise on rough surfaces and retain extremely weak micro-crack features, thus easily leading to false or missed crack detections in the detection of defects in extruded pipes.
[0007] To address the above problems, the technical solution of the machine vision-based surface defect detection method for extruded pipes proposed in this invention is as follows: Machine vision-based methods for detecting surface defects in extruded pipes include: The original grayscale image of the extruded pipe surface is obtained, and the texture energy response of each pixel in the original grayscale image in different directions is extracted using a multi-directional filter bank to obtain the local maximum texture energy response value, local minimum texture energy response value and global average texture energy response value of the original grayscale image for each pixel. Based on the local minimum texture energy response value, local maximum texture energy response value and global average texture energy response value of each pixel, a ratio calculation is performed to calculate the local spatial anisotropy index of each pixel in the original grayscale image. By utilizing the nonlinear decay characteristics of the exponential function, the basic scale constant is dynamically mapped based on the local spatial anisotropy exponent of each pixel, and the dynamic smoothing scale of the corresponding pixel is calculated. The original grayscale image is smoothed using the Gaussian kernel function corresponding to the dynamic smoothing scale of each pixel, and a Hessian matrix is constructed. The eigenvalues of the Hessian matrix are solved, and the confidence enhancement response is calculated in combination with the baseline background curvature constant, thereby extracting the real crack defects.
[0008] The beneficial effects are as follows: This invention can completely acquire the basic image information of the pipe surface and accurately extract the texture direction features of each pixel; by calculating the local spatial anisotropy index, it can clearly characterize the local texture direction characteristics of each pixel on the pipe surface, effectively distinguishing normal background texture without a fixed direction from crack features with a clear direction, and achieving effective separation of background texture and defect features; this invention utilizes the nonlinear decay characteristics of the exponential function to calculate the dynamic smoothing scale, which can achieve adaptive adjustment of the smoothing scale according to the local texture features, allowing each pixel to be matched with a smoothing scale that suits its local features, thereby solving the problem that a fixed smoothing scale cannot take into account crack features. This invention addresses the inherent contradiction between preserving and suppressing background noise. It uses a Gaussian kernel function corresponding to a dynamic smoothing scale to smooth the original grayscale image and construct a Hessian matrix. After solving for the eigenvalues of the Hessian matrix, it combines this with the baseline background curvature constant to perform confidence enhancement response calculation. This allows for the preservation of effective features of real cracks during adaptive smoothing, precise localization of crack features using the Hessian matrix, and further enhancement of the feature response of real cracks through confidence enhancement response calculation. This suppresses the interference of background artifacts, thereby accurately extracting real crack defects and completing image processing based on dynamic adaptive scales of local texture anisotropy, effectively improving the accuracy of crack detection on pipe surfaces.
[0009] Further, obtaining the local maximum texture energy response value, the local minimum texture energy response value, and the global average texture energy response value for each pixel includes: A two-dimensional filter bank is used to perform two-dimensional convolution operation on the original grayscale image to obtain the texture energy response values of each pixel in multiple core directions. Extract the local maximum and local minimum texture energy response values of each pixel in all core directions. At the same time, calculate the global arithmetic mean of the local maximum texture energy response values of all pixels, and use the global arithmetic mean as the global average texture energy response value.
[0010] Furthermore, the formula for calculating the local spatial anisotropy index of each pixel is as follows:
[0011] In the formula, Represents pixels The local spatial anisotropy index at that location, For pixels The local minimum texture energy response value at that location. For pixels The local maximum texture energy response value at that location. This represents the global average texture energy response value.
[0012] The beneficial effects are as follows: The global average texture energy response value is added to both the numerator and denominator of the formula for ratio calculation. This not only ensures the consistency of the calculation process of the local minimum texture energy response value and the local maximum texture energy response value, but also eliminates the risk of calculation error caused by the denominator being zero due to the local minimum texture energy response value and the local maximum texture energy response value being too small. This achieves accurate calculation of the local spatial anisotropy index.
[0013] Furthermore, the formula for calculating the dynamic smoothing scale of the corresponding pixel is:
[0014] In the formula, Represents pixels The dynamic smoothing scale at the location, The basic scale constant, It is an exponential function with the base of the natural logarithm.
[0015] The beneficial effects are as follows: This scheme uses the nonlinear decay characteristics of the exponential function to calculate the dynamic smoothing scale of the corresponding pixel. The calculation process makes the dynamic smoothing scale calculated smaller when the local spatial anisotropy exponent of each pixel is larger, and the dynamic smoothing scale calculated larger when the local spatial anisotropy exponent is smaller. This realizes the dynamic mapping from the basic scale constant to the dynamic smoothing scale, ensuring that the dynamic smoothing scale of the corresponding pixel completely matches the local feature state of the original grayscale image of the extruded pipe surface.
[0016] Furthermore, the process of smoothing the original grayscale image using the Gaussian kernel function corresponding to the dynamic smoothing scale of each pixel and constructing the Hessian matrix, and then solving for the eigenvalues of the Hessian matrix, includes: The original grayscale image is subjected to adaptive smooth convolution processing using the Gaussian kernel function corresponding to the dynamic smoothing scale of each pixel to obtain the image after smooth convolution processing. Calculate the horizontal second-order partial derivatives, vertical second-order partial derivatives, and mixed second-order partial derivatives of the image after the smooth convolution process; The standard Hessian matrix is constructed using the horizontal second-order partial derivatives, vertical second-order partial derivatives, and mixed second-order partial derivatives. Solve for the large and small eigenvalues of the standard Hessian matrix.
[0017] The beneficial effects are: the construction of the Hessian matrix can be fully adapted to the dynamic smoothing scale of the corresponding pixel, ensuring that the solved eigenvalues can accurately reflect the local curvature characteristics of the corresponding pixel, and providing accurate feature basis for subsequent crack defect confidence enhancement response calculation.
[0018] Furthermore, the confidence enhancement response calculation based on the reference background curvature constant includes: Based on the large and small eigenvalues of the standard Hessian matrix and the baseline background curvature constant, the crack defect confidence enhancement response value of the corresponding pixel is calculated using the following formula:
[0019] In the formula, For pixels Confidence enhancement response value for crack defects at the location These are the large eigenvalues of the standard Hessian matrix. These are the small eigenvalues of the standard Hessian matrix. The baseline curvature constant is used as the reference.
[0020] The beneficial effects are as follows: by constructing a relationship between large eigenvalues, small eigenvalues and the baseline background curvature constant, the confidence enhancement response value of crack defects is calculated. This can strengthen the characteristic response of real cracks while strongly suppressing the pseudo-effects caused by random microstructures on the frosted surface. At the same time, it ensures the uniformity of physical dimensions during the calculation process, avoids calculation anomalies in flat areas, and allows the obtained response value to accurately distinguish between real cracks and background artifacts, thus greatly improving the accuracy of defect extraction.
[0021] Furthermore, after calculating the confidence enhancement response by combining the reference background curvature constant, the method further includes: The confidence enhancement response value of crack defects of all pixels in the original grayscale image is compared with the preset response threshold. If the confidence enhancement response value of the corresponding pixel is greater than the preset response threshold, the corresponding pixel is marked as a crack pixel. Connectivity filtering is performed on the marked crack pixels to output the final crack detection coordinates on the surface of the extruded pipe.
[0022] The beneficial effects are: it can further eliminate isolated outlier response values, avoid false alarms caused by single-pixel noise, make the final output crack detection results more consistent with the real defect morphology, and improve the reliability of the detection results.
[0023] Further, the marked crack pixels are subjected to connected region filtering to output the final crack detection coordinates on the extruded pipe surface, including: Calculate the total area of crack pixels contained in each connected region; If the total area of the crack pixels contained in the connected region is greater than the preset area threshold, the corresponding connected region is determined to be the region where the real crack defect is located, and the morphological coordinate data of the region where the real crack defect is located is output as the final crack detection coordinates on the surface of the extruded pipe. If the total area of the cracked pixels contained in the connected region is not greater than the preset area threshold, the corresponding connected region is determined to be an isolated noise point and is removed.
[0024] The beneficial effects are: it can complete the final authenticity judgment based on the morphological characteristics of the defect, eliminate scattered background noise interference, ensure that the final output detection result corresponds only to the real crack defect, and further reduce the false alarm rate of detection.
[0025] Furthermore, the value of the basic dimensional constant is obtained from the pre-read extruded pipe production process standard document, and the average pixel width of the minimum limit crack allowed by the standard in the extruded pipe production process standard document is obtained as the basic dimensional constant.
[0026] The beneficial effects are: it enables the setting of the basic scale constant to match the production and inspection standards of the corresponding pipe, ensures that the mapping benchmark of the dynamic smooth scale fits the actual crack detection requirements, avoids the problem of missing fine cracks due to the deviation of the basic scale setting, and improves the adaptability of the algorithm to pipes of different specifications.
[0027] The technical solution of the machine vision-based extruded pipe surface defect detection system proposed in this invention is as follows: The machine vision-based extruded pipe surface defect detection system includes a processor and a memory. The memory stores computer program instructions. When the computer program instructions are executed by the processor, the machine vision-based extruded pipe surface defect detection method described in any of the above technical solutions is implemented.
[0028] The beneficial effects of this invention are as follows: This invention can effectively solve the problems of false alarms and missed alarms caused by fixed-scale smoothing in the detection of micro-rough pipe surface cracks. It overcomes the feature contradictions caused by fixed scale from the root, takes into account both background noise suppression and preservation of fine crack features, breaks through the technical bottleneck of fine crack detection, can strongly suppress the spurious effects caused by the micro-texture of the pipe surface, block the path of high-frequency noise being misjudged as defects, accurately extract real crack defects, and greatly improve the accuracy of industrial detection. At the same time, this invention has excellent anti-environment interference ability, which can eliminate the heavy burden of repeated parameter adjustment on the production site with batch changes, and stably achieve high-precision detection of pipe surface cracks. Attached Figure Description
[0029] Figure 1 This is a flowchart of a machine vision-based method for detecting surface defects in extruded pipes, provided in an embodiment of the present invention.
[0030] Figure 2 This is a comparison chart showing the processing effects of existing technologies and the present invention on the original grayscale image of the extruded pipe surface. Detailed Implementation
[0031] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
[0032] Specific embodiments of the machine vision-based surface defect detection method for extruded pipes proposed in this invention: like Figure 1 As shown, the machine vision-based method for detecting surface defects in extruded pipes includes the following steps: S1. Obtain the original grayscale image of the extruded pipe surface, and use a multi-directional filter bank to extract the texture energy response of each pixel in the original grayscale image in different directions, so as to obtain the local maximum texture energy response value, local minimum texture energy response value and global average texture energy response value of each pixel in the original grayscale image.
[0033] First, an industrial linear array camera and a low-angle ring light source deployed on the extrusion production line are used to acquire the original grayscale image of the surface of the halogen-free flame-retardant extruded pipe in real time. This image serves as the basic data source input to the detection system. Given that the pipe surface contains both randomly distributed microscopic abrasive noise and potentially directional microcracks, this step employs a two-dimensional filter bank to convolve the original grayscale image to analyze its local spatial frequency and directional physical properties. Specifically, a filter bank covering multiple core directions is constructed and subjected to two-dimensional convolution operations with the original grayscale image. For any pixel in the image, the texture energy response value in each core direction is obtained after convolution calculation. The physical dimension of this response value is expressed as the intensity amplitude of grayscale changes. The detection system traverses each core direction, extracting the local maximum and local minimum texture energy response values. Simultaneously, it traverses all pixels in the entire original grayscale image, sums the extracted local maximum texture energy response values for all pixels, divides by the total number of pixels, and obtains the global arithmetic mean, which is used as the global average texture energy response value.
[0034] Thus, by constructing a multi-directional filtering mechanism to extract pixel extrema and global mean, the microscopic physical morphology of the measured surface can be accurately converted into numerical parameters with clear dimensions, laying an accurate data foundation for the subsequent intelligent identification of target categories by the system.
[0035] S2. Construct a ratio operation based on the local minimum texture energy response value, local maximum texture energy response value and global average texture energy response value of each pixel, and calculate the local spatial anisotropy index of each pixel in the original grayscale image.
[0036] Based on the texture energy response data with unified physical dimensions obtained in step S1, this step aims to accurately evaluate the texture directionality intensity of each local region in the original grayscale image of the extruded pipe surface. To overcome the computational bottleneck of existing technologies that cannot distinguish between non-directional frosted background particles and real crack defects with clear orientations, this step constructs a continuous numerical variable, namely the local spatial anisotropy index, to characterize the physical properties of the microenvironment in which the current pixel is located. This index serves as a control variable to guide subsequent adaptive adjustment of the dynamic smoothing scale.
[0037] Specifically, the formula for calculating the local spatial anisotropy index of each pixel is as follows:
[0038] In the formula, Represents pixels The local spatial anisotropy index at a given location is used as a dimensionless decimal for subsequent control. For extracted pixels The local minimum texture energy response value at; For extracted pixels The local maximum texture energy response value at that location; The global average texture energy response value is used as a reference energy constant in this ratio calculation.
[0039] The principle behind this formula is as follows: When the local minimum and local maximum texture energy response values of a corresponding pixel are close to each other, it indicates that the region where the pixel is located contains non-directional frosted background particles. In this case, the result of the fraction in the formula approaches 1, leading to a local spatial anisotropy index approaching 0. This result perfectly aligns with actual physical laws, meaning that a normally rough pipe surface exhibits extremely low anisotropy. When the local maximum texture energy response value of a corresponding pixel is much greater than the local minimum texture energy response value, it indicates the presence of a small, real crack defect with a clear direction in the region where the pixel is located. In this case, the result of the fraction in the relation approaches 0, leading to a local spatial anisotropy index approaching 1, indicating extremely strong anisotropy at this spatial location.
[0040] By incorporating the global average texture energy response value, representing the overall baseline energy of the image, into both the numerator and denominator of the formula, not only is strict uniformity of the physical dimensions in the ratio calculation ensured, but more importantly, it avoids the extreme calculation error of a denominator of 0 that may occur in absolutely flat dark areas. Since the global average texture energy response value is always greater than 0 under normal imaging conditions, this calculation design serves as a numerical regularization, preventing false anisotropic high values from being generated due to extremely weak electrical noise in dark areas caused by local energy ratio imbalances.
[0041] Thus, by introducing a global energy constant to construct a ratio calculation system, it is possible to accurately extract key indices that characterize local microstructural features while eliminating extreme calculation errors, thereby significantly improving the rigor of data analysis.
[0042] S3. Utilizing the nonlinear decay characteristics of the exponential function, the basic scale constant is dynamically mapped based on the local spatial anisotropy exponent of each pixel, and the dynamic smoothing scale of the corresponding pixel is calculated.
[0043] To resolve the engineering contradiction in existing image processing techniques where a fixed smoothing scale cannot simultaneously preserve weak features and suppress high-frequency noise, this step utilizes a nonlinear mapping algorithm to independently calculate and assign an adaptive smoothing scale to each pixel in the original grayscale image of the extruded pipe surface. Real, fine crack areas require a smaller smoothing scale to prevent the sharp edge gradients and subtle physical widths of the cracks from being destroyed; while the normal frosted background areas of the pipe surface urgently require a very large smoothing scale to effectively blur and flatten the dense, high-frequency particle noise. Therefore, the corresponding dynamic smoothing scale should exhibit a strictly inverse mapping relationship with the local spatial anisotropy index.
[0044] Specifically, the formula for calculating the dynamic smoothing scale of the corresponding pixel is as follows:
[0045] In the formula, Represents the calculated pixel points Dynamic smoothing scale at the location; The fundamental scale constant; The pixels calculated in the previous steps Local spatial anisotropy index at a given location; It is an exponential function with the base of the natural logarithm.
[0046] For the basic scale constant in the formula, the average pixel width of the minimum limit crack allowed in the standard document of pipe production process is obtained by reading it in advance, and it is directly used as the source of the value of the basic scale constant for assignment, so as to ensure that the generated dynamic smooth scale can closely fit the physical detection benchmark of the actual industrial production line.
[0047] This formula utilizes the nonlinear decay characteristic of the exponential function to construct a smooth and continuous scale mapping logic. When the corresponding pixel is located on a real crack defect, its local spatial anisotropy exponent approaches 1. At this time, the calculation result in the exponential term of the formula approaches -1, resulting in the final calculated dynamic smooth scale of the corresponding pixel being approximately 1.36 times the basic scale constant. This is a relatively small scale value, allowing the subsequent construction of the Hessian matrix to completely preserve the weak edge gradient of the real crack defect when extracting the spatial curvature of this pixel.
[0048] When a corresponding pixel is located on a non-directional frosted background noise, its local spatial anisotropy exponent approaches 0. At this time, the calculation result of the exponent term in the relation approaches 1, resulting in the dynamic smoothing scale of the corresponding pixel being approximately 3.71 times the basic scale constant. This means that the system will automatically apply a very large smoothing kernel to the non-directional noise pixel, melting the high-frequency frosted particles into a flat grayscale background, directly blocking the physical path of high-frequency particle edges being mistaken for real crack defects from the underlying data structure.
[0049] By establishing the aforementioned exponential continuous mapping function, the image processing algorithm achieves intelligent adjustment of the smooth scale according to the local physical state, eliminating the recognition obstacles caused by the traditional algorithm's heavy reliance on rigid fixed parameters.
[0050] S4. The original grayscale image is smoothed using the Gaussian kernel function corresponding to the dynamic smoothing scale of each pixel, and a Hessian matrix is constructed. The eigenvalues of the Hessian matrix are solved, and the confidence enhancement response is calculated in combination with the baseline background curvature constant, thereby extracting the real crack defects.
[0051] After obtaining the dynamic smoothing scale for each pixel, the Gaussian kernel function corresponding to that scale value is used to perform spatial adaptive smoothing convolution processing on the original grayscale image of the extruded pipe surface. Based on the image data distribution after adaptive smoothing convolution processing, the horizontal second-order partial derivative, vertical second-order partial derivative, and mixed second-order partial derivative of each pixel in the image are calculated. These three second-order partial derivatives are used to construct a standard Hessian matrix describing the local second-order geometric structure of the image, and the two eigenvalues of this standard Hessian matrix are solved. The solved eigenvalues are sorted according to their absolute values, with the eigenvalues with larger absolute values designated as the large eigenvalues of the standard Hessian matrix, and the eigenvalues with smaller absolute values designated as the small eigenvalues. The large eigenvalue of the standard Hessian matrix represents the principal curvature response of the corresponding pixel on the normal profile, used to characterize the local spatial curvature extremum features perpendicular to the crack direction.
[0052] Given the complex surface environment of extruded pipes, although the background area is smoothed after dynamic scaling, slight fluctuations in feature values may still remain, making direct comparison of feature values prone to false alarms. Therefore, this step combines the global curvature background features of the pipe and uses the following formula to calculate the enhanced confidence response value for crack defects at the corresponding pixel:
[0053] In the formula, For the calculated pixel points The confidence enhancement response value of the crack defect at the location; These are the large eigenvalues of the standard Hessian matrix calculated based on dynamic smoothing scaling; These are the small eigenvalues of the standard Hessian matrix calculated based on dynamic smoothing scaling; The baseline curvature constant is used as the reference.
[0054] The principle behind this formula lies in leveraging the significant differences in curvature between cracks and abrasive particles to enhance and suppress features. Real pipe surface cracks exhibit a groove-like physical cross-section, meaning that the local spatial curvature along the crack direction is extremely large (i.e., the large eigenvalue is large), while the local spatial curvature along the crack direction is extremely small and approaches 0 (i.e., the small eigenvalue is extremely small). When a real crack is detected, the fractional term within the parentheses in the formula approaches 0 due to the extremely small numerator, causing the factor within the parentheses to approach 1. At this point, the crack defect confidence enhancement response value is almost equal to the complete value of the large eigenvalue, thus greatly amplifying the crack feature. When encountering isolated, point-like micro-pits accidentally formed on a abrasive surface, the curvature of this type of structure is large and close to each other in all directions (i.e., the large and small eigenvalues are similar), causing the fractional term within the parentheses in the formula to approach 1, which in turn causes the multiplier factor within the parentheses to approach 0. Ultimately, this forces the crack defect confidence enhancement response value to be suppressed to 0, effectively filtering out point noise.
[0055] The value of the reference background curvature constant in the formula is determined by the global arithmetic mean of the absolute values of the largest eigenvalues of all pixels in the entire image after adaptive smoothing. Adding the reference background curvature constant to the denominator ensures, on the one hand, that the denominator still has a valid value when the large eigenvalues approach 0 in extremely flat brightness areas, avoiding mathematical logic collapse; on the other hand, since the reference background curvature constant has the same curvature physical dimension as the eigenvalues, it ensures the uniformity of the physical dimensions of the entire formula, achieving adaptive normalization of the basic roughness of the pipe surface for different batches.
[0056] After completing the response calculation, the enhanced response value of the crack defect confidence level of all pixels in the original grayscale image of the extruded pipe surface is compared with a preset response threshold. If the enhanced response value of the crack defect confidence level is greater than the preset response threshold, the corresponding pixel is marked as a crack pixel. Then, connected component filtering is performed on the marked crack pixels, and the total area of crack pixels contained in each connected component is calculated. If the total area is greater than a preset area threshold, the corresponding connected component is determined to be the region where the real crack defect is located and the morphological coordinate data is output; if the total area is not greater than the preset area threshold, the corresponding connected component is determined to be an isolated noise point and is removed. Finally, the crack detection coordinates on the pipe surface are output.
[0057] The following combination Figure 2 The effects of the present invention will be further explained.
[0058] Figure 2 The image contains three sub-images. The sub-image on the left is the original grayscale image of the extruded pipe surface. The sub-image in the middle is a schematic diagram of the processing effect of the original grayscale image of the extruded pipe surface by existing technology. The sub-image on the right is a schematic diagram of the processing effect of the original grayscale image of the extruded pipe surface by the present invention.
[0059] The left sub-image shows the original grayscale state of the surface of the halogen-free flame-retardant extruded pipe. The surface of the extruded pipe in the image has obvious micro-frosted texture and high-frequency particle distribution. Due to the cylindrical structure, the left and right ends of the image show a natural edge brightness attenuation phenomenon. In the middle area of the image, there are some vertical fine cracks with weak signals and varying widths. The gradient features of these cracks are highly mixed with the surrounding densely distributed rough particle background, making it extremely difficult to extract them effectively using conventional image processing methods.
[0060] The middle sub-image shows the defect extraction results after processing with the existing fixed-scale Hessian matrix algorithm. In this image, although the real crack in the middle position is partially extracted, the fixed smooth scale cannot take into account the rough background because the anisotropy of the local texture of the pipe is not considered. As a result, a large number of normal micro-frosted particles on the surface of the pipe are misjudged by the algorithm as dense dot-like and short-line defects. The image is full of messy noise and falsely reported bright spots, which seriously obscures the real defect situation.
[0061] The sub-image on the right visually presents the final result processed by the dynamic adaptive scaling algorithm of this invention. The originally dense microscopic frosted particles and noise in the background were successfully suppressed and transformed into a clean background by the algorithm based on the anisotropy index, eliminating the risk of misjudgment. The originally faint cracks in the center of the image were precisely, continuously, and completely extracted as bright pixel bands due to the enhanced response logic; the outline and shape of the cracks are clearly visible, achieving high-precision defect extraction against a noisy and rough background.
[0062] Specific embodiments of the machine vision-based extruded pipe surface defect detection system proposed in this invention: The machine vision-based extruded pipe surface defect detection system includes a processor and a memory. The memory stores computer program instructions. When the computer program instructions are executed by the processor, the machine vision-based extruded pipe surface defect detection method in the above embodiments is implemented.
[0063] The machine vision-based extruded pipe surface defect detection system also includes other components well known to those skilled in the art, such as communication buses and communication interfaces. Their setup and functions are known in the art and will not be described in detail here.
[0064] While various embodiments of the invention have been shown and described in this specification, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Many modifications, alterations, and alternatives will occur to those skilled in the art without departing from the spirit and essence of the invention.
Claims
1. A machine vision-based method for detecting surface defects in extruded pipes, characterized in that, include: The original grayscale image of the extruded pipe surface is obtained, and the texture energy response of each pixel in the original grayscale image in different directions is extracted using a multi-directional filter bank to obtain the local maximum texture energy response value, local minimum texture energy response value and global average texture energy response value of the original grayscale image for each pixel. Based on the local minimum texture energy response value, local maximum texture energy response value and global average texture energy response value of each pixel, a ratio calculation is performed to calculate the local spatial anisotropy index of each pixel in the original grayscale image. By utilizing the nonlinear decay characteristics of the exponential function, the basic scale constant is dynamically mapped based on the local spatial anisotropy exponent of each pixel, and the dynamic smoothing scale of the corresponding pixel is calculated. The original grayscale image is smoothed using the Gaussian kernel function corresponding to the dynamic smoothing scale of each pixel, and a Hessian matrix is constructed. The eigenvalues of the Hessian matrix are solved, and the confidence enhancement response is calculated in combination with the baseline background curvature constant, thereby extracting the real crack defects.
2. The method for detecting surface defects in extruded pipes based on machine vision according to claim 1, characterized in that, The process of obtaining the local maximum texture energy response value, local minimum texture energy response value, and global average texture energy response value of each pixel includes: A two-dimensional filter bank is used to perform two-dimensional convolution operation on the original grayscale image to obtain the texture energy response values of each pixel in multiple core directions. Extract the local maximum and local minimum texture energy response values of each pixel in all core directions. At the same time, calculate the global arithmetic mean of the local maximum texture energy response values of all pixels, and use the global arithmetic mean as the global average texture energy response value.
3. The machine vision-based surface defect detection method for extruded pipes according to claim 2, characterized in that, The formula for calculating the local spatial anisotropy index of each pixel is: In the formula, Represents pixels The local spatial anisotropy index at that location, For pixels The local minimum texture energy response value at that location. For pixels The local maximum texture energy response value at that location. This represents the global average texture energy response value.
4. The machine vision-based method for detecting surface defects in extruded pipes according to claim 3, characterized in that, The formula for calculating the dynamic smoothing scale of the corresponding pixel is: In the formula, Represents pixels The dynamic smoothing scale at the location, The basic scale constant, It is an exponential function with the base of the natural logarithm.
5. The machine vision-based method for detecting surface defects in extruded pipes according to claim 4, characterized in that, The process of smoothing the original grayscale image using the Gaussian kernel function corresponding to the dynamic smoothing scale of each pixel and constructing the Hessian matrix, and then solving the eigenvalues of the Hessian matrix includes: The original grayscale image is subjected to adaptive smooth convolution processing using the Gaussian kernel function corresponding to the dynamic smoothing scale of each pixel to obtain the image after smooth convolution processing. Calculate the horizontal second-order partial derivatives, vertical second-order partial derivatives, and mixed second-order partial derivatives of the image after the smooth convolution process; The standard Hessian matrix is constructed using the horizontal second-order partial derivatives, vertical second-order partial derivatives, and mixed second-order partial derivatives. Solve for the large and small eigenvalues of the standard Hessian matrix.
6. The machine vision-based method for detecting surface defects in extruded pipes according to claim 5, characterized in that, The confidence enhancement response calculation based on the reference background curvature constant includes: Based on the large and small eigenvalues of the standard Hessian matrix and the baseline background curvature constant, the crack defect confidence enhancement response value of the corresponding pixel is calculated using the following formula: In the formula, For pixels Confidence enhancement response value for crack defects at the location These are the large eigenvalues of the standard Hessian matrix. These are the small eigenvalues of the standard Hessian matrix. The baseline curvature constant is used as the reference.
7. The machine vision-based surface defect detection method for extruded pipes according to claim 6, characterized in that, After calculating the confidence enhancement response by combining the reference background curvature constant, the method further includes: The confidence enhancement response value of crack defects of all pixels in the original grayscale image is compared with the preset response threshold. If the confidence enhancement response value of the corresponding pixel is greater than the preset response threshold, the corresponding pixel is marked as a crack pixel. Connectivity filtering is performed on the marked crack pixels to output the final crack detection coordinates on the surface of the extruded pipe.
8. The machine vision-based method for detecting surface defects in extruded pipes according to claim 7, characterized in that, Connectivity filtering is performed on the marked crack pixels to output the final crack detection coordinates on the extruded pipe surface, including: Calculate the total area of crack pixels contained in each connected region; If the total area of the crack pixels contained in the connected region is greater than the preset area threshold, the corresponding connected region is determined to be the region where the real crack defect is located, and the morphological coordinate data of the region where the real crack defect is located is output as the final crack detection coordinates on the surface of the extruded pipe. If the total area of the cracked pixels contained in the connected region is not greater than the preset area threshold, the corresponding connected region is determined to be an isolated noise point and is removed.
9. The machine vision-based method for detecting surface defects in extruded pipes according to claim 4, characterized in that, The value of the basic dimensional constant is obtained from the pre-read extruded pipe production process standard document, and the average pixel width of the minimum limit crack allowed by the standard in the extruded pipe production process standard document is used as the basic dimensional constant.
10. A machine vision-based surface defect detection system for extruded pipes, characterized in that, It includes a processor and a memory, the memory storing computer program instructions, which, when executed by the processor, implement the machine vision-based method for detecting surface defects in extruded pipes as described in any one of claims 1-9.