Titanium cylinder inner wall defect detection method and system

By dynamically adjusting the standard deviation of the Gaussian kernel during the inspection of the inner wall of a titanium cylinder, and using threshold segmentation and morphological processing to accurately locate the highlight region, the problem of dynamic changes in the highlight region during the inspection of the inner wall of a titanium cylinder using the multi-scale Retinex algorithm was solved. This effectively suppressed highlight interference and revealed minute defects, improving the accuracy and reliability of the inspection.

CN121305312BActive Publication Date: 2026-03-24BAOSE SPECIAL EQUIP
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-15
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

Existing multi-scale Retinex image enhancement algorithms cannot adapt to the dynamic changes in the highlight area when inspecting the inner wall of titanium cylinders. This causes the highlight area to obscure defect information or produce halo artifacts, affecting the accuracy of detection.

Method used

By accurately locating highlight regions and their boundaries through threshold segmentation and morphological processing, calculating the scale adjustment factor, dynamically adjusting the standard deviation of the Gaussian kernel, constructing a multi-scale Gaussian kernel function for convolution operations, enhancing the image, and performing threshold segmentation to identify defects.

Benefits of technology

It effectively suppresses high-light interference, significantly improves the accuracy and robustness of defect detection on the inner wall of titanium cylinders, solves the problems of high-light masking defects and halo artifacts, and improves the accuracy and reliability of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121305312B_ABST
    Figure CN121305312B_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of image processing, and particularly relates to a titanium cylinder inner wall defect detection method and system, which comprises the following steps: collecting a titanium cylinder inner wall image, extracting a highlight area and its boundary pixel points through threshold segmentation and corrosion operation; combining the highlight area proportion and the boundary gradient amplitude to calculate a scale adjustment factor, dynamically scaling a reference kernel according to the scale adjustment factor, and determining the standard deviation of a multi-scale Gaussian kernel; constructing a Gaussian kernel function of each scale, calculating the sum of the difference values of the convolution results of the titanium cylinder inner wall image and all scales in the logarithmic domain, and obtaining an enhanced titanium cylinder inner wall image; and performing threshold segmentation on the enhanced titanium cylinder inner wall image to identify a defect area. The application can effectively suppress mirror reflection interference and eliminate halo artifacts by adaptively adjusting the filtering scale, and accurately identify small defects hidden by highlights.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology. More specifically, this invention relates to a method and system for detecting defects in the inner wall of a titanium cylinder. Background Technology

[0002] As a key component in manufacturing fields such as aerospace and precision chemicals, the surface quality of the inner wall of titanium cylinders is crucial to the safety and reliability of the entire system. Currently, using machine vision technology to automatically inspect the inner wall of titanium cylinders is a key step in ensuring their quality. However, during the inspection process, because the inner wall of titanium cylinders is a smooth metal curved surface, specular reflection is easily formed during image acquisition, resulting in large areas of local overexposure in the acquired images. These highlighted areas can obscure the tiny cracks, scratches, and other defects underneath, seriously affecting the accuracy of defect identification.

[0003] To address the aforementioned local overexposure problem, the multi-scale Retinex image enhancement algorithm is typically employed. The core idea of ​​this algorithm is to decompose the image into an illumination component that reflects the lighting conditions and a reflection component that represents the essential features of the object. By suppressing the illumination component, the reflection component is enhanced, thereby highlighting the details of defects.

[0004] However, the performance of this algorithm depends on a set of preset, fixed Gaussian filter scale parameters. Considering the curvature differences of titanium cylinders of different specifications and the diversity of defect morphology, the size, shape and intensity of the highlight area in the image are all dynamically changing. If a fixed filter scale is used, when the highlight area is large, a smaller scale cannot effectively suppress it; while when the highlight area is small or rich in detail, a larger scale will over-smooth the image, causing the loss of small defect information or the generation of halo artifacts at the light and dark boundaries, thus affecting product quality. Summary of the Invention

[0005] To address the technical problem that the multi-scale Retinex image enhancement algorithm, which relies on fixed scale parameters, cannot adapt to the dynamic changes in the highlight area of ​​the inner wall of a titanium cylinder, this invention provides solutions in the following aspects.

[0006] In a first aspect, the present invention provides a method for detecting defects in the inner wall of a titanium cylinder, comprising: acquiring an image of the inner wall of a titanium cylinder and performing threshold segmentation to obtain a binary image, wherein white pixels in the binary image are pixels in the highlight region; performing an erosion operation on the binary image to obtain an eroded image; performing a subtraction operation between the binary image and the eroded image to obtain a boundary binary image and extracting white pixels as boundary pixels of the highlight region; determining a scale adjustment factor based on the average gradient magnitude of the boundary pixels and the ratio of the number of all pixels in the highlight region to the number of all pixels in the inner wall image of the titanium cylinder; dynamically scaling the standard deviation of the reference kernel according to the scale adjustment factor to determine the standard deviation of the Gaussian kernel at multiple scales; constructing a Gaussian kernel function for each scale based on the standard deviation of the Gaussian kernel at each scale; performing a convolution operation on the inner wall image of the titanium cylinder based on the Gaussian kernel function at each scale, calculating the sum of the differences between the inner wall image of the titanium cylinder and the convolution results of all scales in the logarithmic domain to obtain an enhanced inner wall image of the titanium cylinder; performing threshold segmentation on the enhanced inner wall image of the titanium cylinder to identify the region where the white pixels are located as the defect region of the inner wall of the titanium cylinder.

[0007] This invention uses threshold segmentation and morphological processing on images of the inner wall of a titanium cylinder to accurately locate the highlight region and its boundary, and calculates the scale adjustment factor accordingly, achieving adaptive dynamic adjustment of the standard deviation of the Gaussian kernel at multiple scales. Compared with traditional fixed-parameter algorithms, this invention can construct a filter scale differently based on the size and edge sharpness of the highlight region, and perform convolution enhancement in the logarithmic domain. It can effectively suppress wide-area specular reflection interference using a large-scale kernel, and can also keenly capture faint crack details under strong light using a small-scale kernel. This method effectively solves the problems of highlight masking defects and halo artifacts generated by traditional algorithms, and significantly improves the accuracy and robustness of titanium cylinder inner wall defect detection.

[0008] Preferably, the threshold segmentation is performed using the Otsu threshold segmentation algorithm.

[0009] Preferably, performing the erosion operation on the binary image to obtain an eroded image includes: using... The morphological structuring elements are used to perform morphological erosion operations on the binary image to obtain an eroded image.

[0010] Preferably, the scale adjustment factor satisfies the expression: In the formula, This is the scaling adjustment factor; This is the ratio of the number of pixels in the highlight region to the number of pixels in the image of the inner wall of the titanium cylinder; The first in the highlight area Gradient magnitude of each boundary pixel; This represents the index and total number of boundary pixels in the highlight region.

[0011] This invention integrates the breadth of the highlight region distribution and the variation of the gradient magnitude at the highlight region boundary to assess the severity of the interference of highlights on the inner wall image of the titanium cylinder, providing reliable data support for the dynamic allocation of subsequent filtering scales.

[0012] Preferably, the step of dynamically scaling the standard deviation of the benchmark kernel according to the scale adjustment factor to determine the standard deviation of the multi-scale Gaussian kernel includes: designating small, medium, and large scales as the 1st, 2nd, and 3rd scales, respectively; the standard deviation of the multi-scale Gaussian kernel is: In the formula, The standard deviations of the Gaussian kernels at small, medium, and large scales; The standard deviation of the benchmark kernel; This is the scaling adjustment factor.

[0013] This invention utilizes a scale adjustment factor to dynamically scale the reference kernel. When specular interference is severe, by increasing the scale spacing, the large-scale kernel can suppress wide-band specular interference, while the small-scale kernel can retain high-frequency defect characteristics. This dynamic bandwidth expansion strategy achieves adaptive decoupling in complex lighting environments and avoids loss of detail.

[0014] Preferably, constructing the Gaussian kernel function for each scale based on the standard deviation of the Gaussian kernel includes: calculating the window size of the convolution kernel for each scale. , ,in, For the first The standard deviation of the Gaussian kernel on each scale This is the rounding sign; and it retrieves the range of values ​​for the coordinates within the convolution kernel. Substitute the range of coordinate values ​​and the standard deviation of the Gaussian kernel at that scale into the Gaussian function formula to calculate the weight value at each position within the convolution kernel; perform sum-normalization on the generated weight matrix to obtain the Gaussian kernel function at that scale.

[0015] This invention determines the size of the convolution kernel window based on principles and constrains it to be an odd number, ensuring the geometric symmetry and center alignment of the convolution kernel, thus guaranteeing the accuracy of the filtering operation. At the same time, by performing sum-normalization on the weight matrix, it ensures that the sum of all elements is 1, ensuring the overall energy conservation of the image before and after filtering and avoiding the introduction of additional brightness deviations by the convolution operation.

[0016] Preferably, the enhanced inner wall image of the titanium cylinder satisfies the expression: In the formula, Image of the enhanced inner wall of the titanium cylinder; This is a grayscale image of the inner wall of the titanium cylinder. For the first Gaussian kernel function of scale; The index value and total number of the scale; It is a logarithmic function; This is the convolution operator.

[0017] This invention utilizes logarithmic transformation to convert multiplication into addition, and achieves effective separation of illumination and texture by subtracting the illumination field fitted by multi-scale convolution. Furthermore, by averaging the results at each scale, it balances the ability of small scales to enhance details with the ability of large scales to preserve overall brightness, making the background brightness of the image uniform and significantly highlighting the crack defects that were originally submerged.

[0018] Preferably, the method further includes: counting the number of pixels in the defective area; if the number exceeds a preset number, the titanium cylinder is marked as a defective product.

[0019] Preferably, the method further includes: using the Sobel operator to calculate the gradient magnitude of each pixel in the image of the inner wall of the titanium cylinder.

[0020] Secondly, the present invention provides a titanium cylinder inner wall defect detection system, including 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 titanium cylinder inner wall defect detection method is implemented.

[0021] By adopting the above technical solution, a computer program for detecting defects in the inner wall of a titanium cylinder is generated and stored in a memory so that it can be loaded and executed by a processor. A terminal device can then be made based on the memory and the processor for convenient use.

[0022] The beneficial effects of this invention are as follows:

[0023] (1) This invention addresses the differences in highlight morphology caused by different curvatures of titanium cylinders of different specifications. By analyzing image features in real time, it automatically generates filtering parameters, overcoming the limitation of the traditional Retinex algorithm which relies on manually preset fixed scales. It can adaptively handle a variety of complex working conditions, from sharp highlights in small diameters to diffuse highlights in large diameters.

[0024] (2) By introducing the boundary gradient magnitude into the scale calculation, the present invention dynamically adjusts the smoothness at the edge of the highlight, effectively solving the problem that traditional algorithms are prone to producing halo artifacts at the junction of light and dark, avoiding artifacts being misjudged as defects by subsequent threshold segmentation algorithms, and greatly reducing the false detection rate.

[0025] (3) The present invention adopts a dynamic frequency band expansion strategy. While suppressing the highlights, it uses the reduced small-scale kernel to refine the image, successfully recovering the high-frequency details such as micron-level cracks and scratches that were covered by strong light, and solving the technical problem of difficult identification of defects in highly reflective metal curved surfaces. Attached Figure Description

[0026] Figure 1This is a flowchart illustrating a method for detecting defects in the inner wall of a titanium cylinder according to the present invention. Detailed Implementation

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

[0028] The specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.

[0029] This invention discloses a method for detecting defects in the inner wall of a titanium cylinder, referring to... Figure 1 This includes steps S1 to S5:

[0030] S1. Acquire an image of the inner wall of the titanium cylinder and perform threshold segmentation to obtain a binary image. The white pixels in the binary image are the pixels in the highlight area.

[0031] It should be noted that during the detection of the inner wall of the titanium cylinder, the specular reflection formed by the light source on the smooth curved surface is an unavoidable source of interference. In order to adjust the algorithm parameters in a targeted manner, it is necessary to accurately locate these interference areas first. Considering that the gray values ​​of the local overexposed areas are too bright, which will significantly distinguish the gray values ​​of the background area of ​​the titanium cylinder, the Otsu threshold segmentation algorithm can be used to quickly separate the overexposed areas with extremely high brightness. These areas are the basis for subsequent analysis.

[0032] Specifically, a lifting device is installed in the inspection area of ​​the inner wall of the titanium cylinder. A field array camera and a coaxial ring light source are deployed above the device. When the titanium cylinder to be inspected is transported to the inspection area, the lifting device is adjusted to a position parallel to the center plane of the inner wall of the titanium cylinder, and the image of the inner wall of the titanium cylinder is acquired. The acquired image of the inner wall of the titanium cylinder is then processed into grayscale to obtain the grayscale value of each pixel. The gradient magnitude of each pixel is calculated using the Sobel operator.

[0033] The Otsu threshold segmentation algorithm was further used to segment the obtained titanium cylinder inner wall image to obtain a binary image, in which white pixels are highlight pixels and black pixels are background pixels.

[0034] At this point, the highlight area of ​​the inner wall of the titanium cylinder has been obtained.

[0035] S2. Perform an erosion operation on the binary image to obtain an eroded image. Perform a subtraction operation between the binary image and the eroded image to obtain a boundary binary image and extract white pixels as boundary pixels of the highlight region. Determine the scale adjustment factor based on the average gradient magnitude of the boundary pixels and the ratio of the number of all pixels in the highlight region to the number of all pixels in the titanium cylinder inner wall image.

[0036] It should be noted that in actual testing production lines, the system needs to handle the testing of titanium cylinders of different specifications and models. Since the inner wall of the titanium cylinder is a highly reflective metallic curved surface, its light reflection characteristics are highly related to the curvature of the inner wall. Different specifications of titanium cylinders mean different radii of curvature. For example, small-diameter titanium cylinders may form narrow and sharp highlight bands, while large-diameter titanium cylinders may form wide and diffuse overexposed areas. If a fixed filtering scale is used for smoothing, it is impossible to take into account the diversity of highlight morphology at the same time, resulting in severe edge artifacts or loss of details, which affects the accuracy of subsequent defect identification. Therefore, it is necessary to analyze the severity of the interference of highlights on the inner wall image of the titanium cylinder, so as to provide data support for the subsequent generation of filtering parameters.

[0037] Specifically, considering that the more drastic the actual illumination change, the more significant the gradient change of the boundary pixels in the corresponding highlight region, it is necessary to extract the boundary pixels of the highlight region to assess the severity of the illumination change. Taking into account the idea of ​​shrinking pixels in morphological erosion processing, for example, using... By sliding the matrix on the image, the image can be shrunk inward by one pixel. Furthermore, by subtracting the images before and after erosion, a boundary binary map can be obtained. Therefore, boundary pixels can be identified by morphological processing.

[0038] Extracting the boundary pixels of the highlight region involves the following steps: using The morphological structuring elements are used to perform morphological erosion on the binary image to obtain an eroded image; the eroded image is then subtracted from the binary image to obtain a boundary binary image of the highlight region, in which the white pixels are the boundary pixels of the highlight region.

[0039] The scale adjustment factor is determined based on the ratio of the number of pixels in the highlight region to the number of pixels in the image of the inner wall of the titanium cylinder, and the average gradient magnitude of the boundary pixels in the highlight region; the scale adjustment factor satisfies the expression:

[0040]

[0041] In the formula, This is the scaling adjustment factor; This is the ratio of the number of pixels in the highlight region to the number of pixels in the image of the inner wall of the titanium cylinder; The first in the highlight area Gradient magnitude of each boundary pixel; This represents the index and total number of boundary pixels in the highlight region.

[0042] in, This reflects the proportion of the highlight area in the current image of the inner wall of the titanium cylinder. The larger this value is, the wider the range of overexposed areas in the current image of the inner wall of the titanium cylinder. This means that the spatial distribution span of the illumination component is larger. Therefore, a larger filtering scale is needed to ensure that the Gaussian kernel can cover the entire highlight area and prevent the highlight center from being misjudged as the surface texture of the object due to the scale being too small and thus unable to be removed. This value reflects the sharpness of the highlight region boundaries in the current image of the titanium cylinder's inner wall. A larger value indicates a more drastic change in illumination within the image, with strong step signals forming at the highlight edges. If the filtering scale is insufficient, halo artifacts are easily generated at the boundary between light and dark areas. Therefore, the scale needs to be increased to enhance the smoothing ability of the edges and ensure a natural transition of the illumination components. Here, 1 is a baseline scale adjustment factor used to ensure that the algorithm maintains the preset baseline filtering performance when there is no highlight interference. A value of 0 indicates that no boundary points were extracted from the image, meaning there is no specular interference. In this case, let... Take 0.

[0043] Thus, the scale adjustment factor has been obtained.

[0044] S3. Dynamically scale the standard deviation of the benchmark kernel according to the scaling adjustment factor to determine the standard deviation of the multi-scale Gaussian kernel.

[0045] It should be noted that since defects may be masked in the exposed areas, accurate estimation of the illumination components is necessary to process the exposed areas and ensure accurate defect identification. The core of the multi-scale Retinex image enhancement algorithm lies in estimating the illumination components through filtering at different scales, thereby enhancing image detail features. If traditional fixed scale parameters are used, if the Gaussian kernel scale is not large enough, it will not be able to completely cover and smooth out large areas of overexposed areas, leading to inaccurate illumination estimation. Conversely, if the scale is blindly increased overall in order to remove highlights, micron-level crack details will be over-smoothed, causing them to disappear from the image. Therefore, a dynamic bandwidth expansion strategy is proposed. When severe environmental interference is detected, i.e., when the scale adjustment factor is larger, the scale spacing between different Gaussian kernels must be dynamically increased. Larger scale kernels are made larger to completely suppress wide-area highlights, while smaller scale kernels are made smaller to sensitively capture weak edge details under strong light. This achieves adaptive decoupling for complex lighting environments and ensures optimal filtering results.

[0046] Specifically, small, medium, and large scales are designated as the 1st, 2nd, and 3rd scales, respectively. The standard deviation of the baseline kernel is dynamically scaled according to the scale adjustment factor to determine the standard deviation of the multi-scale Gaussian kernel. The standard deviation of the multi-scale Gaussian kernel satisfies the expression:

[0047]

[0048] In the formula, The standard deviations of the Gaussian kernels at small, medium, and large scales; The standard deviation of the benchmark kernel; This is the scaling adjustment factor.

[0049] For large-scale Gaussian kernels: when the detected highlight range is wider and the illumination change is more drastic, It will be significantly greater than 1. This ensures the filter has a sufficiently large receptive field to completely cover and smooth out large areas of specular reflection, constructing accurate background illumination components; for medium-scale Gaussian kernels: maintaining the standard deviation of the baseline kernel plays a smoothing role, preventing over-sharpening of the enhanced image; for small-scale Gaussian kernels: when When it is significantly greater than 1, the corresponding The smaller the value, the better the ability to capture local details. This ensures that while eliminating lighting, high-frequency defect features such as tiny cracks and scratches are preserved to the greatest extent possible, preventing the loss of details.

[0050] in, The standard deviation of the benchmark kernel is selected in this embodiment. Since common industrial production defects refer to high-frequency narrowband signals such as cracks or scratches, while changes in illumination are low-frequency wideband signals, according to the Gaussian function... in principle, The corresponding spatial filtering range is approximately 240 pixels in radius, which can effectively match the illumination reflection gradient of the curved inner wall of the titanium cylinder, and accurately separate the background light field from the foreground texture. This is the empirically optimal value.

[0051] At this point, the standard deviation of the Gaussian kernel at each scale has been obtained.

[0052] S4. Construct a Gaussian kernel function for each scale based on the standard deviation of the Gaussian kernel at each scale; perform convolution operation on the inner wall image of the titanium cylinder based on the Gaussian kernel function at each scale, calculate the sum of the differences between the inner wall image of the titanium cylinder and the convolution results of all scales in the logarithmic domain, and obtain the enhanced inner wall image of the titanium cylinder.

[0053] It should be noted that the core of the Retinex enhancement algorithm lies in the fact that the original image is the product of the illumination component and the reflection component (i.e., the surface texture of the object). Since the illumination component is usually a low-frequency smooth signal, and the standard deviation of the multi-scale Gaussian kernel in this scheme is adaptively generated based on the specular features, the corresponding Gaussian kernel function is constructed using these dynamic standard deviations. Convolution operation can accurately fit the complex and dynamically changing illumination field of the inner wall of the titanium cylinder. However, directly subtracting the illumination field from the original image cannot separate the variables. Therefore, logarithmic transformation is considered to transform the product relationship between the two into an addition and subtraction relationship, thereby achieving decoupling of illumination and reflection. By subtracting this accurately estimated illumination component from the original image in the logarithmic domain, the effects of uneven illumination and specular overexposure can be eliminated, thereby recovering an image containing only surface texture and defect information. This significantly enhances the tiny cracks that were originally submerged in specular highlights, and the background brightness tends to be uniform, providing high-quality input for subsequent segmentation.

[0054] It should be further explained that, based on the Gaussian distribution... In principle, 99.7% of the weighted energy is concentrated within three standard deviations of the mean, therefore... The effective radius is used as the radius; and to ensure that the convolution kernel is geometrically symmetric about the center point, twice the radius is used as the coverage diameter; at the same time, to ensure that the convolution kernel has a unique center for easy convolution alignment, 1 needs to be added to the even diameter to force the window size to be odd.

[0055] Specifically, the Gaussian kernel function is constructed for each scale. The construction method includes: calculating the window size of the convolution kernel for each scale. , ,in, For the first The standard deviation of the Gaussian kernel on each scale This is the rounding sign; and it retrieves the range of values ​​for the coordinates within the convolution kernel. Substitute the range of coordinate values ​​and the standard deviation of the Gaussian kernel at that scale into the Gaussian function formula to calculate the weight value at each position within the convolution kernel; perform sum-normalization on the generated weight matrix to obtain the Gaussian kernel function at that scale.

[0056] The normalization process is used to ensure that the sum of all elements in the weight matrix is ​​equal to 1, so as to ensure that the brightness change of the image before and after filtering is not obvious.

[0057] Convolution operations are performed on the grayscale image of the titanium cylinder's inner wall based on the Gaussian kernel function at each scale. The difference between the grayscale image of the titanium cylinder's inner wall and the convolution result in the logarithmic domain is calculated to determine the enhanced image of the titanium cylinder's inner wall. The enhanced image of the titanium cylinder's inner wall satisfies the expression:

[0058]

[0059] In the formula, Image of the enhanced inner wall of the titanium cylinder; This is a grayscale image of the inner wall of the titanium cylinder. For the first Gaussian kernel function of scale; The index value and total number of the scale; It is a logarithmic function; This is the convolution operator.

[0060] Among them, due to It is adaptively generated based on specular characteristics, and can fit the complex illumination field of the inner wall surface of the titanium cylinder at this scale. Therefore... Reflected in the The estimated distribution of illumination components at each scale; Reflecting removal in the first Detail component images under illumination effects at various scales are obtained by summing the detail component images at all scales and taking the average, resulting in an enhanced image of the titanium cylinder's inner wall. This approach balances the enhancement of details at small scales with the preservation of overall brightness at large scales, preventing overexposure or overexposure. Considering the importance of grayscale values ​​in digital image processing... The range of values ​​includes 0, when When, logarithmic function This is mathematically undefined, which would lead to calculation errors; therefore, adding 1 avoids this error.

[0061] At this point, an image of the enhanced inner wall of the titanium cylinder was obtained.

[0062] S5. Threshold segmentation is performed on the enhanced image of the inner wall of the titanium cylinder to identify the area where the white pixels are located as the defect area of ​​the inner wall of the titanium cylinder.

[0063] It should be noted that after the above adaptive enhancement processing, defects such as cracks and scratches that might have been covered by highlights are now clearly visible in the enhanced image of the inner wall of the titanium cylinder, and the background brightness tends to be uniform. At this point, known image segmentation processing methods can be used directly for defect identification.

[0064] Specifically, the enhanced image of the inner wall of the titanium cylinder is processed using the Otsu threshold segmentation algorithm to calculate the optimal segmentation threshold and convert the image into a binary image. In the binary image, the area where white pixels are located is the defect area, and the area where black pixels are located is the normal area, thereby accurately identifying the defect area of ​​the inner wall of the titanium cylinder.

[0065] The number of pixels in the defective area is counted. If the number exceeds a preset number, the titanium cylinder is marked as a defective product, and staff are prompted to conduct a review.

[0066] The preset threshold can be the number of pixels in the image that is the maximum acceptable defect as indicated by manual annotation. In this embodiment of the invention, it is set to 30, but it can be adjusted according to the actual accuracy requirements of the titanium cylinder application.

[0067] This invention also discloses a titanium cylinder inner wall defect detection system, including a processor and a memory. The memory stores computer program instructions, which, when executed by the processor, implement a titanium cylinder inner wall defect detection method according to the present invention.

[0068] The system also includes other components well known to those skilled in the art, such as communication buses and communication interfaces, the settings and functions of which are known in the art and will not be described in detail here.

Claims

1. A method for detecting defects in the inner wall of a titanium cylinder, characterized in that, include: Images of the inner wall of the titanium cylinder are acquired and threshold segmented to obtain a binary image, wherein white pixels in the binary image are pixels in the highlight area; Perform an erosion operation on the binary image to obtain an eroded image. Perform a subtraction operation between the binary image and the eroded image to obtain the boundary binary image and extract the white pixels as the boundary pixels of the highlight region. The scale adjustment factor is determined based on the average gradient magnitude of the boundary pixels and the ratio of the number of all pixels in the highlight region to the number of all pixels in the image of the inner wall of the titanium cylinder. The scaling factor satisfies the following expression: In the formula, This is the scaling adjustment factor; This is the ratio of the number of pixels in the highlight region to the number of pixels in the image of the inner wall of the titanium cylinder; The first in the highlight area Gradient magnitude of each boundary pixel; This represents the index and total number of boundary pixels in the highlight region; The standard deviation of the baseline kernel is dynamically scaled according to the scaling adjustment factor to determine the standard deviation of the Gaussian kernel at multiple scales; the Gaussian kernel function at each scale is constructed based on the standard deviation of the Gaussian kernel at each scale. The inner wall image of the titanium cylinder is convolved with the Gaussian kernel function at each scale. The sum of the differences between the inner wall image of the titanium cylinder and the convolution results at all scales in the logarithmic domain is calculated to obtain the enhanced inner wall image of the titanium cylinder. Threshold segmentation was performed on the enhanced image of the inner wall of the titanium cylinder to identify the areas where white pixels were located as defect areas on the inner wall of the titanium cylinder.

2. The method for detecting defects in the inner wall of a titanium cylinder according to claim 1, characterized in that, The threshold segmentation is performed using the Otsu threshold segmentation algorithm.

3. The method for detecting defects in the inner wall of a titanium cylinder according to claim 1, characterized in that, The step of performing an erosion operation on a binary image to obtain an eroded image includes: using... The morphological structuring elements are used to perform morphological erosion operations on the binary image to obtain an eroded image.

4. The method for detecting defects in the inner wall of a titanium cylinder according to claim 1, characterized in that, The step of dynamically scaling the standard deviation of the benchmark kernel according to the scaling adjustment factor to determine the standard deviation of the multi-scale Gaussian kernel includes: Let the small, medium, and large scales be denoted as the 1st, 2nd, and 3rd scales, respectively; the standard deviation of the multi-scale Gaussian kernel is: In the formula, The standard deviations of the Gaussian kernels at small, medium, and large scales; The standard deviation of the benchmark kernel; This is the scaling adjustment factor.

5. The method for detecting defects in the inner wall of a titanium cylinder according to claim 1, characterized in that, The construction of the Gaussian kernel function for each scale based on the standard deviation of the Gaussian kernel includes: For each scale, calculate the window size of the convolution kernel. , ,in, For the first The standard deviation of the Gaussian kernel on each scale This is the rounding sign; and it retrieves the range of values ​​for the coordinates within the convolution kernel. Substitute the range of coordinate values ​​and the standard deviation of the Gaussian kernel at that scale into the Gaussian function formula to calculate the weight value at each position within the convolution kernel; perform sum-normalization on the generated weight matrix to obtain the Gaussian kernel function at that scale.

6. The method for detecting defects in the inner wall of a titanium cylinder according to claim 1, characterized in that, The enhanced image of the inner wall of the titanium cylinder satisfies the expression: ; In the formula, Image of the enhanced inner wall of the titanium cylinder; This is a grayscale image of the inner wall of the titanium cylinder. For the first Gaussian kernel function of scale; The index value and total number of the scale; It is a logarithmic function; This is the convolution operator.

7. The method for detecting defects in the inner wall of a titanium cylinder according to claim 1, characterized in that, The method further includes: counting the number of pixels in the defective area; if the number exceeds a preset number, the titanium cylinder will be marked as a defective product.

8. The method for detecting defects in the inner wall of a titanium cylinder according to claim 1, characterized in that, The method further includes: using the Sobel operator to calculate the gradient magnitude of each pixel in the image of the inner wall of the titanium cylinder.

9. A defect detection system for the inner wall of a titanium cylinder, characterized in that, include: A processor and a memory, wherein the memory stores computer program instructions that, when executed by the processor, implement a method for detecting defects in the inner wall of a titanium cylinder according to any one of claims 1-8.

Citation Information

Patent Citations

  • Test paper surface texture defect detection method based on gray scale gradient clustering

    CN111179225A

  • Dynamic defect real-time detection system based on deep learning

    CN121120526A