Piston ring detection method and system and storage medium
Through grayscale image processing and integrated detection system, the problem of low degree of piston ring detection is solved, and efficient and accurate piston ring quality detection is achieved.
Patent Information
- Application Number
- CN202510374234.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-27
- Publication Date
- 2025-07-18
AI Technical Summary
The existing piston ring quality detection device has low degree of automation, and the result is that it is subjectively affected by people, and multiple equipments are required to repeatedly test, which is inefficient.
Automatic detection methods based on grayscale image processing are adopted, including brightness correction, edge extraction and size measurement, combined with visual detection devices and computing devices, and integrated multiple detection projects to reduce human intervention.
The automation of piston ring quality detection is realized, the detection accuracy and efficiency are improved, human error is reduced, and the detection process is simplified.
Smart Images

Figure CN120333292A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of automated detection, and particularly to a piston ring detection method, a detection system, and a storage medium. Background Art
[0002] Most of the existing piston ring quality detection devices can only detect a certain characteristic of the piston ring, either the size, or the surface defect, or the light leakage. The automation degree of the detection equipment is low, the result judgment is greatly affected by human subjectivity, and the dependence on people is high. The automation degree is low. The integration degree is low. To meet all the quality inspections of a workpiece, usually more than three devices are required for detection. The final quality report can only be obtained by repeatedly detecting a workpiece, resulting in low efficiency. Summary of the Invention
[0003] To solve at least one problem of the prior art, the present disclosure provides a piston ring detection method, a detection system, and a storage medium.
[0004] According to one aspect of the present disclosure, a piston ring detection method is provided, including the following steps: obtaining a grayscale image of a piston ring; performing a first processing operation on the grayscale image to highlight the light leakage area of the piston ring; counting the area of the light leakage area and comparing the counted area with a reference value; performing a second processing operation on the grayscale image after the first processing operation to highlight the contour of the piston ring; measuring the dimensional indexes of the piston ring from the contour of the piston ring and comparing the dimensional indexes with a reference value.
[0005] In some embodiments, before image acquisition, a standard calibration plate can be used to perform geometric correction on the imaging system to establish a linear conversion relationship between pixels and actual dimensions. After all the detections are completed, the detection steps are terminated.
[0006] In some embodiments, the first processing operation includes calculating the grayscale value of each point in the image through linear transformation to perform brightness correction on the grayscale image, and the calculation formula is:
[0007] dst[i] = src[i] * gain + offset
[0008] src[i] represents the current grayscale value of the input image, dst[i] represents the current grayscale value of the output image, and its value is bounded within the range of [0, 255]. gain represents the brightness correction gain, and offset represents the brightness correction compensation. If the calculation result is less than 0, then 0 is taken; if the calculation result is greater than 255, then 255 is taken.
[0009] In some embodiments, the brightness-corrected picture is binarized, and the ROI region is drawn according to the ring gauge, and the number of pixel points with a grayscale value of 255 within the ROI region is counted to obtain the light leakage area.
[0010] In some embodiments, the second processing operation includes performing contrast enhancement processing, sharpening processing, and hard threshold binarization processing on the grayscale image that has undergone the first processing operation.
[0011] In some embodiments, the sharpening processing includes calculating the difference between each point in the grayscale image that has undergone the first processing operation and the mean value of the surrounding area, then amplifying this difference using a sharpening intensity, and adding this amplified difference to the original image to obtain the sharpened image.
[0012] In some embodiments, the binarization processing includes performing image binarization according to a preset low grayscale threshold and high grayscale threshold. When the grayscale value of the input image pixel point is greater than the low grayscale threshold or less than the high grayscale threshold, it is the target, otherwise it is the background. The grayscale value of the target is 255, and the grayscale value of the background is converted to 0.
[0013] In some embodiments, the size index includes the radial size. On the grayscale image that has undergone the second processing operation, an ROI region is longitudinally selected, the edge features are extracted by the canny operator, the edge line segments of the piston ring are fitted, the number of pixel points between the corresponding line segments is measured, and then it is corresponded to the actual radial width of the piston ring to obtain the conversion ratio between the two, and thus the radial width of the piston ring can be obtained.
[0014] In some embodiments, the size index includes the opening width. The opening position is obtained by fast matching, the edge features are extracted by the canny operator, the edge line segments of the opening are fitted, and the number of pixel points between the corresponding line segments is measured to obtain the opening width.
[0015] In some embodiments, the fast matching based on edge points includes:
[0016] Creating a template based on specific image features;
[0017] Searching for the target matching the template in the image through the template;
[0018] The template matching based on edge points follows the following formula representation:
[0019]
[0020] where x is the translation amount of the template on the x-axis, y is the translation amount of the template on the y-axis, θ is the rotation angle of the template, scaleX is the scaling scale of the template on the x-axis, scaleY is the scaling scale of the template on the y-axis,
[0021] The feature of the image to be matched is F s , and the template feature is F m, the function S = (Fm, Fs) measures the similarity score between the template features and the features of the image to be matched.
[0022] A similarity score can be calculated for each specific set of (x, y, θ, scaleX, scaleY).
[0023] After traversing all the values of (x, y, θ, scaleX, scaleY), the n results with the highest similarity scores that reach the threshold are taken as the output.
[0024] According to another aspect of the present disclosure, there is provided a piston ring detection system, including: a vision detection device adapted to acquire an image of a piston ring; and a computing device adapted to perform a first processing operation and a second processing operation in the piston ring detection method.
[0025] According to another aspect of the present disclosure, there is provided a storage medium storing computer software that executes the piston ring detection method.
[0026] The piston ring detection method of the present disclosure can be automatically implemented on a machine. The detection result eliminates the influence of human subjective factors and has a high detection accuracy. All the detection items related to the piston ring quality are integrated together to complete, greatly improving the detection efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 is a flowchart of the piston ring detection method according to some embodiments of the present disclosure. DETAILED DESCRIPTION
[0028] Hereinafter, embodiments of the technical solution of the present application will be described in detail with reference to the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present application, and therefore are only examples and should not be used to limit the protection scope of the present application.
[0029] As Figure 1 shown, according to one aspect of the present disclosure, there is provided a piston ring detection method for identifying whether there are defects in a piston ring based on a detection image of the piston ring.
[0030] According to an exemplary embodiment of the present disclosure, the piston ring detection method includes the step of acquiring a grayscale image of the piston ring.
[0031] Before image acquisition, a standard calibration plate is used to perform geometric correction on the imaging system to establish a linear conversion relationship between pixels and actual dimensions. The piston ring can be assembled in a standard ring gauge. When the piston ring is moved to the center of the imaging system field of view, the photographing is triggered to complete the image acquisition, and then the acquired RGB image is converted into a grayscale image.
[0032] According to an exemplary embodiment of the present disclosure, the piston ring detection method includes a step of performing a first processing operation on a grayscale image to highlight the light leakage area of the piston ring.
[0033] The first processing operation includes an operation of performing brightness correction on the grayscale image. By performing brightness correction, the light leakage area of the piston ring can be highlighted. For example, the first processing operation includes calculating the grayscale value of each point in the image through linear transformation to perform brightness correction on the grayscale image. The calculation formula is:
[0034] dst[i] = src[i] * gain + offset
[0035] src[i] represents the current grayscale value of the input image, dst[i] represents the current grayscale value of the output image, whose value is defined within the range of [0, 255], gain represents the brightness correction gain, and offset represents the brightness correction compensation. If the calculation result is less than 0, then 0 is taken; if the calculation result is greater than 255, then 255 is taken.
[0036] According to an exemplary embodiment of the present disclosure, the piston ring detection method includes a step of counting the area of the light leakage area and comparing the counted area with a reference value. The image after brightness correction can be subjected to binarization processing. The binarization processing includes performing image binarization according to a preset low grayscale threshold and high grayscale threshold. When the grayscale value of the pixel point of the input image is greater than the low grayscale threshold or less than the high grayscale threshold, it is a target, otherwise it is a background. The grayscale value of the target is 255, and the grayscale value of the background is converted to 0. Draw an ROI area (region of interest) according to the ring gauge. Counting the number of pixel points with a grayscale value of 255 within the ROI area can obtain the light leakage area. If the light leakage area is outside the reference value, a result indicating that the light leakage area of the current piston ring is unqualified is output. If the light leakage area is within the reference value, a result indicating that the light leakage area of the current piston ring is qualified is output, and the detection steps for other defects are executed.
[0037] According to an exemplary embodiment of the present disclosure, the piston ring detection method includes a step of performing a second processing operation on the grayscale image after the first processing operation to highlight the contour of the piston ring. The second processing operation includes performing contrast enhancement processing, sharpening processing, and hard threshold binarization processing on the grayscale image that has undergone the first processing operation.
[0038] Contrast enhancement is achieved by increasing the fluctuation amplitude of the grayscale values of all pixel points around a certain mean value, increasing the brightness difference of the image features, so as to more easily distinguish the information in the image.
[0039] The sharpening process includes calculating the difference between each point in the grayscale image after the first processing operation and the mean value of the surrounding area, then amplifying this difference using the sharpening intensity, and adding the amplified difference to the original image to obtain the sharpened image.
[0040] Image binarization is performed according to a preset low grayscale threshold and high grayscale threshold. When the grayscale value of an input image pixel point is greater than the low grayscale threshold or less than the high grayscale threshold, it is a target (the grayscale value is converted to 255), otherwise it is a background (the grayscale value is converted to 0).
[0041] The order of the steps of the piston ring detection method, which includes the steps of statistically calculating the area of the light leakage area and comparing the statistical area with a reference value and performing a second processing operation on the grayscale image after the first processing operation to highlight the contour of the piston ring, can be interchanged.
[0042] According to an exemplary embodiment of the present disclosure, the piston ring detection method includes the steps of measuring the size index of the piston ring measured from the contour of the piston ring and comparing the size index with a reference value. If the size index is outside the reference value, an unqualified result is output. If the size index is within the reference value, a qualified result is output, or the detection steps for other defects are performed.
[0043] The size index includes the radial dimension. On the grayscale image after the second processing operation, an ROI region is longitudinally selected (for example, one segment is selected every 10°), the edge features are extracted through the canny operator, the edge line segments of the piston ring are fitted, the number of pixel points between the corresponding line segments is measured, and then it is corresponded to the radial width of the actual piston ring to obtain the conversion ratio between the two, and thus the radial width of the piston ring can be obtained. The conversion ratio can be obtained through the geometric correction of the calibration plate.
[0044] The size index includes the opening width. The opening position is obtained through fast matching, the edge features are extracted through the canny operator, the edge line segments of the opening are fitted, and the number of pixel points between the corresponding line segments is measured to obtain the opening width.
[0045] The fast matching based on edge points includes: the step of creating a template based on specific image features and the step of searching for a target matching the template in the image through the template.
[0046] The template matching based on edge points follows the following formula:
[0047]
[0048] where x is the translation amount of the template on the x-axis, y is the translation amount of the template on the y-axis, θ is the rotation angle of the template, scaleX is the scaling scale of the template on the x-axis, scaleY is the scaling scale of the template on the y-axis, and the feature of the image to be matched is F s, the template feature is F m , the similarity function S=(Fm, Fs) measures the similarity score between the template feature and the feature of the image to be matched. A similarity score can be calculated for each specific set of (x, y, θ, scaleX, scaleY). After traversing all the values of (x, y, θ, scaleX, scaleY), the n results with the similarity scores reaching the threshold and being the highest are taken as the output.
[0049] In some embodiments, a pyramid hierarchical search algorithm can be used to gradually narrow down the range of (x, y, θ, scaleX, scaleY). Compared with traversing all the values of (x, y, θ, scaleX, scaleY), using the pyramid hierarchical search algorithm to gradually narrow down the parameter range can reduce the amount of calculation and improve the calculation efficiency.
[0050] The pyramid hierarchical search algorithm includes the following steps:
[0051] S10: Construct an image pyramid.
[0052] The pyramid of an image is a set of images arranged in a pyramid shape with gradually decreasing resolutions. The bottom of the pyramid is the high-resolution representation of the image, that is, the original image, and the top is the low-resolution approximation. The resolution of the bottom layer is the highest and the data volume is the largest. As the number of layers increases, its resolution gradually decreases and the data volume also decreases proportionally.
[0053] Input the grayscale image of the piston ring to be matched and the template image. Perform Gaussian blur and downsampling on each layer of the image. The number of pyramid layers is usually selected as 3 - 5 layers. Taking a 3-layer pyramid as an example, the original pixel resolution of the 0th layer (such as 1024×1024), the resolution of the 1st layer image is 512×512, and the resolution of the 2nd layer image is 256×256.
[0054] S20: Determine the initial search range.
[0055] Determine the initial parameter range of the top layer image (the lowest resolution) of the pyramid, where
[0056] Position range: x∈[0, W top , y∈[0, H top , (W top , H top ) are the width and height of the top layer image.
[0057] Rotation angle: θ∈[-30°, 30°].
[0058] Scale range: scaleX∈[0.8, 1.2], scaleY∈[0.8, 1.2], step size 0.1.
[0059] S30: Perform a hierarchical search process.
[0060] Refine the search layer by layer from the top - layer image to the bottom - layer image. Specifically, it includes the following steps in sequence:
[0061] Perform a rough search on the top - layer image. Exemplarily, match all combinations of (x, y, θ, scaleX, scaleY) in the top - layer image, traverse the parameter space, and use the similarity function S = Similarity(F m , F s ) to calculate the similarity, where the feature of the image to be matched is F s , and the template feature is F m . Finally, retain the top n candidates with the highest similarity, for example, n = 10.
[0062] Perform a refined search on the middle - layer image. Exemplarily, narrow the parameter range. For example, center the position range at (x, y) of the top - layer result and narrow it to ±5 pixels, narrow the range of the rotation angle θ to ±2°, and narrow the scale range (scaleX, scaleY) to ±0.05. Recalculate the similarity at the middle - layer resolution, and finally retain the new top n candidates, for example, n = 10.
[0063] Perform an exact match on the bottom - layer image. Exemplarily, adjust the position range to ±5 pixels, adjust the step size of the rotation angle θ to 0.5°, and the step size of the scale range (scaleX, scaleY) to 0.01. Select the parameter combination (x * , y * , θ * , scaleX * , scaleY * ) with the highest similarity.
[0064] S40: Calculate and filter similarities. Exemplarily, calculate the similarity according to the similarity formula , where δ is a feature - point matching function (such as the distance of binary features). Finally, remove candidates whose overlap rate with the selected results exceeds a threshold (such as 50%).
[0065] According to another aspect of the present disclosure, a piston - ring detection system is provided, including a vision detection device and a computing device. The vision detection device is suitable for acquiring images of piston rings. The computing device is suitable for performing the first processing operation and the second processing operation in the piston - ring detection method. The vision detection device may include a high - resolution industrial camera, an illumination system, and an image acquisition card. The computing device may be a computer, which can run image - processing software and can be used to perform processing such as denoising, enhancement, edge detection, and feature extraction on the acquired images. It can also run machine - learning or deep - learning algorithms for identifying and analyzing defect features in the images.
[0066] According to another aspect of the present disclosure, a storage medium is provided, storing computer software that executes the piston ring detection method.
[0067] The piston ring detection method of the present disclosure can be automatically implemented on a machine. The detection result eliminates the influence of human subjective factors and has a high detection accuracy. All the detection items related to the piston ring quality are integrated to complete, greatly improving the detection efficiency.
[0068] The above are only some embodiments of the present invention. For those of ordinary skill in the art, without departing from the inventive concept of the present invention, several deformations and improvements can still be made, and these all belong to the protection scope of the present invention.
Claims
1. A piston ring detection method, characterized in that, Including the following steps: Obtain a grayscale image of the piston ring; Perform a first processing operation on the grayscale image to highlight the light leakage area of the piston ring; Statistically calculate the area of the light leakage area and compare the statistical area with a reference value; Perform a second processing operation on the grayscale image after the first processing operation to highlight the contour of the piston ring; Measure the dimensional index of the piston ring measured from the contour of the piston ring and compare the dimensional index with a reference value.
2. The piston ring detection method according to claim 1, characterized in that, Before image acquisition, use a standard calibration plate to perform geometric correction on the imaging system and establish a linear conversion relationship between pixels and actual dimensions.
3. The piston ring detection method according to claim 1, characterized in that, The first processing operation includes calculating the grayscale value of each point in the image through linear transformation to perform brightness correction on the grayscale image. The calculation formula is: dst[i] = src[i] * gain + offset src[i] represents the current grayscale value of the input image, dst[i] represents the current grayscale value of the output image, whose value is bounded within the range of [0, 255], gain represents the brightness correction gain, and offset represents the brightness correction compensation; If the calculation result is less than 0, take 0; if the calculation result is greater than 255, take 255.
4. The piston ring detection method according to claim 3, characterized in that Perform binary processing on the brightness-corrected image, draw the ROI area according to the ring gauge, and count the number of pixels with a grayscale value of 255 within the ROI area to obtain the light leakage area.
5. The piston ring detection method according to claim 1, characterized in that, The second processing operation includes performing contrast enhancement processing, sharpening processing, and hard threshold binary processing on the grayscale image that has undergone the first processing operation.
6. The piston ring detection method according to claim 5, characterized in that, The sharpening processing includes calculating the difference between each point in the grayscale image after the first processing operation and the average value of the surrounding area, then magnifying this difference using the sharpening intensity, and adding this magnified difference to the original image to obtain the sharpened image.
7. The piston ring detection method according to claim 5, characterized in that, The binary processing includes performing image binaryization according to a preset low grayscale threshold and high grayscale threshold. When the grayscale value of the input image pixel is greater than the low grayscale threshold or less than the high grayscale threshold, it is the target, otherwise it is the background. The grayscale value of the target is 255, and the grayscale value of the background is converted to 0.
8. The piston ring inspection method according to claim 1, wherein, The dimensional index includes the radial dimension. On the grayscale image after the second processing operation, longitudinally select the ROI area, extract the edge features through the canny operator, fit the edge line segments of the piston ring, measure the number of pixel points between the corresponding line segments, and then correspond to the radial width of the actual piston ring to obtain the conversion ratio between the two, and the radial width of the piston ring can be obtained. The conversion ratio is obtained through the geometric correction of the calibration plate.
9. The piston ring detection method according to claim 1, characterized in that, The dimensional index includes the opening width. Obtain the opening position through fast matching, extract the edge features through the canny operator, fit the opening edge line segments, and measure the number of pixel points between the corresponding line segments to obtain the opening width.
10. The piston ring detection method according to claim 9, wherein, The fast matching based on edge points includes: Create a template based on specific image features; Search for targets in the image that match the template through the template; The template matching based on edge points follows the following formula: where x is the translation amount of the template along the x-axis, y is the translation amount of the template along the y-axis, θ is the rotation angle of the template, scaleX is the scaling factor of the template along the x-axis, and scaleY is the scaling factor of the template along the y-axis. The feature of the image to be matched is F s , and the template feature is F m . The function S = (Fm, Fs) then measures the similarity score between the template feature and the feature of the image to be matched A similarity score can be calculated for each specific set of (x, y, θ, scaleX, scaleY). After traversing all the values of (x, y, θ, scaleX, scaleY), the n results with the highest similarity scores that reach the threshold are taken as the output.
11. A piston ring detection system, characterized in that, Including: A visual detection device suitable for obtaining an image of a piston ring; And A computing device suitable for performing the first processing operation and the second processing operation in the piston ring detection method according to any one of claims 1 to 10.
12. Storage medium, characterized in that, Stored computer software that executes the piston ring detection method according to any one of claims 1-10.