Automobile shock absorber piston defect detection method, device and system
By analyzing the grayscale difference between pixel points in the sliding window and dividing the texture information regularity factor of the multi-angle image collected by the automobile shock absorber piston, adjusting the step length of the sliding window with defect characteristics and influence, and optimizing the template matching algorithm, the problem of insufficient piston defect detection accuracy and efficiency in the existing technology is solved, and more efficient and accurate defect detection is achieved.
Patent Information
- Application Number
- CN202510600582.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-12
- Publication Date
- 2025-06-10
- Estimated Expiration
- 2045-05-12
AI Technical Summary
In the prior art, in the detection of piston defects of automobile shock absorbers, it is difficult to take into account the matching accuracy and calculation efficiency of sliding window step length, resulting in insufficient defect detection accuracy and efficiency.
By uniformly collecting images from each angle within one week of the piston, analyzing the grayscale difference and texture information regular factors of pixel points in the sliding window, dividing the smooth and rough areas, correcting the step length of the sliding window based on defect characteristics and influence, and optimizing the template matching algorithm for defect detection.
It improves the comprehensive coverage ability of piston surface defect detection, enhances the fineness of texture feature detection, improves the detection ability of defects in different surface states, overcomes misjudgment problems, and optimizes the balance of detection efficiency and accuracy.
Smart Images

Figure CN120125577A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of piston defect detection, and particularly 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, reducing the vibrations caused by uneven road surfaces during vehicle driving, and enhancing 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 pre-defined template with the image to be detected. When performing defect recognition, template matching can identify the differences in the image and thus detect the defects in the piston. In template matching, the sliding window step size is a key parameter affecting the matching accuracy and calculation efficiency. The step size determines the sliding speed of the sliding window 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 with a large calculation amount, unable to 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 this 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: In the first aspect, an embodiment of this application provides a method for detecting piston defects in automotive shock absorbers. 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 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; Determine the defect degree of each pixel point in 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 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. 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. Use the defect feature degrees and defect influence degrees of each sliding window to correct the preset initial step size of each sliding window, and combine the template matching algorithm to perform defect detection on the automotive shock absorber piston.
[0005] In one embodiment, the determination of the texture information regularity factor includes: For each sliding window, calculate the sum of the gray levels of all pixel points in each row, calculate the sum of the differences between the sums of the gray levels of all adjacent rows, calculate the extreme difference of the sums of the gray levels within each sliding window, and the texture information regularity factor is negatively correlated with both the sum value and the extreme difference value.
[0006] 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: 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.
[0007] In one embodiment, the determination of the defect degree includes: Calculate the gray level difference between each pixel point in each image and each pixel point in its neighborhood, denoted as the first difference, calculate the sum of the first differences between each pixel point and all pixel points in its neighborhood, and 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: calculating the average value of the defect degrees of all pixel points in each image, and determining the pixel points whose defect degree is greater than or equal to the average value in each image as defective pixel points.
[0008] In one embodiment, the obtaining of the defect feature 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: ; where 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, 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.
[0009] In one embodiment, the obtaining of the defect influence degree 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 minimum distance from the sliding window boundary and a preset number of adjacent defective pixel points, denoted as the second sum value, obtain the minimum distance between the defective pixel points within each sliding window and the sliding window boundary, calculate the product of the minimum distance and the second sum value, and use the opposite of the product as the exponent of an exponential function with the natural constant as the base. The defect influence degree of each sliding window belonging to the smooth region is the calculation result of the exponential function.
[0010] In one embodiment, the determining of the defect feature degree of each sliding window of each image includes: 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 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 and the horizontal line within the closed region, 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 determining of the defect influence degree of each sliding window is: use the opposite of the minimum distance as the exponent of an 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.
[0011] In one embodiment, the using of the defect feature degree and the defect influence degree of each sliding window to correct the preset initial step length of each sliding window includes: The corrected step length of each sliding window is calculated as: ; 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 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.
[0012] 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 method for detecting defects of an automobile shock absorber piston described in any one of the above.
[0013] 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.
[0014] The present application has at least the following beneficial effects: This application uniformly collects 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, and combining 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 degrees and defect influence degrees of each sliding window to correct the preset initial step length 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 length in high-defect-risk areas to increase the detection density and expanding the step length in low-risk areas to accelerate scanning, overcoming the problems of detection redundancy or omission caused by a fixed step length and improving the accuracy and efficiency of piston defect detection. Description of the Drawings
[0015] 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 following-described drawings are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0016] Figure 1The flowchart of steps of a method for detecting defects of an automotive shock absorber piston provided by an embodiment of the present application; Figure 2 It is the flowchart for correcting the sliding step length of the sliding window. Detailed implementation manners
[0017] 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.
[0018] 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 the present application belongs.
[0019] 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.
[0020] Please refer to Figure 1 , which shows the flowchart of 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: S1, uniformly collect images of each angle of an automotive shock absorber piston within one week.
[0021] 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, a single-angle photograph cannot completely cover the piston surface. Therefore, in order to comprehensively detect the surface defects of the piston, in this embodiment, the piston to be detected is rotated on the workbench, in cooperation with the same light source and a fixed camera, the piston is rotated, and an image is taken every fixed angle of 30° until the piston rotates one week, and images of each angle of the piston are taken. Since the collected images are all RGB images, in this embodiment, the method of weighted graying is used to perform graying processing on each image. Weighted graying is a well-known prior art, and the specific process will not be elaborated here.
[0022] It should be noted that the fixed angle of 30° is only an 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.
[0023] S2. Analyze the gray - level difference between adjacent row pixels within the preset sliding window of each image, as well as the range of gray - level differences 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.
[0024] 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: 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.
[0025] 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 piston rough surface 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 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 performance.
[0026] Therefore, in this embodiment, a texture information regularity factor for each sliding window is constructed based on the characteristics of the piston rough surface and smooth surface. 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, and N is the number of rows within each sliding window. 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 preset extremely small positive number 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.
[0027] It should be understood that the larger the
[0028] , the more uneven the distribution of pixel point grayscale values, 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 piston's performance 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 piston's performance is smaller.
[0029] 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 pixel points; determine the defective pixel points in each image based on the defect degree.
[0030] When there are defects on the piston surface, in the image, the defective pixel points usually have the characteristics of being locally aggregated 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, in this embodiment, the pixel points within the 3×3 local neighborhood of each pixel point are obtained. The implementer can set the size of the local neighborhood of each pixel point by themselves, and this is not limited in this embodiment.
[0031] 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 point in each image, and Norm() is a normalization function. is the sum of the absolute values of the gray-scale differences between the q-th pixel point in each image and all pixel points in its local neighborhood. is the maximum value of the absolute values of the gray-scale differences between the q-th pixel point in each image and all pixel points in its local neighborhood. is the angle in the vertical direction between the line connecting the q-th pixel point in each image and the pixel point a with the largest absolute value of the gray-scale difference in its local neighborhood. Denote the absolute value of the gray-scale difference between the q-th pixel point and all pixel points 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, and the ratio.
[0032] It should be understood that the larger the angle and the larger the absolute value of the gray-scale difference between the q-th pixel point and the pixel points in its local neighborhood, the greater the texture difference between the pixel point q and the pixel points in its local neighborhood, and the greater the defect degree. The larger it is, the more chaotic the texture information of the pixel point in all directions, and the greater the possibility of defects. The greater the defect degree of the pixel point, the more likely the information contained in the pixel point is defect information, and the smaller the defect degree of the pixel point, the more likely the information contained in the pixel point is normal texture information.
[0033] Calculate the average value of the defect degrees of all pixel points in each image, and take the pixel points in each image whose defect degrees are greater than or equal to the average value as defect pixel points. Thus, each defect pixel point in each image can be obtained.
[0034] S4. For each sliding window belonging to the smooth region, analyze the degree of distribution chaos of the defect degrees of the pixel points in each sliding window of each image, and the spatial distance between the defect pixel points 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 pixel points in each sliding window and the sliding window boundary, and the spatial distance between the defect pixel points and their adjacent defect pixel points, obtain the defect influence degree of each sliding window.
[0035] 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 pixel points 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: ; 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 a 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 choose other existing feasible distance calculation methods by himself.
[0036] It should be understood that the larger the information entropy, the more chaotic the local information of the pixel points within the sliding window, and the greater the possibility of defects. The smaller the first sum value, the more clustered the distribution of the defective pixel points within the sliding window, 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, the more dispersed and messy the distribution of the defective pixel points within the sliding window. Therefore, the larger the defect feature degree of the sliding window, the greater the possibility that the piston surface area within the sliding window contains defect information, and the smaller the defect feature degree, the smaller the possibility that the piston surface area within the sliding window contains defect information.
[0037] 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: ; in the formula, is the defect influence degree of each sliding window belonging to the smooth surface, is the minimum distance between the defective pixel point 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.
[0038] It should be understood that the larger the defect influence degree, the closer the defect area is to the sliding window boundary. At this time, the adjustment of the sliding window step has a greater impact on the detection of the defect area, that is, the greater the weight during the step adjustment. The smaller the defect influence degree, the farther the defect area is from the sliding window boundary. At this time, the adjustment of the sliding window step has a smaller impact on the detection of the defect area, that is, the smaller the weight during the step adjustment.
[0039] 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, and based on the minimum distance, determine the defect influence degree of each sliding window.
[0040] 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. And according to the texture characteristics of the piston rough surface area, granular or spot-like structures usually appear in the rough area. For large-scale defects, there will be a defect area within the piston rough surface area, and 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 enclosed area surrounded by the largest closed edge within the sliding window.
[0041] Further, determine the defect feature degree of each sliding window belonging to the rough surface in each image. The specific calculation method is as follows: ; 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 enclosed 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 enclosed 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.
[0042] It should be understood that the larger the aspect ratio, the more the shape characteristics of the enclosed 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.
[0043] Further, determine the defect influence degree of each sliding window belonging to the rough surface in each image. The specific calculation method is as follows: ; 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 points within the sliding window to the boundary of the sliding window, and exp() is the exponential function with the natural constant as the base. is denoted as the first exponential function.
[0044] S6. Use the defect feature degree and defect influence degree of each sliding window to correct the preset initial step size of each sliding window, and combine the template matching algorithm to detect defects in the automotive shock absorber piston.
[0045] 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 size of each sliding window is adjusted. The adjusted step size of each sliding window is calculated as follows: ; where d is the preset initial step size 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, and 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 size correction of the sliding window is as Figure 2 shown.
[0046] 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 within the sliding window, and the closer the defect is to the boundary of the sliding window. When the step size 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 size 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 within 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 size of the sliding window is increased in this embodiment to complete the adaptive adjustment of the sliding window step size.
[0047] In this embodiment, the sliding window with the adjusted sliding step size 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 defects; otherwise, it is determined that the piston to be detected has no defects. 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.
[0048] Based on the same inventive concept as the above method, an embodiment of the present application further provides a device for detecting defects of 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 of an automotive shock absorber piston described in any one of the above.
[0049] Based on the same inventive concept as the above method, an embodiment of the present application further provides a system for detecting defects of 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 of an automotive shock absorber piston.
[0050] 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. Additionally, the processes depicted in the drawings do not necessarily require the specific order or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0051] 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.
[0052] 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 in automobile shock absorber pistons, characterized in that: The method comprises the following steps: Uniformly collect images of automobile shock absorber piston at various angles within one circle; Analyze the grayscale difference between adjacent pixels in 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; Determine the defect degree of each pixel in each image by the grayscale difference and position distribution between adjacent pixels in each image; determine the defective pixel in each image based on the defect degree; For each sliding window belonging to the smooth area, the distribution of the defect degree of the pixel points in each sliding window of each image and the positional relationship between the defective pixel points in the sliding window are analyzed, and the defect characteristic degree of each sliding window of each image is obtained in combination with the texture information regularity factor; based on the position state of the defective pixel points in each sliding window, the defect influence degree of each sliding window is obtained; For each sliding window belonging to the rough area, based on the shape characteristics of the inner edge of each sliding window, determine the defect characteristic degree of each sliding window of each image, and based on the position state, determine the defect influence degree of each sliding window; The preset initial step size of each sliding window is corrected by using the defect characteristic degree and defect influence degree of each sliding window, and the automobile shock absorber piston is tested for defects by combining with the template matching algorithm.
2. A method for detecting defects in a shock absorber piston of an automobile as claimed in claim 1, characterized in that: The determination of the texture information regularity factor includes: For each sliding window, the grayscale cumulative sum of all pixels in each row is calculated, the sum of the differences of the grayscale cumulative sums of all adjacent rows is calculated, and the range value of the grayscale cumulative sum in each sliding window is calculated, and the texture information regularity factor is negatively correlated with the sum value and the range value.
3. The automobile shock absorber piston defect detection method according to claim 1, characterized in that: The step of dividing the piston surface area into a smooth area and a rough area based on the texture information regularity factor includes: The mean value of the texture information regularity factor of all sliding windows in each image is calculated, and the piston surface area corresponding to the sliding window in each image whose texture information regularity factor is greater than or equal to the mean value is divided into a smooth area, and the piston surface area corresponding to the sliding window in each image whose texture information regularity factor is less than the mean value is divided into a rough area.
4. The automobile shock absorber piston defect detection method according to claim 1, characterized in that: The determination of the defect degree includes: Calculate the grayscale difference between each pixel in each image and each pixel in its neighborhood, record it as the first difference, calculate the addition result of the first differences between each pixel and all pixels in its neighborhood, and for each pixel, obtain the normalized result of the angle between the line connecting the two pixels corresponding to the maximum value of the first difference and the vertical direction, and the defect degree of each pixel is positively correlated with the maximum value of the first difference of each pixel, the addition result, and the normalized result; The determination of defective pixels includes: calculating an average value of the defective degrees of all pixels in each image, and determining pixels in each image whose defective degrees are greater than or equal to the average value as defective pixels.
5. The automobile shock absorber piston defect detection method according to claim 1, characterized in that: The step of obtaining the defect characteristic degree of each sliding window of each image includes: The defect characteristic of each sliding window belonging to the smooth area is recorded as , whose expression is: ; In the formula, is the information entropy of the defect degree of all pixels in the sliding window, Y is the texture information regularity factor of the sliding window, M is the number of defective pixels in the sliding window, is the sum of the spatial distances between the mth defective pixel and a preset number of adjacent defective pixels in the sliding window, recorded as the first sum, is the maximum value of the first sum in the sliding window.
6. The automobile shock absorber piston defect detection method according to claim 1, characterized in that: The obtaining of the defect impact of each sliding window includes: For each sliding window belonging to the smooth area, the sum of the spatial distances between the defective pixel point with the shortest distance from the sliding window boundary and a preset number of defective pixel points adjacent to it is obtained, recorded as the second sum, the minimum distance between the defective pixel point in each sliding window and the sliding window boundary is obtained, the product of the minimum distance and the second sum is calculated, and the opposite of the product is used as the exponent of an exponential function with a natural constant as the base. The defect impact degree of each sliding window belonging to the smooth area is the calculation result of the exponential function.
7. A method for detecting defects in a shock absorber piston of an automobile as claimed in claim 6, characterized in that: The step of determining the defect characteristic degree of each sliding window of each image includes: For each sliding window belonging to the rough area, edge detection is performed on the area covered by the sliding window, the closed area corresponding to the maximum edge in the sliding window is obtained, the aspect ratio of the minimum circumscribed rectangle of the closed area is calculated, the connecting line between the centroid point of the closed area and each edge pixel point in the closed area is obtained, the information entropy of the angle between all the connecting lines of the closed area and the horizontal line is calculated, recorded as edge information entropy, the ratio of the aspect ratio to the texture information regularity factor of the sliding window is calculated, and the defect characteristic degree of each sliding window belonging to the rough area is the product of the ratio and the edge information entropy; The method of determining the defect influence of each sliding window is as follows: taking the opposite number of the minimum distance as the exponent of an exponential function with a natural constant as the base, recorded as a first exponential function, and the defect influence of each sliding window belonging to the rough area is the calculation result of the first exponential function.
8. The automobile shock absorber piston defect detection method according to claim 1, characterized in that: The method of modifying the preset initial step size of each sliding window by using the defect characteristic degree and defect influence degree of each sliding window includes: The corrected step size of each sliding window The calculation method is: ; Wherein, d is the preset initial step size of each sliding window, F[] is the upward rounding function, T is the defect characteristic 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, wherein each sliding window includes each sliding window belonging to the smooth area and each sliding window belonging to the rough area.
9. A device for detecting defects in automobile shock absorber pistons, wherein a computer program is stored in the device, characterized in that: When the computer program is executed by a processor, the method for detecting defects in an automobile shock absorber piston as described in any one of claims 1 to 8 is implemented.
10. A vehicle 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, the steps of the method according to any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Plastic product surface defect detection method
CN115311270A
Screen defect detection method and device, equipment and storage medium
CN117078655A
Surface defect detection method, device and equipment and storage medium thereof
CN117197081A
Defect positioning method and system for non-ferrous metal part
CN118397003A
Defect analysis method and system based on pipeline butt weld radiograph
CN118941547A
Cited By
Carbon fiber piston assembly visual verification method, system and equipment
CN121708007A