An automotive shock absorber piston defect detection method, device and system
By collecting images from each angle within one week of the piston, analyzing the texture information regular factors to divide the area, and adaptively adjusting the sliding window step length, the problem of unbalanced accuracy and efficiency in the detection of piston defects is solved, and efficient and accurate piston defect detection is achieved.
Patent Information
- Application Number
- CN202510600582.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-12
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2045-05-12
AI Technical Summary
In the prior art, the template matching algorithm is difficult to find a balance between accuracy and efficiency in the detection of piston defects of automobile shock absorbers. If the step size is too small, the calculation amount will be large. If the step size is too large, the defect may be missed.
By collecting images from each angle within one week of the piston, analyzing the texture information regular factors in the sliding window, dividing smooth and rough areas, determining defective pixel points, combining template matching algorithms, adaptively adjusting the step length of the sliding window, and optimizing detection efficiency and accuracy.
It improves the comprehensive coverage ability of piston surface defect detection, enhances the refined detection of texture features, improves targeted detection of different surface states, overcomes misjudgment problems, and optimizes the balance of detection efficiency and accuracy.
Smart Images

Figure CN120125577B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of piston defect detection, and specifically relates to a method, device, and system for detecting piston defects in automotive shock absorbers. Background Art
[0002] The piston of an automotive shock absorber plays a crucial role in the shock absorber. It regulates the damping force by controlling the flow of fluid, reduces the vibrations caused by uneven road surfaces during vehicle driving, and improves the riding comfort and handling stability of the vehicle. Detecting defects in the piston of an automotive shock absorber can not only ensure the safety and comfort of the vehicle but also extend the service life of the shock absorber. Regular detection can promptly identify potential problems and prevent piston failures from affecting the normal operation of the shock absorber.
[0003] Template matching is a commonly used defect detection algorithm. It completes positioning and recognition by matching a predefined template with the image to be detected. When performing defect recognition, template matching can identify the differences in the image and thus detect defects in the piston. In template matching, the sliding window step size is a key parameter that affects the matching accuracy and calculation efficiency. The step size determines the speed at which the sliding window slides in the image, affecting the calculation amount and accuracy of the matching. If the step size is too small, it can provide higher matching accuracy but a large calculation amount, which cannot meet the efficiency requirements for real-time defect detection of piston products. If the step size is too large, it can accelerate the matching process but may result in missed detection of defects, reducing the defect detection accuracy. Summary of the Invention
[0004] To solve the above technical problems, the purpose of the present application is to provide a method, device, and system for detecting piston defects in automotive shock absorbers. The specific technical solutions adopted are as follows:
[0005] In a first aspect, an embodiment of the present application provides a method for detecting piston defects in automotive shock absorbers. The method includes the following steps:
[0006] Uniformly collect images of each angle of the piston of an automotive shock absorber within one week.
[0007] Analyze the gray-scale differences between adjacent pixel points within a preset sliding window of each image to determine the texture information regularity factor of each sliding window of each image; divide the piston surface area into a smooth area and a rough area based on the texture information regularity factor.
[0008] Determine the defect degree of each pixel point within each image through the gray-scale differences and position distributions between adjacent pixel points within each image; determine the defective pixel points within each image based on the defect degree.
[0009] For each sliding window belonging to the smooth region, analyze the distribution of the defect degrees of the pixel points within each sliding window of each image, as well as the positional relationship between the defective pixel points within the sliding window, and combine the texture information regularity factor to obtain the defect feature degrees of each sliding window of each image; based on the positional relationship between the defective pixel points within each sliding window, obtain the defect influence degrees of each sliding window.
[0010] For each sliding window belonging to the rough region, based on the shape characteristics of the edges within each sliding window, determine the defect feature degrees of each sliding window of each image, and based on the position state, determine the defect influence degrees of each sliding window.
[0011] Use the defect feature degrees and defect influence degrees of each sliding window to correct the preset initial step length of each sliding window, and combine the template matching algorithm to perform defect detection on the automotive shock absorber piston.
[0012] In one embodiment, the determination of the texture information regularity factor includes:
[0013] For each sliding window, calculate the sum of the grayscale values of all pixel points in each row, calculate the sum of the differences between the sums of the grayscale values of all adjacent rows, calculate the extreme difference of the sums of the grayscale values within each sliding window, and the texture information regularity factor is negatively correlated with both the sum value and the extreme difference value.
[0014] In one embodiment, the division of the piston surface area into a smooth region and a rough region based on the texture information regularity factor includes:
[0015] Calculate the mean value of the texture information regularity factors of all sliding windows within each image, divide the piston surface area corresponding to the sliding windows within each image whose texture information regularity factor is greater than or equal to the mean value into a smooth region, and divide the piston surface area corresponding to the sliding windows within each image whose texture information regularity factor is less than the mean value into a rough region.
[0016] In one embodiment, the determination of the defect degree includes:
[0017] Calculate the grayscale difference between each pixel point in each image and each pixel point in its neighborhood, denoted as the first difference, calculate the addition result of the first differences between each pixel point and all pixel points in its neighborhood, for each pixel point, obtain the normalization result of the angle between the line connecting the two pixel points corresponding to the maximum value of the first difference and the vertical direction, and the defect degree of each pixel point is positively correlated with the maximum value of the first difference, the addition result, and the normalization result of each pixel point.
[0018] The determination of the defective pixel points includes: calculating the average value of the defect degrees of all pixel points in each image, and determining the pixel points with a defect degree greater than or equal to the average value in each image as the defective pixel points.
[0019] In one embodiment, obtaining the defect feature degrees of the sliding windows of each image includes:
[0020] Denote the defect feature degrees of the sliding windows belonging to the smooth region as , and its expression is: ; In the formula, is the information entropy of the defect degrees of all pixel points in the sliding window, Y is the texture information regularity factor of the sliding window, M is the number of defective pixel points in the sliding window, is the sum value of the spatial distances between the m-th defective pixel point in the sliding window and a preset number of its adjacent defective pixel points, denoted as the first sum value, is the maximum value of the first sum value in the sliding window.
[0021] In one embodiment, obtaining the defect influence degrees of the sliding windows includes:
[0022] For each sliding window belonging to the smooth region, obtain the sum value of the spatial distances between the defective pixel point with the smallest distance from the sliding window boundary and a preset number of its adjacent defective pixel points, denoted as the second sum value, obtain the minimum distance between the defective pixel points in each sliding window and the sliding window boundary, calculate the product of the minimum distance and the second sum value, and take the opposite number of the product as the exponent of the exponential function with the natural constant as the base. The defect influence degrees of the sliding windows belonging to the smooth region are the calculation results of the exponential function.
[0023] In one embodiment, determining the defect feature degrees of the sliding windows of each image includes:
[0024] For each sliding window belonging to the rough region, perform edge detection on the area covered by the sliding window, obtain the closed region corresponding to the largest edge in the sliding window, calculate the aspect ratio of the minimum circumscribed rectangle of the closed region, obtain the connection lines between the centroid point of the closed region and each edge pixel point in the closed region, calculate the information entropy of the angles between all the connection lines in the closed region and the horizontal line, denoted as the edge information entropy, calculate the ratio of the aspect ratio to the texture information regularity factor of the sliding window, and the defect feature degrees of the sliding windows belonging to the rough region are the product of the ratio and the edge information entropy;
[0025] The determination of the defect influence degree of each sliding window is as follows: taking the opposite number of the minimum distance as the exponent of the exponential function with the natural constant as the base, denoted as the first exponential function, and the defect influence degree of each sliding window belonging to the rough area is the calculation result of the first exponential function.
[0026] In one embodiment, the correction of the preset initial step length of each sliding window by using the defect feature degree and the defect influence degree of each sliding window includes:
[0027] The step length of each sliding window after correction is calculated as follows: ; where d is the preset initial step length of each sliding window, F[] is the ceiling function, T is the defect feature degree of each sliding window, X is the defect influence degree of each sliding window, Y is the texture information regularity factor of each sliding window, Norm() is the normalization function, and among them, each sliding window includes each sliding window belonging to the smooth area and each sliding window belonging to the rough area.
[0028] In a second aspect, an embodiment of the present application further provides an automobile shock absorber piston defect detection device, in which a computer program is stored, and when the computer program is executed by a processor, it implements the automobile shock absorber piston defect detection method described in any one of the above.
[0029] In a third aspect, an embodiment of the present application further provides an automobile shock absorber piston defect detection system, including a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, it implements the steps of the method described in any one of the above.
[0030] The present application has at least the following beneficial effects:
[0031] This application uniformly acquires images of each angle of the piston of an automotive shock absorber within one week, improving the all-round coverage ability for detecting defects on the piston surface and avoiding the defects in hidden areas that may be missed by traditional single-angle detection. By analyzing the gray-scale differences between adjacent pixel points within the preset sliding windows of each image, the texture information regularity factor of each sliding window of each image is determined. The determination of the texture information regularity factor enhances the refined detection ability of the piston surface texture features, and can effectively distinguish the texture feature differences between the normal rough surface of the piston and the defective areas such as abnormal wear and cracks. Based on the texture information regularity factor, the piston surface area is divided into a smooth area and a rough area, increasing the targeted detection ability for defects in different piston surface states and overcoming the misjudgment problem caused by the mixed texture of the piston surface. By the gray-scale differences and position distributions between adjacent pixel points within each image, the defect degree of each pixel point within each image is determined, improving the capture sensitivity of microscopic defects on the piston surface. Based on the defect degree, the defective pixel points within each image are determined. For each sliding window belonging to the smooth area, by analyzing the distribution of the defect degrees of the pixel points within each sliding window of each image and the positional relationship between the defective pixel points within the sliding window, combined with the texture information regularity factor, the defect feature degree of each sliding window of each image is obtained. Based on the positional state of the defective pixel points within each sliding window, the defect influence degree of each sliding window is obtained, improving the accuracy and reliability of defect detection within the sliding windows of the smooth area and increasing the weight of defect recognition within the sliding windows of the smooth area. For each sliding window belonging to the rough area, based on the shape features of the edges within each sliding window, the defect feature degree of each sliding window of each image is determined, and based on the positional state, the defect influence degree of each sliding window is determined, enhancing the ability to distinguish continuous defects from discrete defects and improving the recognition robustness for irregular defects such as cracks and scratches. By using the defect feature degree and defect influence degree of each sliding window to correct the preset initial step size of each sliding window, combined with the template matching algorithm, defect detection is performed on the piston of the automotive shock absorber. This application optimizes the balance between the efficiency and accuracy of piston defect detection using template matching, automatically reducing the sliding step size in high-defect-risk areas to increase the detection density and expanding the step size in low-risk areas to accelerate scanning, overcoming the problems of detection redundancy or omission caused by a fixed step size and improving the accuracy and efficiency of piston defect detection. Description of the Drawings
[0032] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0033] Figure 1The flowchart of the steps of a method for detecting defects of an automotive shock absorber piston provided by an embodiment of the present application;
[0034] Figure 2 It is the flowchart for correcting the sliding step length of the sliding window. Detailed implementation manners
[0035] In order to further elaborate on the technical means and effects adopted by the present application to achieve the intended invention purpose, the following, in conjunction with the accompanying drawings and preferred embodiments, details the specific implementation manners, structures, features and effects of a method, device and system for detecting defects of an automotive shock absorber piston proposed according to the present application. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. In addition, the specific features, structures or characteristics in one or more embodiments can be combined in any suitable form.
[0036] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field to which this application belongs.
[0037] The following specifically describes the specific solutions of a method, device and system for detecting defects of an automotive shock absorber piston provided by the present application with reference to the accompanying drawings.
[0038] Please refer to Figure 1 , which shows the flowchart of the steps of a method for detecting defects of an automotive shock absorber piston provided by an embodiment of the present application. The method includes the following steps:
[0039] S1, uniformly collect images of each angle of the automotive shock absorber piston within one week.
[0040] In this embodiment, an industrial CCD camera is used to collect the surface image of the automotive shock absorber piston. Since the piston is approximately cylindrical, taking pictures at a single angle cannot completely cover the piston surface. Therefore, in order to comprehensively detect the defects on the piston surface, in this embodiment, the piston to be detected is rotated on the workbench, cooperating with the same light source and the fixed camera, rotating the piston, and taking a picture every 30° at a fixed angle until the piston rotates one week, and images of each angle of the piston are obtained. Since the collected images are all RGB images, in this embodiment, the method of weighted grayscale conversion is used to perform grayscale conversion on each image. Weighted grayscale conversion is a well-known prior art, and the specific process will not be elaborated here.
[0041] It should be noted that the fixed angle of 30° is only one embodiment of the present application, and the implementer can set the value of the fixed angle according to the actual situation, and this embodiment does not limit it here.
[0042] S2. Analyze the gray - level difference between adjacent row pixels within the preset sliding window of each image, as well as the range of the gray - level difference between row pixels within the sliding window, to determine the texture information regularity factor of each sliding window of each image; divide the piston surface areas corresponding to all sliding windows of each image into smooth areas and rough areas based on the texture information regularity factor.
[0043] Template matching is a technique commonly used in image processing and defect detection. It completes defect recognition by matching a pre - defined template with the image to be detected. Template matching can identify the differences in the image and thus discover defects in piston products. In template matching, if the sliding window step size is too small, although it can provide higher matching accuracy, the computational complexity is large, and it cannot meet the detection efficiency requirements for real - time defect detection of piston products. If the step size is too large, the matching process can be accelerated, but some defects may be missed, reducing the defect detection accuracy. In traditional template - matching algorithms, the step size is usually fixed. In this embodiment, by extracting the local features of the pixels within the sliding window, the sliding step size of template matching is adaptively adjusted to improve the defect detection accuracy while ensuring the detection efficiency. The specific process is as follows:
[0044] According to the piston surface structure, the piston surface includes pin holes, grooves, rough surfaces, smooth surfaces, and the outer edge of the piston. In this embodiment, a standard qualified piston is obtained as a template, and the same image acquisition method as that of the piston to be detected is used to obtain images of the standard qualified piston at various angles, which are used as the template images for subsequent template matching with the images of the piston to be detected at corresponding angles.
[0045] In this embodiment, first, the parameters of the template - matching algorithm are initialized. The size of the sliding window for template matching is set to 50 * 50, and the initial step size is set to d = 2 pixels. The implementer can set the size of the sliding window and the value of the initial step size according to the actual situation, and this embodiment does not limit it here. When detecting defects on the surface of an automotive shock - absorber piston, since the piston surface includes rough surfaces and smooth surfaces, it is first necessary to determine whether the piston surface within the sliding window is a rough surface or a smooth surface. Among them, the rough surface of the piston itself has rich texture information and is uneven on the surface. Therefore, when there are some minor scratches and bumps on the rough surface of the piston, the impact on the piston's performance is relatively small. While the smooth surface of the piston has regular texture information, and defects on the smooth surface are manifested as local uneven gray levels, which have a greater impact on the piston's performance.
[0046] Therefore, in this embodiment, a texture information regularity factor for each sliding window is constructed based on the characteristics of the rough and smooth surfaces of the piston. The specific expression is: ; where Y is the texture information regularity factor of each sliding window, is the sum of the gray - level values of all pixels in the i - th row within each sliding window, is the sum of the grayscale values of all pixel points in the (i + 1)-th row within each sliding window, N is the number of rows within each sliding window, and in this embodiment, N = 50. is the maximum value of the sum of the grayscale values of all row pixel points within each sliding window. is the minimum value of the sum of the grayscale values of all row pixel points within each sliding window. is a very small positive number preset to be greater than 0 to avoid a zero denominator. In this embodiment, , which can be set by the implementer according to the actual situation and is not limited in this embodiment.
[0047] It should be understood that the larger the value, the more uneven the distribution of the grayscale values of the pixel points, and the smaller the texture information regularity factor. The larger the texture information regularity factor, the more regular the texture information contained in the piston surface area within the sliding window, and the more likely it is a smooth surface. When there are defects on a smooth surface, the impact on the performance of the piston is greater. The smaller the texture information regularity factor, the more chaotic and irregular the information contained in the piston surface area within the sliding window, and the more likely it is a rough surface. When there are defects, the impact on the performance of the piston is smaller.
[0048] Thus, the texture information regularity factors of each sliding window can be obtained, and then the piston surface area corresponding to each sliding window can be judged according to the texture information regularity factors. In this embodiment, the mean value of the texture information regularity factors of all sliding windows in each image is calculated. When the texture information regularity factor of a sliding window is greater than or equal to the mean value, it is determined that the piston surface area corresponding to the sliding window is a smooth surface, that is, a smooth area. When the texture information regularity factor of a sliding window is less than the mean value, it is determined that the piston surface area corresponding to the sliding window is a rough surface, that is, a rough area.
[0049] S3. Determine the defect degree of each pixel point in each image through the grayscale difference between each pixel point in each image and the pixel points in its neighborhood, and combine the position distribution between the pixel points; determine the defective pixel points in each image based on the defect degree.
[0050] When there are defects on the piston surface, in the image, the pixel points with defects usually have the characteristics of local aggregated distribution to form a defect area, and there may be multiple defects within the sliding window. Therefore, in this embodiment, local analysis is performed on the pixel points in the piston surface area within the sliding window. For each pixel point, this embodiment obtains the pixel points within the 3×3 local neighborhood of each pixel point. The implementer can set the size of the local neighborhood of each pixel point by himself / herself, and this embodiment is not limited here.
[0051] Based on the grayscale distribution of the pixel points within the local neighborhood of each pixel point, calculate the defect degree of each pixel point. The specific calculation method is: , where in the formula is the defect degree of the q-th pixel in each image, and Norm() is the normalization function. is the sum of the absolute values of the gray-level differences between the q-th pixel in each image and all pixels in its local neighborhood. is the maximum value of the absolute values of the gray-level differences between the q-th pixel in each image and all pixels in its local neighborhood. is the angle in the vertical direction between the line connecting the q-th pixel in each image and the pixel a with the largest absolute value of the gray-level difference in its local neighborhood. Denote the absolute value of the gray-level difference between the q-th pixel and all pixels in its local neighborhood as the first difference. Among them, the difference represents the degree of difference between two variables, and specifically, it can be calculated by methods such as the absolute value of the difference, the square of the difference, the ratio, etc.
[0052] It should be understood that the larger the angle and the larger the absolute value of the gray-level difference between the q-th pixel and the pixels in its local neighborhood, the greater the texture difference between the pixel q and the pixels in its local neighborhood, and the greater the defect degree. The larger it is, the more chaotic the texture information of the pixel in all directions, and the greater the possibility of defects. The greater the defect degree of the pixel, the more likely the information contained in the pixel is defect information, and the smaller the defect degree of the pixel, the more likely the information contained in the pixel is normal texture information.
[0053] Calculate the average value of the defect degrees of all pixels in each image, and use the pixels in each image whose defect degrees are greater than or equal to the average value as defect pixels. Thus, each defect pixel in each image can be obtained.
[0054] S4. For each sliding window belonging to the smooth region, analyze the degree of distribution chaos of the defect degrees of the pixels in each sliding window of each image, and the spatial distance between the defect pixels in the sliding window. Combine the texture information law factor to obtain the defect feature degree of each sliding window of each image; based on the minimum distance between the defect pixels in each sliding window and the sliding window boundary, and the spatial distance between the defect pixels and their adjacent defect pixels, obtain the defect influence degree of each sliding window.
[0055] Furthermore, for each sliding window of each image, in this embodiment, a classification analysis is performed on each sliding window belonging to the smooth surface and each sliding window belonging to the rough surface. First, for each sliding window belonging to the smooth surface, according to the distribution characteristics of the defect degrees of the pixels in the sliding window, construct the defect feature degree of each sliding window belonging to the smooth surface in each image. The specific calculation method is as follows:
[0056] ; where is the defect feature degree of each sliding window belonging to the smooth region. is the information entropy of the defect degrees of all pixel points within the sliding window, Y is the texture information regularity factor of the sliding window, and M is the number of defective pixel points within the sliding window. is the sum value of the spatial distances between the m-th defective pixel point within the sliding window and a preset number of adjacent defective pixel points, denoted as the first sum value. is the maximum value of the first sum value within the sliding window. In this embodiment, the preset number takes the value of 10, and the implementer can set it according to the actual situation, and this embodiment does not limit it here. Among them, in this embodiment, the calculation method of the spatial distance all adopts the Euclidean distance, and the implementer can select other existing feasible distance calculation methods by himself.
[0057] It should be understood that the larger the information entropy is, the more chaotic the local information of the pixel points within the sliding window is, and the greater the possibility of defects. The smaller the first sum value is, the more concentrated the distribution of the defective pixel points within the sliding window is, and it is not the noise points generated by external factors interference, and the greater the possibility of real defects. The larger the maximum value of the first sum value is, the more dispersed and messy the distribution of the defective pixel points within the sliding window is. Therefore, the larger the defect feature degree of the sliding window is, the greater the possibility that the piston surface area within the sliding window contains defect information. The smaller the defect feature degree is, the smaller the possibility that the piston surface area within the sliding window contains defect information.
[0058] Similarly, for each sliding window belonging to the smooth surface, in this embodiment, the influence degree of the defect on the sliding window step adjustment is constructed through the contact condition between the defect within the sliding window and the sliding window boundary. In this embodiment, the defect influence degrees of each sliding window belonging to the smooth surface are calculated, and the specific calculation method is as follows:
[0059] ; where is the defect influence degree of each sliding window belonging to the smooth surface, is the minimum distance between the defective pixel points within the sliding window and the sliding window boundary, is the sum value of the spatial distances between the defective pixel point with the minimum distance from the sliding window boundary within the sliding window and the preset number of adjacent defective pixel points, denoted as the second sum value, and exp() is the exponential function with the natural constant as the base.
[0060] It should be understood that the larger the defect influence degree is, the closer the defect area is to the sliding window boundary. At this time, the adjustment of the sliding window step has a greater influence on the detection of the defect area, that is, the weight for step adjustment is greater. The smaller the defect influence degree is, the farther the defect area is from the sliding window boundary. At this time, the adjustment of the sliding window step has a smaller influence on the detection of the defect area, that is, the weight for step adjustment is smaller.
[0061] S5. For each sliding window belonging to the rough area, based on the shape characteristics of the edges within each sliding window and the degree of regularity of the edges, determine the defect feature degree of each sliding window of each image. Based on the minimum distance, determine the defect influence degree of each sliding window.
[0062] In each image, in addition to the sliding windows belonging to the smooth surface, there are also sliding windows belonging to the rough surface. For the piston surface area belonging to the rough surface, since the influence of minor defects on the piston is relatively low, in this embodiment, only whether there is a large-scale defect area within the piston rough surface area of the sliding window is analyzed. Since the piston rough surface area mostly has crack defects and scratch defects. According to the texture characteristics of the piston rough surface area, granular or speckled structures usually appear in the rough area. For large-scale defects, there will be a defect area within the piston rough surface area. The edge of the defect area is a closed irregular edge, and the defect distribution is a long and narrow distribution, that is, when the horizontal direction is longer, the vertical direction is narrower, or when the vertical direction is longer, the horizontal direction is narrower. Therefore, in this embodiment, first perform canny operator detection on each sliding window belonging to the rough surface to obtain the closed area enclosed by the largest closed edge within the sliding window.
[0063] Furthermore, determine the defect feature degree of each sliding window belonging to the rough surface in each image. The specific calculation method is as follows:
[0064] ; where is the defect feature degree of each sliding window belonging to the rough surface in each image, is the aspect ratio of the minimum circumscribed rectangle of the closed area within the sliding window, Y is the texture information regularity factor of the sliding window, obtain the connection lines between the centroid pixel point of the closed area within the sliding window and each edge pixel point, is the information entropy of the angles between all the connection lines within the sliding window and the horizontal line, denoted as the edge information entropy.
[0065] It should be understood that the larger the aspect ratio, the more the shape characteristics of the closed area conform to scratch and crack defects. Therefore, the larger the defect feature degree, the larger the edge information entropy, indicating that the edge is more irregular and the defect feature degree is larger. The larger the defect feature degree, the greater the possibility that there are defects in the piston rough surface area within the sliding window, and the smaller the defect feature degree, the smaller the possibility that there are defects in the piston rough surface area within the sliding window.
[0066] Furthermore, determine the defect influence degree of each sliding window belonging to the rough surface in each image. The specific calculation method is as follows:
[0067] ; where is the defect influence degree of each sliding window belonging to the rough surface in each image. is the minimum distance from the defective pixel point in the sliding window to the boundary of the sliding window, and exp() is the exponential function with the natural constant as the base. Denote as the first exponential function.
[0068] S6. Use the defect feature degree and defect influence degree of each sliding window to correct the preset initial step length of each sliding window, and combine with the template matching algorithm to detect the defects of the automotive shock absorber piston.
[0069] According to the above steps, the defect feature degree, defect influence degree, and texture information regularity factor of each sliding window in each image can be obtained, including each sliding window belonging to the smooth surface and each sliding window belonging to the rough surface. Then, in this embodiment, according to the numerical size relationship of the defect feature degree, defect influence degree, and texture information regularity factor of each sliding window, the initial step length of each sliding window is adjusted. The adjusted step length is calculated as follows:
[0070] ; where d is the preset initial step length of each sliding window in each image, F[] is the ceiling function, T is the defect feature degree of each sliding window, X is the defect influence degree of each sliding window, Y is the texture information regularity factor of each sliding window. Among them, each sliding window includes each sliding window belonging to the smooth area and each sliding window belonging to the rough area, and Norm() is the normalization function. The flowchart of the sliding step length correction of the sliding window is as Figure 2 shown.
[0071] It should be understood that the larger the product of the defect feature degree and defect influence degree of the sliding window, the more likely there are defects in the sliding window, and the closer the defect is to the boundary of the sliding window. When the step length of the sliding window is too large for window sliding, some defects are likely to be ignored. To improve the defect detection accuracy, the step length of the sliding window is reduced in this embodiment. And when the product of the defect feature degree and defect influence degree of the sliding window is smaller, it means that the gray distribution in the sliding window is more regular and the possibility of having defects is smaller. At this time, to improve the defect detection efficiency, the step length of the sliding window is increased in this embodiment to complete the adaptive adjustment of the sliding window step length.
[0072] In this embodiment, a sliding window with an adjusted sliding step is used to match each image of the piston to be detected with the corresponding template image. Among them, the similarity measure of the template matching algorithm uses the normalized cross-correlation (NCC) index. If there is an image with an NCC value less than the preset threshold among all the images of the piston to be detected, it is determined that the piston to be detected has a defect; otherwise, it is determined that the piston to be detected has no defect. Among them, the preset threshold in this embodiment is 0.8, and the implementer can set it according to the actual situation, and this embodiment does not limit it here. The template matching algorithm is a well-known prior art, and the specific process will not be elaborated.
[0073] Based on the same inventive concept as the above method, an embodiment of the present application also provides a device for detecting defects in an automotive shock absorber piston. A computer program is stored in the device, and when the computer program is executed by a processor, it implements the method for detecting defects in an automotive shock absorber piston described in any one of the above.
[0074] Based on the same inventive concept as the above method, an embodiment of the present application also provides a system for detecting defects in an automotive shock absorber piston, including a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, it implements the steps of the method described in any one of the above methods for detecting defects in an automotive shock absorber piston.
[0075] It should be noted that: the above sequence of embodiments of the present application is only for description and does not represent the superiority or inferiority of the embodiments. And the above specifically describes certain embodiments of this specification. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0076] Each embodiment in this specification is described in a progressive manner. The same or similar parts among the embodiments can be referred to each other, and the key point of each embodiment is to illustrate the differences from other embodiments.
[0077] The above are only the preferred embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the principle of the present application shall be included in the protection scope of the present application.
Claims
1. A method for detecting defects of an automotive shock absorber piston, characterized in that, The method includes the following steps: Uniformly collect images of each angle of the piston of an automotive shock absorber within one week; Analyze the gray - scale differences between adjacent pixel points within the preset sliding windows of each image to determine the texture information regularity factors of each sliding window of each image; divide the piston surface area into a smooth area and a rough area based on the texture information regularity factors; Determine the defect degree of each pixel point within each image through the gray - scale differences and position distributions between adjacent pixel points within each image; determine the defective pixel points within each image based on the defect degree; For each sliding window belonging to the smooth area, analyze the degree of distribution chaos of the defect degrees of the pixel points within each sliding window of each image, and the spatial distance between the defective pixel points within the sliding window. Combine the texture information regularity factors to obtain the defect characteristic degrees of each sliding window of each image; based on the minimum distance between the defective pixel points within each sliding window and the boundary of the sliding window, and the spatial distance between the defective pixel points and their adjacent defective pixel points, obtain the defect influence degrees of each sliding window; For each sliding window belonging to the rough area, determine the defect characteristic degrees of each sliding window of each image based on the shape characteristics of the edges within each sliding window and the degree of regularity of the edges, and determine the defect influence degrees of each sliding window based on the minimum distance; Use the defect characteristic degrees and defect influence degrees of each sliding window to correct the preset initial step lengths of each sliding window, and combine with the template matching algorithm to detect defects in the piston of the automotive shock absorber.
2. The method for detecting defects of an automotive shock absorber piston according to claim 1, wherein, The determination of the texture information regularity factor includes: For each sliding window, calculate the sum of the gray - scale accumulations of all pixel points in each row, calculate the sum of the differences of the gray - scale accumulations of all adjacent rows, calculate the extreme value of the gray - scale accumulations within each sliding window. The texture information regularity factor is negatively correlated with both the sum value and the extreme value.
3. The method for detecting defects of an automotive shock absorber piston according to claim 1, wherein, The dividing of the piston surface area into a smooth area and a rough area based on the texture information regularity factor includes: Calculate the mean value of the texture information regularity factors of all sliding windows within each image. Divide the piston surface area corresponding to the sliding windows within each image whose texture information regularity factor is greater than or equal to the mean value into a smooth area, and divide the piston surface area corresponding to the sliding windows within each image whose texture information regularity factor is less than the mean value into a rough area.
4. The method for detecting defects of an automotive shock absorber piston according to claim 1, wherein, The determination of the defect degree includes: Calculate the gray - scale difference between each pixel point within each image and each pixel point within its neighborhood, denoted as the first difference. Calculate the sum of the first differences of each pixel point and all pixel points within its neighborhood. For each pixel point, obtain the normalized result of the angle between the line connecting the two pixel points corresponding to the maximum value of the first difference and the vertical direction. The defect degree of each pixel point is positively correlated with the maximum value of the first difference, the sum result, and the normalized result of each pixel point; The determination of the defective pixel points includes: calculate the average value of the defect degrees of all pixel points within each image, and determine the pixel points whose defect degree is greater than or equal to the average value within each image as defective pixel points.
5. The method for detecting defects of an automobile shock absorber piston according to claim 1, characterized in that, The obtaining of the defect characteristic degrees of each sliding window of each image includes: Denote the defect feature degree of each sliding window belonging to the smooth region as , and its expression is: ; in the formula, is the information entropy of the defect degrees of all pixel points in the sliding window, Y is the texture information law factor of the sliding window, M is the number of defect pixel points in the sliding window, is the sum value of the spatial distances between the m-th defect pixel point in the sliding window and a preset number of adjacent defect pixel points, denoted as the first sum value, is the maximum value of the first sum value in the sliding window.
6. The method for detecting defects of an automotive shock absorber piston according to claim 1, characterized in that, The obtaining of the defect influence degrees of each sliding window includes: For each sliding window belonging to the smooth region, obtain the sum value of the spatial distances between the defective pixel point with the smallest distance from the boundary of the sliding window and a preset number of adjacent defective pixel points, denoted as the second sum value, calculate the product of the minimum distance and the second sum value, take the opposite number of the product as the exponent of the exponential function with the natural constant as the base, and the defect influence degree of each sliding window belonging to the smooth region is the calculation result of the exponential function.
7. The method for detecting defects of an automotive shock absorber piston according to claim 6, characterized in that, The determination of the defect feature degrees of the sliding windows of each image includes: For each sliding window belonging to the rough region, perform edge detection on the region covered by the sliding window, obtain the closed region corresponding to the largest edge within the sliding window, calculate the aspect ratio of the minimum circumscribed rectangle of the closed region, obtain the connection lines between the centroid point of the closed region and each edge pixel point within the closed region, calculate the information entropy of the angles between all the connection lines of the closed region and the horizontal line, denoted as the edge information entropy, calculate the ratio of the aspect ratio to the texture information regularity factor of the sliding window, and the defect feature degree of each sliding window belonging to the rough region is the product of the ratio and the edge information entropy; The determination of the defect influence degree of each sliding window is: take the opposite number of the minimum distance as the exponent of the exponential function with the natural constant as the base, denoted as the first exponential function, and the defect influence degree of each sliding window belonging to the rough region is the calculation result of the first exponential function.
8. The method for detecting defects of an automotive shock absorber piston according to claim 1, wherein The use of the defect feature degrees and defect influence degrees of the sliding windows to correct the preset initial step lengths of the sliding windows includes: The step size after correction of each sliding window is calculated as follows: ; where d is the preset initial step size of each sliding window, F[] is the ceiling function, T is the defect feature degree of each sliding window, X is the defect influence degree of each sliding window, Y is the texture information law factor of each sliding window, Norm() is the normalization function, and among them, each sliding window includes each sliding window belonging to the smooth area and each sliding window belonging to the rough area.
9. An automobile shock absorber piston defect detection device, in which a computer program is stored, characterized in that, When the computer program is executed by a processor, it implements a method for detecting defects of an automotive shock absorber piston as described in any one of claims 1-8.
10. An automobile shock absorber piston defect detection system, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method as described in any one of claims 1-8.
Citation Information
Patent Citations
Surface defect detection method, device and equipment and storage medium thereof
CN117197081A
Defect positioning method and system for non-ferrous metal part
CN118397003A
Cited By
Machine vision-based shock absorber connecting rod surface defect online detection system
CN122651699A