A tube wall defect detection method for hypotube processing
By dynamically adjusting the Gaussian kernel side length and edge detection and combining it with artificial neural networks, the over-smoothing problem caused by the fixed Gaussian kernel in the single-scale Retinex algorithm is solved, and the accuracy and robustness of hypotube wall defect detection are improved.
Patent Information
- Application Number
- CN202511086724.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-05
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2045-08-05
AI Technical Summary
When the single-scale Retinex algorithm is used to enhance the surface image of the hypotube, the fixed Gaussian kernel size leads to excessive smoothing of the area with simple texture but prone to crack defects, which reduces the accuracy of crack defect detection.
By dynamically adjusting the filter kernel size and optimizing the Gaussian kernel side length according to the texture complexity and position importance of the target pixel, the accuracy of crack and defect detection can be improved by combining edge detection and artificial neural network.
It effectively reduces the over-smoothing phenomenon, improves the accuracy and robustness of hypotube wall defect detection, and enhances the detection capability of areas with simple textures.
Smart Images

Figure CN120580238B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image data processing, and in particular to a tube wall defect detection method for hypotube processing. Background Art
[0002] With the continuous advancement of medical technology, the requirements for medical devices are becoming increasingly stringent. Hypotubes, as core components of ventilators, hemodialysis equipment, and other devices, undertake important medical tasks. The performance of hypotubes is directly related to the safety of patients. Defects such as tiny cracks in the hypotube wall can not only interfere with the normal operation of medical equipment, but may also cause serious medical accidents. Therefore, achieving high-precision defect detection is imminent.
[0003] The Single-Scale Retinex Algorithm optimizes image brightness and contrast, making potential crack defects easier to identify. The enhanced image can more efficiently process and identify cracks or pipe wall defects, improving the intelligence and automation of pipe wall defect detection.
[0004] However, when using the single-scale Retinex algorithm for image enhancement, Gaussian filtering is usually used for local illumination estimation. During Gaussian filtering, the same size Gaussian kernel is selected for each pixel. If the Gaussian kernel is too large, the illumination component will lose detail information, causing the enhanced image to become blurred. If the Gaussian kernel is too small, the illumination component cannot effectively separate the illumination information, and the enhanced image may exhibit a halo effect or local overexposure. As a result, when enhancing the surface image of the hypotube, for some areas with simple textures but more prone to crack defects, using a fixed Gaussian kernel size will result in over-smoothing, thereby reducing the accuracy of crack defect detection. Summary of the Invention
[0005] In order to solve the problem that the single-scale Retinex algorithm uses Gaussian filtering for local illumination estimation, when the single-scale Retinex algorithm is used for image enhancement processing when enhancing the surface image of a hypotube, the Gaussian filter selects a Gaussian kernel of the same size for each pixel point. For some areas with simple textures but more prone to crack defects, the use of a fixed Gaussian kernel size will lead to over-smoothing, thereby reducing the accuracy of crack defect detection. The present invention provides a tube wall defect detection method for hypotube processing.
[0006] In a first aspect, the present invention provides a method for detecting tube wall defects in hypotube processing, which adopts the following technical solution:
[0007] A tube wall defect detection method for hypotube processing comprises the following steps: obtaining the grayscale values of pixels in a surface image of the hypotube; determining the texture complexity of the reference area of the target pixel point based on the information entropy value of the grayscale values of the pixels in a reference area of the target pixel point and the sum of the differences between the grayscale values of each pixel point in the reference area of the target pixel point and the pixels in the neighborhood; identifying the surface image by edge detection to obtain all edge pixels in the surface image; and determining the texture complexity of the reference area of the target pixel point based on the number of edge pixels in the reference area of the target pixel point and the corresponding mode value of the gradient direction value of the edge pixel point. The position importance of the reference area of the target pixel is determined based on the number of edge pixels and the average grayscale values of the pixels on the side indicated by the gradient direction of the edge pixel; the filtering requirement of the target pixel is determined based on the texture complexity and the position importance; the odd value of the product of the filtering requirement and the initial Gaussian kernel side length is rounded as the corrected Gaussian kernel side length of the target pixel; based on the corrected Gaussian kernel side length, the surface image is enhanced using a single-scale Retinex algorithm, and the enhanced surface image of the hypotube is then detected using an artificial neural network to achieve tube wall defect detection for hypotube processing.
[0008] The present invention dynamically adjusts the filter kernel size according to the texture complexity and position importance of the reference area where the target pixel is located, so that the over-smoothing phenomenon can be reduced when processing simple texture areas, thereby effectively improving the detection accuracy of cracks and defects; the information entropy value and grayscale difference of the reference area of the target pixel are used to calculate the filtering requirement, so that the appropriate Gaussian kernel side length can be adaptively selected during the processing process, avoiding the limitations brought by the fixed filtering parameters in the traditional method; edge information in the surface image is obtained through edge detection, which further enhances the visibility of cracks and other defect features, and helps the subsequent detection system to effectively identify the wall defects of the hypotube; after image enhancement, artificial neural networks are used for further detection, which can fully utilize the powerful feature extraction and pattern recognition capabilities of the deep learning model to improve the accuracy and robustness of tube wall defect detection.
[0009] Furthermore, the grayscale value is obtained by grayscale processing the surface image of the hypotube.
[0010] Furthermore, the texture complexity satisfies: Where, For the The texture complexity of the reference area of pixels, For the The information entropy value of the grayscale value of the pixel in the reference area of the pixel, For the The number of pixels in the reference area of pixels, For the The reference area of the pixel The sum of the differences in grayscale values between a pixel and the pixels in its neighborhood.
[0011] By introducing the information entropy value, the present invention can effectively quantify the complexity of the grayscale distribution in the reference area of the target pixel point. Combined with the sum of the differences in the grayscale values of each pixel point in the reference area and the pixels in the neighborhood area, it more comprehensively reflects the diversity and complexity of the texture. The calculation of texture complexity not only depends on the uniformity of the grayscale value distribution, but also takes into account the differences between adjacent pixels, providing a more accurate assessment for areas with more complex backgrounds.
[0012] Furthermore, the edge detection uses the Canny operator.
[0013] Furthermore, the edge detection uses a Laplacian operator.
[0014] Furthermore, the gradient direction value and the gradient direction are obtained by using a Sobel operator.
[0015] The present invention obtains the gradient direction value and gradient direction through the Sobel operator. The Sobel operator is an efficient edge detection method that can quickly calculate the gradient amplitude and direction of pixel points in an image. The Sobel operator is simple to implement. By applying convolution kernels in the horizontal and vertical directions respectively, it can quickly process images and obtain edge information. In practical applications, it can efficiently perform real-time monitoring and data processing.
[0016] Furthermore, the location importance satisfies: Where, For the The position importance of the reference area of the pixel point, For the The number of edge pixels within the reference area of pixels, For the The number of edge pixels corresponding to the mode value of the gradient direction value of the edge pixels in the reference area of the pixel points. For the The mean grayscale value of the pixel points on the side pointed by the gradient direction of the edge pixel points in the reference area of the pixel points, is the natural exponential function.
[0017] By combining the number of edge pixels and the number of edge pixels corresponding to the mode value, the present invention can effectively quantify the significance of edge features in the reference area, ensuring that in image processing, the position importance can better reflect the actual importance of the edge position, making the positioning of the target pixel more accurate; by utilizing the natural exponential function, the influence of the grayscale mean on the side indicated by the edge direction can be introduced, and the position importance can be dynamically adjusted to ensure that the area with a higher grayscale value in the edge direction will have a lower position importance, so that the algorithm can adaptively optimize the processing strategy according to the local image features.
[0018] Furthermore, the filtering requirement satisfies: Where, For the The filtering requirement of each pixel is For the The texture complexity of the reference area of pixels, For the The position importance of the reference area of the pixel point, is the natural exponential function.
[0019] The filtering requirement of the present invention takes into account the texture complexity and position importance of the reference area, and reflects the comprehensive filtering requirements of the regional characteristics by multiplication, ensuring that the processing process has a more flexible and accurate response to different situations; the use of the natural exponential function means that the filtering requirement will be dynamically adjusted with the changes in texture complexity and position importance. If the texture complexity or position importance of a certain area is high, the corresponding filtering requirement will be significantly reduced, so that the relevant area will receive less smoothing processing, thereby retaining more texture and detail information.
[0020] Furthermore, the artificial neural network adopts a CNN deep learning model.
[0021] In a second aspect, the present invention provides a tube wall defect detection system for hypotube processing, which adopts the following technical solution:
[0022] A tube wall defect detection system for hypotube processing includes: a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the above-mentioned tube wall defect detection method for hypotube processing is implemented.
[0023] By adopting the above technical solution, the above-mentioned tube wall defect detection method for sea wave tube processing is generated into a computer program and stored in a memory to be loaded and executed by a processor, thereby making a terminal device based on the memory and the processor for easy use.
[0024] The present invention has the following technical effects:
[0025] (1) In order to solve the problem of over-smoothing of the area with simple texture but prone to crack defects due to the fixed Gaussian kernel size when the single-scale Retinex algorithm is used for sea wave tube surface image enhancement, a method of determining the filtering requirement according to texture complexity and position importance is introduced to correct the Gaussian kernel side length; over-smoothing caused by using the same size Gaussian kernel for different feature areas is avoided, so that when processing areas prone to crack defects, details can be better preserved and crack information will not be lost due to over-smoothing, thereby improving the integrity of crack detection and the accuracy of tube wall defect detection.
[0026] (2) Edge detection is used to obtain edge pixels, and the position importance is determined by combining the number of edge pixels in the reference area of the target pixel, the number of edge pixels corresponding to the mode value in the gradient direction value of the edge pixel, and the mean grayscale value of the pixel on the side indicated by the gradient direction of the edge pixel. The filtering requirement is determined based on the texture complexity, so that the Gaussian kernel size can be adjusted more reasonably. This allows the key information related to the hypotube wall defects to be better retained when the surface image is enhanced, providing more accurate and clear image information for the subsequent artificial neural network to detect the enhanced image, and ultimately improving the accuracy of hypotube wall defect detection.
[0027] (3) The Gaussian kernel size can be dynamically adjusted according to the characteristics of different areas of the hypotube surface image (texture complexity and position importance). It has strong adaptability and can better process image areas with different characteristics, thereby improving the processing effect of the hypotube surface image and thus improving the performance of the entire tube wall defect detection system. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 This is a flow chart of a method for detecting tube wall defects in hypotube processing according to an embodiment of the present invention. DETAILED DESCRIPTION
[0029] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work shall fall within the scope of protection of the present invention.
[0030] The embodiment of the present invention discloses a method for detecting tube wall defects in hypotube processing, referring to Figure 1 , including steps S1 to S7:
[0031] S1: Obtain the grayscale value of the pixel point in the surface image of the hypotube.
[0032] It should be noted that the present invention uses a high-definition camera to collect the surface image of the hypotube.
[0033] Specifically, the grayscale value is obtained by grayscale processing the surface image of the hypotube.
[0034] S2: For a target pixel point among the pixels in the surface image, determine the texture complexity of a reference area of the target pixel point.
[0035] It should be noted that by analyzing the grayscale value characteristics within the reference area of each pixel point, the texture complexity within the reference area of each pixel point is obtained. The purpose of analyzing the texture complexity is to optimize the Gaussian kernel size of the local illumination estimation of each pixel point based on the texture complexity. When analyzing the texture complexity of the reference area of the pixel point, the greater the information entropy value of the grayscale values of all pixels within the reference area of the pixel point, the greater its texture complexity.
[0036] The texture complexity of the reference area of the target pixel is determined based on the information entropy of the grayscale values of the pixels in the reference area of the target pixel and the sum of the differences in the grayscale values of each pixel in the reference area of the target pixel and the pixels in the neighborhood.
[0037] Implementers can set the size of the reference area based on the specific implementation situation. For example, with the target pixel as the center, pixels within a 9×9 range and the target pixel itself are selected to form the reference area of the target pixel; if the pixels on one side of the target pixel are less than the preset range, pixels on the other side are selected to supplement the range.
[0038] Specifically, the texture complexity satisfies:
[0039] ;
[0040] Where, For the The texture complexity of the reference area of pixels, For the The information entropy value of the grayscale value of the pixel in the reference area of the pixel, For the The number of pixels in the reference area of pixels, For the The reference area of the pixel The sum of the differences in grayscale values between a pixel and the pixels in its neighborhood.
[0041] in, The larger the The more inconsistent the grayscale values of all pixels in the reference area of the first pixel are, the The more textures there are in the reference area of the pixel, the more The greater the texture complexity within the reference area of each pixel, the greater the texture complexity will be; The larger the The more obvious the gray value changes of all pixels in the reference area of the pixel, the The greater the information entropy value of the grayscale values of all pixels in the reference area of the pixel, the greater the credibility will be. The texture complexity of the reference area will be greater if the number of pixels is greater.
[0042] S3: Use edge detection to identify the surface image and obtain all edge pixels in the surface image.
[0043] It should be noted that when using the Canny operator for edge detection, the advantage is that it can provide low error rate, precise positioning and single-pixel edge response. It can effectively reduce false edges while accurately determining the position of the real edge, and can also locate the edge to single-pixel accuracy.
[0044] Specifically, the edge detection uses the Canny operator.
[0045] It should be noted that when using the Laplacian operator for edge detection, the advantage is that the Laplacian operator is an isotropic second-order derivative operator that is rotationally invariant to the edges in the image and can detect image edges quickly and without direction preference without considering the edge direction.
[0046] Specifically, the edge detection adopts the Laplacian operator.
[0047] S4: Determine the position importance of the reference area of the target pixel.
[0048] It should be noted that after obtaining the texture complexity of the reference area of each pixel point, when optimizing the Gaussian kernel, some areas with simple textures but more prone to crack defects may be missed. These areas may eventually be over-smoothed, making it difficult to accurately and completely detect all potential crack defects. Among them, the connection parts of the hypotube are often high-incidence areas of cracks, especially after multiple connections, disassembly or installation, the sealing or strength of the joints may be affected, leading to crack formation. Long-term stress accumulation or improper use may cause damage to these areas. The texture of the hypotube interface is usually relatively simple because the hypotube interface is mainly composed of metal surface. The surface may be relatively smooth and may show traces of connecting gaps, so its texture complexity is relatively low. Therefore, in this step, it is necessary to obtain the position importance of the reference area of each pixel point. Since the gaps at the connection of the hypotube usually have a relatively uniform gradient direction, the more consistent the gradient direction of the edge pixels in the reference area of a pixel point, the more likely the reference area of the pixel point belongs to the connection part, and the corresponding position importance is greater. At the same time, considering the insufficient light at the gap, the lower the grayscale mean of the pixels on the side indicated by the gradient direction of the edge pixels in the reference area of a pixel point, the more likely the reference area of the pixel point belongs to the connection part, and the greater the position importance.
[0049] The position importance of the reference area of the target pixel point is determined based on the number of edge pixels in the reference area of the target pixel point, the number of edge pixels corresponding to the mode value in the gradient direction value of the edge pixel point, and the mean grayscale value of the pixel points on the side indicated by the gradient direction of the edge pixel point.
[0050] Specifically, the gradient direction value and the gradient direction are obtained by using a Sobel operator.
[0051] Specifically, the location importance satisfies:
[0052] ;
[0053] Where, For the The position importance of the reference area of the pixel point, For the The number of edge pixels within the reference area of pixels, For the The number of edge pixels corresponding to the mode value of the gradient direction value of the edge pixels in the reference area of the pixel points. For the The mean grayscale value of the pixel points on the side pointed by the gradient direction of the edge pixel points in the reference area of the pixel points, is the natural exponential function.
[0054] in, The larger the The more consistent the gradient direction of the edge pixels in the reference area of the first pixel, the The more likely the reference area of a pixel point is to belong to a connection part, the greater the importance of the corresponding position; The smaller the The lower the mean gray value of the pixels on the side pointed by the gradient direction of the edge pixels in the reference area of the pixel points, the lower the gray value of the pixels on the side pointed by the gradient direction of the edge pixels in the reference area of the pixel points. The greater the possibility that the reference area of a pixel belongs to a connection part, the greater the position importance.
[0055] S5: Determine the filtering requirement of the target pixel.
[0056] It should be noted that after determining the positional importance of the reference area of each pixel, the filtering requirement of each pixel is obtained in combination with the texture complexity of the reference area of each pixel; in order to retain more detailed information at the connection, the greater the positional importance, the smaller the corresponding filtering requirement should be; it should be specially noted that if there is no edge pixel in the reference area of a pixel, then the negative correlation mapping of the texture complexity in the reference area of the pixel is used as the filtering requirement of the pixel.
[0057] The filtering requirement of the target pixel is determined according to the texture complexity and the position importance.
[0058] Specifically, the filtering requirement satisfies:
[0059] ;
[0060] Where, For the The filtering requirement of each pixel is For the The texture complexity of the reference area of pixels, For the The position importance of the reference area of the pixel point, is the natural exponential function.
[0061] in, The larger the The more complex the texture changes in the reference area of the pixel point, the The pixel needs a smaller degree of filtering to retain more detail information, so the The smaller the filtering requirement for each pixel, The larger the The more likely the reference area of a pixel is to belong to a connection part, the The pixels should also require a smaller degree of filtering to retain more detail information, then the The smaller the number of pixels, the less filtering is required.
[0062] S6: Obtain the modified Gaussian kernel side length of the target pixel.
[0063] It should be noted that after obtaining the filtering requirement of each pixel point, the size of the Gaussian kernel in the local illumination estimation will be determined based on the filtering requirement of each pixel point; among them, the smaller the filtering requirement of a pixel point, the more complex the texture change between the pixel point and its reference area, and the more important the position of the pixel point and its reference area, the smaller the filtering is required to retain more detail information, so the corresponding Gaussian kernel should be smaller; the greater the filtering requirement of a pixel point, the simpler the texture is and the less important the position is in the pixel point and its reference area, the pixel point will require a greater degree of filtering, thereby more effectively separating the illumination component and the reflection component in the image, so the corresponding Gaussian kernel should be larger. Since the key to Gaussian filtering lies in the symmetry of weight distribution, that is, the weight of each pixel is calculated based on its distance from the center pixel, the value of the Gaussian kernel side length is often an odd number. Therefore, for each pixel point, the Gaussian kernel side length (the product of the filtering requirement of the pixel point and the initial Gaussian kernel side length) is initially optimized during local illumination estimation. The value of the side length is rounded to the nearest odd value to obtain the corrected Gaussian kernel side length of the pixel point.
[0064] The odd value of the product of the filtering requirement and the initial Gaussian kernel side length is rounded to an integer, and the result is used as the modified Gaussian kernel side length of the target pixel.
[0065] S7: Use the single-scale Retinex algorithm to enhance the surface image, and then use the artificial neural network to detect the enhanced surface image.
[0066] It should be noted that through the analysis of the above steps, the corresponding local illumination estimation is optimized when each pixel is enhanced using the single-scale Retinex algorithm. The optimized single-scale Retinex algorithm is then used to enhance the surface image of the hypotube. Finally, the enhanced surface image is detected using an artificial neural network. If cracks are found, relevant personnel need to be notified in a timely manner for replacement or repair, thus completing the tube wall defect detection for hypotube processing.
[0067] Based on the modified Gaussian kernel side length, the surface image is enhanced using a single-scale Retinex algorithm, and then the enhanced surface image of the hypotube is detected using an artificial neural network to achieve tube wall defect detection for hypotube processing.
[0068] Specifically, the artificial neural network adopts a CNN deep learning model.
[0069] An embodiment of the present invention also discloses a tube wall defect detection system for hypotube processing, comprising a processor and a memory, wherein the memory stores computer program instructions. When the computer program instructions are executed by the processor, a tube wall defect detection method for hypotube processing according to the present invention is implemented.
[0070] The above system also includes other components well known to those skilled in the art, such as a communication bus and a communication interface. The configuration and functions of these components are known in the art and will not be described in detail here.
[0071] The above are all preferred embodiments of the present invention, and are not intended to limit the scope of protection of the present invention. Therefore, any equivalent changes made based on the structure, shape, and principle of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for detecting tube wall defects in hypotube processing, characterized in that: include: Obtain the grayscale value of the pixel in the surface image of the hypotube; For a target pixel in the surface image, the texture complexity of the reference area of the target pixel is determined based on the information entropy of the grayscale values of the pixels in the reference area of the target pixel and the sum of the differences between the grayscale values of each pixel in the reference area of the target pixel and the pixels in the neighborhood. Use edge detection to identify the surface image and obtain all edge pixels in the surface image; Determine the position importance of the reference area of the target pixel based on the number of edge pixels in the reference area of the target pixel, the number of edge pixels corresponding to the mode value of the gradient direction value of the edge pixel, and the average grayscale value of the pixels on the side indicated by the gradient direction of the edge pixel; Determining the filtering requirement of the target pixel point based on the texture complexity and position importance includes: Where, For the The filtering requirement of each pixel is For the The texture complexity of the reference area of pixels, For the The position importance of the reference area of the pixel point, is the natural exponential function; The result of rounding the odd value of the product of the filtering requirement and the initial Gaussian kernel side length is used as the modified Gaussian kernel side length of the target pixel; Based on the modified Gaussian kernel side length, the surface image is enhanced using a single-scale Retinex algorithm, and then the enhanced surface image of the hypotube is detected using an artificial neural network to achieve tube wall defect detection for hypotube processing.
2. A method for detecting tube wall defects in hypotube processing according to claim 1, characterized in that: The grayscale value is obtained by grayscale processing the surface image of the hypotube.
3. The method for detecting tube wall defects in hypotube processing according to claim 1, characterized in that: The texture complexity satisfies: ; Where, For the The texture complexity of the reference area of pixels, For the The information entropy value of the grayscale value of the pixel in the reference area of the pixel, For the The number of pixels in the reference area of pixels, For the The reference area of the pixel The sum of the differences in grayscale values between a pixel and the pixels in its neighborhood.
4. The method for detecting tube wall defects in hypotube processing according to claim 1, characterized in that: The edge detection uses the Canny operator.
5. The method for detecting tube wall defects in hypotube processing according to claim 1, characterized in that: The edge detection adopts the Laplacian operator.
6. The method for detecting tube wall defects in hypotube processing according to claim 1, characterized in that: The gradient direction value and the gradient direction are obtained using a Sobel operator.
7. The method for detecting tube wall defects in hypotube processing according to claim 1, characterized in that: The position importance satisfies: ; Where, For the The position importance of the reference area of the pixel point, For the The number of edge pixels within the reference area of pixels, For the The number of edge pixels corresponding to the mode value of the gradient direction value of the edge pixels in the reference area of the pixel points. For the The mean grayscale value of the pixel points on the side pointed by the gradient direction of the edge pixel points in the reference area of the pixel points, is the natural exponential function.
8. The method for detecting tube wall defects in hypotube processing according to claim 1, characterized in that: The artificial neural network adopts a CNN deep learning model.
9. A tube wall defect detection system for hypotube processing, characterized in that: include: A processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, a tube wall defect detection method for hypotube processing according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Automobile circular trailer hole gas mark defect detection method based on machine vision
CN116012357A
Image enhancement method for slashing state detection
CN118822869A