A crankshaft machining positioning method based on computer vision
By calculating the crankshaft edge change index and centrifugal positioning edge reference coefficient, the crankshaft positioning reference point and the alternative pixel points of the central hole are obtained, which solves the problem of difficulty in positioning the crankshaft irregular end face shape and achieves higher accuracy of the crankshaft center hole positioning.
Patent Information
- Application Number
- CN202410688958.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-30
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2044-05-30
AI Technical Summary
The existing computer vision technology cannot effectively position the irregular end face shape of the crankshaft during crankshaft processing, resulting in large errors in the positioning of the central hole, which in turn increases the subsequent machining error.
By acquiring crankshaft images, calculating the crankshaft edge change index, determining the near-center and centrifugal positioning edges, and obtaining the positioning reference point and the central hole alternative pixel points based on the reference coefficient of the centrifugal positioning edge, building a positioning reference window, and calculating the reference point matching index to achieve precise positioning of the central hole.
This method can effectively utilize useful information in the crankshaft image, reduce positioning errors, and improve the accuracy of positioning of the center hole of the crankshaft.
Smart Images

Figure CN118608602B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of image processing, and in particular to a crankshaft machining positioning method based on computer vision. Background Art
[0002] The crankshaft is an important component in mechanical equipment such as internal combustion engines. Its processing accuracy and positioning accuracy are crucial to the performance and reliability of the equipment. Computer vision technology refers to the technology of using computers to process and analyze images or videos, which can achieve tasks such as detection, identification and positioning of targets in images. By collecting image data on the crankshaft surface and using image processing algorithms to perform image processing and feature extraction, the crankshaft can be automatically positioned.
[0003] In the crankshaft processing technology, the positioning reference includes the choice of geometric center and mass center. For precision casting and precision forging blanks, the geometric center hole is the best choice for positioning because of its good quality and high precision. At the same time, the accurate positioning of the center hole can ensure the coincidence and unification of the process reference and the design reference. Unlike other parts in the automobile engine structure, the crankshaft is composed of multiple parts such as the crank and the balance weight. There is a certain eccentricity between each part, which causes the axial image of the crankshaft to form an irregular shape. At present, in the process of positioning the center hole of the crankshaft processing by computer vision, it is impossible to adjust the irregular end face shape of the crankshaft, resulting in a large error in the positioning of the center hole, which in turn causes an increase in the error of subsequent crankshaft processing. Summary of the invention
[0004] In order to solve the above technical problems, a crankshaft processing positioning method based on computer vision is provided to solve the existing problems.
[0005] The solution to the technical problem of the present application is to provide a crankshaft machining positioning method based on computer vision, comprising the following steps:
[0006] Collecting a crankshaft image, obtaining a crankshaft edge image, and acquiring each crankshaft positioning edge on the crankshaft edge image;
[0007] According to the change difference of each edge pixel point on the crankshaft positioning edge, the crankshaft edge change index of each crankshaft positioning edge is calculated to determine each crankshaft proximal positioning edge and crankshaft eccentric positioning edge;
[0008] Calculate the crankshaft centrifugal positioning edge reference coefficient of each edge pixel point on each crankshaft centrifugal positioning edge according to the local changes and distribution characteristics of each edge pixel point within each crankshaft centrifugal positioning edge;
[0009] Based on the crankshaft centrifugal positioning edge reference coefficient, the crankshaft positioning reference points of all crankshaft positioning edges and all crankshaft center hole candidate pixel points are obtained;
[0010] Construct a crankshaft positioning reference window, and calculate the crankshaft reference point matching index of each crankshaft positioning reference point in the crankshaft positioning reference window of each crankshaft center hole candidate pixel point according to the deviation difference between each crankshaft positioning reference point in the window and the crankshaft center hole candidate pixel point;
[0011] Based on the crankshaft reference point matching index, the crankshaft center hole position matching degree of each crankshaft center hole candidate pixel point is calculated to locate the crankshaft center hole.
[0012] Preferably, the calculating of the crankshaft edge variation index of each crankshaft positioning edge comprises:
[0013] Obtaining the coordinates of all edge pixel points in the crankshaft edge image, performing curve fitting on all edge pixel points of the same crankshaft positioning edge, and obtaining the crankshaft edge curve of each crankshaft positioning edge;
[0014] Obtaining the curvature of each edge pixel point on the crankshaft edge curve of each crankshaft positioning edge, and recording it as the curvature of each edge pixel point of each crankshaft positioning edge;
[0015] Obtain the maximum curvature, minimum curvature and curvature standard deviation of each crankshaft positioning edge;
[0016] taking the difference between the maximum curvature and the minimum curvature as the absolute difference in curvature of each crankshaft positioning edge;
[0017] The number of pixel points of each crankshaft positioning edge is obtained, and the number of pixel points of all crankshaft positioning edges is normalized to serve as the edge change weighting coefficient of each crankshaft positioning edge;
[0018] The curvature standard deviation, the curvature absolute difference and the edge variation weighted coefficient are forward fused to serve as the crankshaft edge variation index of each crankshaft positioning edge.
[0019] Preferably, the method for determining the proximal positioning edge of each crankshaft and the centrifugal positioning edge of the crankshaft is:
[0020] Analyze the average of the crankshaft edge variation indexes of all crankshaft positioning edges as the crankshaft edge variation threshold;
[0021] If the crankshaft edge variation index of a crankshaft positioning edge is less than or equal to the crankshaft edge variation threshold, the crankshaft positioning edge is recorded as the crankshaft proximal positioning edge; if the crankshaft edge variation index of a crankshaft positioning edge is greater than the crankshaft edge variation threshold, the crankshaft positioning edge is recorded as the crankshaft eccentric positioning edge.
[0022] Preferably, the calculation of the crankshaft centrifugal positioning edge reference coefficient of each edge pixel point on each crankshaft centrifugal positioning edge includes:
[0023] Calculate the local crankshaft edge change index of each edge pixel point on each crankshaft centrifugal positioning edge according to the local change of each edge pixel point on each crankshaft centrifugal positioning edge;
[0024] Calculate the crankshaft centrifugal edge symmetry weight of each edge pixel point on each crankshaft centrifugal positioning edge according to the distribution of the curvature of each edge pixel point on each crankshaft centrifugal positioning edge;
[0025] The crankshaft centrifugal positioning edge reference coefficient of each edge pixel point on each crankshaft centrifugal positioning edge is in a positive cooperative relationship with the local crankshaft edge variation index and the crankshaft centrifugal edge symmetry weight.
[0026] Preferably, the calculation method of the local crankshaft edge variation index is:
[0027] A local window is constructed with each edge pixel point on the centrifugal positioning edge of each crankshaft as the center;
[0028] The crankshaft centrifugal positioning edge contained in the local window of each edge pixel point is recorded as the crankshaft centrifugal reference edge;
[0029] The crankshaft edge variation index of the crankshaft centrifugal reference edge is calculated and recorded as the local crankshaft edge variation index of each edge pixel point on each crankshaft centrifugal positioning edge.
[0030] Preferably, the calculation method of the crankshaft centrifugal edge symmetry weight is:
[0031] Calculate the curvature skewness of the crankshaft centrifugal reference edge according to the skewness of the curvature of all edge pixel points on the crankshaft centrifugal reference edge;
[0032] The crankshaft centrifugal edge symmetry weight of each edge pixel point on each crankshaft centrifugal positioning edge is in a positive cooperative relationship with the curvature skewness.
[0033] Preferably, the method for acquiring the crankshaft positioning reference points of all crankshaft positioning edges and all crankshaft center hole candidate pixel points is:
[0034] Obtaining the edge pixel point corresponding to the minimum crankshaft centrifugal positioning edge reference coefficient among all edge pixel points of each crankshaft centrifugal positioning edge, and recording the crankshaft centrifugal reference edge corresponding to the edge pixel point as the crankshaft centrifugal optimal reference edge;
[0035] Obtaining the center of each crankshaft proximal positioning edge and the center of the crankshaft centrifugal optimal reference edge;
[0036] The center of the crankshaft centrifugal optimal reference edge is used as the center of each crankshaft centrifugal positioning edge, and the center of each crankshaft proximal positioning edge and the crankshaft centrifugal positioning edge are recorded as crankshaft positioning reference points;
[0037] Obtain the coordinates of all crankshaft positioning reference points and perform linear fitting, and the fitted straight line is recorded as the crankshaft machining reference line;
[0038] All edge pixel points located on the crankshaft machining reference line in all crankshaft edge images are recorded as candidate pixel points for the crankshaft center hole.
[0039] Preferably, the crankshaft reference point matching index is calculated as follows:
[0040] Taking each candidate pixel point of the crankshaft center hole as the central pixel point, a local window is constructed, which is recorded as the crankshaft positioning reference window of each candidate pixel point of the crankshaft center hole;
[0041] Calculating the eccentricity distance of the crankshaft center hole of each crankshaft positioning reference point in the crankshaft positioning reference window of each crankshaft center hole candidate pixel point according to the position difference between each crankshaft positioning reference point in the crankshaft positioning reference window and the crankshaft center hole candidate pixel point;
[0042] Each crankshaft positioning reference point in the crankshaft positioning reference window corresponds to a crankshaft positioning edge, and each crankshaft positioning edge corresponds to a crankshaft edge variation index;
[0043] The crankshaft reference reference weight of each crankshaft positioning reference point within the crankshaft positioning reference window of each crankshaft center hole candidate pixel point is in a negative synergistic relationship with the corresponding crankshaft edge variation index;
[0044] Based on the crankshaft reference weight and the eccentricity of the crankshaft center hole, the crankshaft reference point matching index of each crankshaft positioning reference point within the crankshaft positioning reference window of each crankshaft center hole candidate pixel point is determined, wherein the crankshaft reference point matching index is positively coordinated with the crankshaft reference weight and negatively coordinated with the eccentricity of the crankshaft center hole.
[0045] Preferably, the calculation method of the eccentric distance of the crankshaft center hole is:
[0046] Preset eccentricity distance trimming index;
[0047] The distance between each crankshaft positioning reference point and the central pixel point in the crankshaft positioning reference window is recorded as the offset difference distance of each crankshaft positioning reference point in the crankshaft positioning reference window;
[0048] The eccentric distances of the crankshaft center hole of each crankshaft positioning reference point within the crankshaft positioning reference window of each crankshaft center hole candidate pixel point are respectively in a positive cooperative relationship with the preset eccentric distance trimming index and the offset difference distance.
[0049] Preferably, the calculating the crankshaft center hole position matching degree of each crankshaft center hole candidate pixel point to locate the crankshaft center hole includes:
[0050] The reference matching coefficient of the crankshaft positioning reference window of each candidate pixel point of the crankshaft center hole is respectively in a positive cooperative relationship with the crankshaft reference point matching index of all crankshaft positioning reference points in the crankshaft positioning reference window;
[0051] Obtain the number of all crankshaft positioning reference points within the crankshaft positioning reference window of each crankshaft center hole candidate pixel point, recorded as the local reference number;
[0052] The crankshaft center hole position matching degree of each crankshaft center hole candidate pixel point is in a positive cooperative relationship with the reference matching coefficient and the local reference quantity respectively;
[0053] The coordinate position of the candidate pixel point of the crankshaft center hole corresponding to the maximum crankshaft center hole position matching degree is obtained as the position of the crankshaft center hole.
[0054] This application has at least the following beneficial effects:
[0055] The present application analyzes the change difference of each edge pixel point on the crankshaft positioning edge, calculates the crankshaft edge change index, determines each crankshaft proximal positioning edge and crankshaft centrifugal positioning edge, and has the beneficial effect of classifying the crankshaft positioning edges corresponding to different crankshaft components, adopting different processing methods for different edges, and improving the utilization rate of the crankshaft grayscale image information; according to the local change and distribution characteristics of each edge pixel point in each crankshaft centrifugal positioning edge, the crankshaft centrifugal positioning edge reference coefficient is calculated, and the beneficial effect is that the interference of irregular edges on the positioning of the crankshaft center hole can be eliminated; the crankshaft positioning reference point and the crankshaft center hole candidate pixel point are obtained by random Hough transform, and the crankshaft reference point matching index is calculated according to the deviation between the crankshaft positioning reference point and the crankshaft center hole candidate pixel point, and the crankshaft center hole position matching degree of each crankshaft center hole candidate pixel point is obtained, the positioning of the crankshaft center hole is completed, and the target detection and positioning of the crankshaft image is realized, and the beneficial effect is that the useful information of each part of the image is fully utilized, and the error generated when only one set of edges in the image is used to locate the crankshaft center hole is greatly reduced, and the accuracy of the positioning of the crankshaft center hole is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] A crankshaft machining positioning method based on computer vision of the present application is further described in detail below in conjunction with the accompanying drawings.
[0057] Figure 1 A flowchart of the steps of a crankshaft machining positioning method based on computer vision provided in this application;
[0058] Figure 2 A flowchart of the steps of a method for obtaining a crankshaft centrifugal positioning edge reference coefficient for each edge pixel point on each crankshaft centrifugal positioning edge provided by the present application;
[0059] Figure 3 A flowchart of the steps of a method for obtaining a crankshaft reference point matching index for each crankshaft positioning reference point within a crankshaft positioning reference window for each crankshaft center hole candidate pixel point provided in the present application. DETAILED DESCRIPTION
[0060] In order to make the purpose, technical solution and advantages of the present application more clear, the following is a further detailed description of a crankshaft machining positioning method based on computer vision proposed in the present application in combination with the accompanying drawings and implementation examples. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0061] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs.
[0062] See also Figure 1 , which shows a flowchart of a crankshaft machining positioning method based on computer vision provided by an embodiment of the present application, the method comprising the following steps:
[0063] Step 1: collect a crankshaft image, obtain a crankshaft edge image, and obtain each crankshaft positioning edge on the crankshaft edge image.
[0064] The camera is fixed in front of the front end axial surface of the crankshaft, and the camera lens is aimed at the center hole of the front end surface of the crankshaft to collect the crankshaft image.
[0065] The collected crankshaft image is preprocessed to obtain the crankshaft grayscale image to improve the accuracy of subsequent crankshaft center hole positioning. Secondly, the crankshaft image coordinate system is constructed with the center point of the crankshaft end face.
[0066] Preferably, as an embodiment of the present application, a median filtering algorithm is used to denoise the crankshaft image, and the denoised crankshaft image is converted into a grayscale image to obtain a crankshaft grayscale image. As other implementation methods, the implementer may use other methods to pre-process the crankshaft image to obtain a crankshaft grayscale image, and this embodiment does not impose any special restrictions on this.
[0067] There are several cranks in the crankshaft, and the shapes of the crank and the counterweight of the crankshaft are quite different, resulting in irregular edges in the crankshaft grayscale image. Only using the outermost edge of the crankshaft grayscale image to determine the center hole position of the crankshaft not only underutilizes the image information of the front shaft and rear shaft in the crankshaft grayscale image, but also the eccentricity between different cranks will introduce a large error in the positioning of the center hole. Therefore, it is necessary to use the edge information of each crankshaft component in the crankshaft grayscale image for analysis.
[0068] An edge detection algorithm is used to perform edge detection on the crankshaft grayscale image, and the obtained edge image is binarized to obtain a binary edge detection image, which is recorded as the crankshaft edge image;
[0069] Preferably, as an embodiment of the present application, the Canny algorithm is used for edge detection.
[0070] It is understandable that this embodiment only provides an edge detection algorithm, namely the Canny algorithm. As other implementation methods, implementers can use other edge detection algorithms to perform edge detection on images, such as Sobel edge detection, Laplace LOG edge detection, etc. This embodiment does not impose any special restrictions on this.
[0071] Marking the connected domains of edge pixels in the crankshaft edge image, and marking edge pixels in different connected domains as different crankshaft positioning edges;
[0072] Preferably, as an embodiment of the present application, a Seed-Filling algorithm is used to mark connected domains to obtain different crankshaft positioning edges.
[0073] It is understandable that this embodiment only provides a connected domain labeling method, namely, the Two-Pass algorithm. As other implementations, the implementer may use other connected domain labeling methods to obtain different crankshaft positioning edges, such as the Seed-Filling algorithm, etc. This embodiment does not impose any special restrictions on this. At this point, the crankshaft edge image is obtained, and each crankshaft positioning edge on the crankshaft edge image is determined.
[0074] Step 2: Calculate the crankshaft edge variation index of each crankshaft positioning edge according to the variation difference of each edge pixel point on the crankshaft positioning edge, and determine the proximal positioning edge and the eccentric positioning edge of each crankshaft.
[0075] Furthermore, if the local edge of the crankshaft positioning edge is not smooth, it will be detrimental to the subsequent positioning of the center hole of the crankshaft image. Therefore, it is necessary to measure the local smoothness of the crankshaft positioning edge.
[0076] Obtaining the coordinates of all edge pixel points in the crankshaft edge image, performing curve fitting on all edge pixel points of the same crankshaft positioning edge, and obtaining the crankshaft edge curve of each crankshaft positioning edge;
[0077] Preferably, as an embodiment of the present application, a Bezier curve fitting algorithm is used to obtain the crankshaft edge curve of each crankshaft positioning edge.
[0078] It is understandable that this embodiment only provides a curve fitting algorithm, namely, the Bezier curve fitting algorithm. As other implementation methods, the implementer may adopt other curve fitting algorithms in the prior art to obtain the crankshaft edge curve, and this embodiment does not impose any special restrictions on this.
[0079] Obtaining the curvature of each edge pixel point on the crankshaft edge curve of each crankshaft positioning edge, and recording it as the curvature of each edge pixel point of each crankshaft positioning edge;
[0080] The curvature of the edge pixel points of the crankshaft edge image corresponding to the round parts such as the front and rear shafts of the crankshaft does not change much; while the curvature of the crankshaft positioning edge pixels corresponding to the crankshaft edge image of the special-shaped parts such as the crank and the counterweight changes greatly. In addition, the two have different functions in determining the crankshaft center hole. Therefore, it is necessary to distinguish the two to facilitate the subsequent positioning of the crankshaft center hole.
[0081] Furthermore, the average curvatures of different crankshaft positioning edges are different. It is impossible to distinguish different crankshaft positioning edges by only judging the average curvature. Therefore, it is necessary to analyze the distribution of the curvatures of different crankshaft positioning edges. Secondly, the light and shadow interference in the crankshaft grayscale image will cause the obtained crankshaft positioning edge to be distorted, and the smaller the crankshaft positioning edge, the greater the shape change caused by the light and shadow interference. Therefore, the crankshaft edge change index is calculated to reflect the shape change characteristics of the crankshaft positioning edge. The specific method is as follows:
[0082] According to the curvature of each edge pixel point of each crankshaft positioning edge, the maximum curvature, the minimum curvature and the curvature standard deviation of each crankshaft positioning edge are obtained;
[0083] taking the difference between the maximum curvature and the minimum curvature as the absolute difference in curvature of each crankshaft positioning edge;
[0084] The number of pixel points of each crankshaft positioning edge is obtained, and the number of pixel points of all crankshaft positioning edges is normalized to serve as the edge change weighting coefficient of each crankshaft positioning edge;
[0085] Forward fusion of the curvature standard deviation, the curvature absolute difference and the edge variation weighted coefficient is performed as a crankshaft edge variation index of each crankshaft positioning edge;
[0086] It can be understood that positive fusion means that the dependent variable increases as the independent variable increases, and decreases as the independent variable decreases. The specific relationship can be a multiplication relationship, an addition relationship, or the idempotence of an exponential function, which is determined by actual application and this application does not impose any special restrictions on this.
[0087] Preferably, as an embodiment of the present application, the product of the curvature standard deviation, the curvature absolute difference and the edge variation weighting coefficient is used as the crankshaft edge variation index of each crankshaft positioning edge.
[0088] It should be noted that the larger the range of the connected domain, the larger the crankshaft positioning edge, the more edge pixels it contains, and the larger the edge change weighting coefficient; the larger the absolute difference in curvature and the standard deviation of curvature, the more the crankshaft positioning edge deviates from a circle and the more special the shape, the larger the crankshaft edge change index, which reflects the shape characteristics of the crankshaft positioning edge.
[0089] Analyze the average of the crankshaft edge variation indexes of all crankshaft positioning edges as the crankshaft edge variation threshold;
[0090] If the crankshaft edge variation index of a crankshaft positioning edge is less than or equal to the crankshaft edge variation threshold, it is recorded as the crankshaft proximal positioning edge; if the crankshaft edge variation index of a crankshaft positioning edge is greater than the crankshaft edge variation threshold, it is recorded as the crankshaft eccentric positioning edge;
[0091] It should be noted that the shape of the crankshaft's proximal positioning edge is close to a circle, and is the edge produced by components such as the crankshaft's front end shaft; while the shape of the crankshaft's centrifugal positioning edge deviates from a circle, and is the edge produced by components such as the crankshaft's balance weight. Therefore, the edges are divided into two categories, which facilitates subsequent processing of the two separately to improve the positioning accuracy of the crankshaft's center hole.
[0092] At this point, the proximal positioning edge and the eccentric positioning edge of each crankshaft are obtained.
[0093] Step 3, calculating the crankshaft centrifugal positioning edge reference coefficient of each edge pixel point on each crankshaft centrifugal positioning edge according to the local change characteristics of each edge pixel point within each crankshaft centrifugal positioning edge.
[0094] The proximal positioning edge of the crankshaft has good symmetry, and all its pixels can be used to locate the crankshaft center hole; while the centrifugal positioning edge of the crankshaft has good symmetry only in one direction, and the crankshaft component it represents has a certain eccentricity with the crankshaft center, so all its pixels cannot be used to locate the crankshaft center hole, and the pixels that can be used for positioning must be extracted. The specific method is:
[0095] A local window is constructed with each edge pixel point on the centrifugal positioning edge of each crankshaft as the center;
[0096] The crankshaft centrifugal positioning edge contained in the local window of each edge pixel point is recorded as the crankshaft centrifugal reference edge;
[0097] Calculate the crankshaft edge variation index of the crankshaft centrifugal reference edge, and record it as the local crankshaft edge variation index of each edge pixel point on each crankshaft centrifugal positioning edge;
[0098] Preferably, as an embodiment of the present application, a local window with a size of 25×25 is constructed. As other implementation methods, the implementer can set it according to the actual situation, and this embodiment does not make any special explanation for this.
[0099] Furthermore, the parts of the crankshaft such as the counterweight with good symmetry can be used to locate the crankshaft center hole, and when the local window of each pixel point is taken to this part, it shows good symmetry in the window, and the curvature distribution of all edge pixels corresponding to the crankshaft centrifugal reference edge is relatively gentle, and the crankshaft edge variation index is small. At the same time, the symmetric center curvature of the counterweight edge is the smallest, and the curvature value is small, so the skewness of the curvature distribution reflected in the crankshaft centrifugal reference edge is smaller.
[0100] Calculating the curvature skewness of the crankshaft centrifugal reference edge according to the degree of skewness of the curvature of all edge pixel points on the crankshaft centrifugal reference edge;
[0101] The crankshaft centrifugal edge symmetry weight of each edge pixel point on each crankshaft centrifugal positioning edge is in a positive synergistic relationship with the curvature skewness;
[0102] It can be understood that a positive synergistic relationship means that the dependent variable increases as the independent variable increases, and decreases as the independent variable decreases. The specific relationship can be a multiplication relationship, an addition relationship, or the idempotence of an exponential function, which is determined by actual application and this application does not impose any special restrictions on this.
[0103] Preferably, as an embodiment of the present application, the calculation result of an exponential function with a natural constant as the base and the curvature skewness as the exponent is used as the crankshaft centrifugal edge symmetry weight of each edge pixel point on each crankshaft centrifugal positioning edge.
[0104] It should be noted that the crankshaft centrifugal edge symmetry weight reflects the characteristics of the shape change of the crankshaft centrifugal reference edge. When the center of the local window of each pixel point is closer to the symmetry center of the crankshaft centrifugal positioning edge, the crankshaft centrifugal edge symmetry weight is smaller.
[0105] The crankshaft centrifugal positioning edge reference coefficient of each edge pixel point on each crankshaft centrifugal positioning edge is in a positive synergistic relationship with the local crankshaft edge variation index and the crankshaft centrifugal edge symmetry weight;
[0106] Preferably, as an embodiment of the present application, the product of the local crankshaft edge variation index and the crankshaft centrifugal edge symmetry weight is used as the crankshaft centrifugal positioning edge reference coefficient of each edge pixel point on each crankshaft centrifugal positioning edge.
[0107] It should be noted that the size of the crankshaft centrifugal positioning edge reference coefficient reflects the degree of fit between the crankshaft centrifugal reference edge and the symmetrical part of the crankshaft centrifugal positioning edge; when the curvature of the crankshaft centrifugal positioning edge changes more, the greater the deviation from the symmetrical part of the crankshaft centrifugal positioning edge, the greater the crankshaft edge change index, and the corresponding crankshaft centrifugal positioning edge reference coefficient.
[0108] Further, the present application provides a flowchart of the steps of the method for obtaining the crankshaft centrifugal positioning edge reference coefficient of each edge pixel point on each crankshaft centrifugal positioning edge. Figure 2 shown.
[0109] At this point, the crankshaft centrifugal positioning edge reference coefficient of each edge pixel point on each crankshaft centrifugal positioning edge is obtained.
[0110] Step 4: Based on the crankshaft centrifugal positioning edge reference coefficient, the crankshaft positioning reference points of all crankshaft positioning edges and all crankshaft center hole candidate pixel points are obtained.
[0111] Based on the above analysis, the larger the crankshaft centrifugal positioning edge reference coefficient is, the less suitable the crankshaft centrifugal reference edge is for positioning the crankshaft center hole. Therefore, in order to subsequently locate the crankshaft center hole, the crankshaft positioning reference points corresponding to all crankshaft positioning edges are obtained. The specific method is as follows:
[0112] Obtaining the edge pixel point corresponding to the minimum crankshaft centrifugal positioning edge reference coefficient among all edge pixel points of each crankshaft centrifugal positioning edge, and recording the crankshaft centrifugal reference edge corresponding to the edge pixel point as the crankshaft centrifugal optimal reference edge;
[0113] All edge pixel points in the proximal positioning edge of each crankshaft and all edge pixel points in the crankshaft centrifugal optimal reference edge of each crankshaft centrifugal positioning edge are detected by a circle detection method to obtain the center of each crankshaft proximal positioning edge and the center of the crankshaft centrifugal optimal reference edge of each crankshaft centrifugal positioning edge respectively;
[0114] The center of the crankshaft centrifugal optimal reference edge is used as the center of each crankshaft centrifugal positioning edge, and the center of each crankshaft proximal positioning edge and the crankshaft centrifugal positioning edge are recorded as the crankshaft positioning reference point.
[0115] Preferably, as an embodiment of the present application, a random Hough transform algorithm is used to obtain the crankshaft positioning reference point.
[0116] It can be understood that this embodiment only provides a circle detection method, namely, the random Hough transform algorithm. As other implementation methods, the implementer can adopt other circle detection methods in the prior art to obtain the crankshaft positioning reference point, such as random circle detection, Hough transform, etc. This embodiment does not impose any special restrictions on this.
[0117] Based on the above analysis, due to the effect of gravity, the crank, balance weight and other components in the crankshaft will naturally droop, and the center of the circle of the symmetrical edge at the bottom will form a straight line with the center of the crankshaft.
[0118] The coordinates of all crankshaft positioning reference points are obtained and linear fitting is performed, and the fitted straight line is recorded as the crankshaft machining reference line.
[0119] Preferably, as an embodiment of the present application, the least square method is used to fit all crankshaft positioning reference points to obtain the crankshaft processing reference line;
[0120] All edge pixel points located on the crankshaft machining reference line in all crankshaft edge images are recorded as candidate pixel points for the crankshaft center hole.
[0121] It is understandable that this embodiment only provides a linear fitting method, namely, the least squares method. As other implementation methods, the implementer may adopt other linear fitting methods in the prior art to obtain the crankshaft machining reference line, and this embodiment does not impose any special restrictions on this.
[0122] At this point, the crankshaft positioning reference points corresponding to all crankshaft positioning edges and all crankshaft center hole candidate pixel points are obtained.
[0123] Step 5, construct a crankshaft positioning reference window, and calculate the crankshaft reference point matching index of each crankshaft positioning reference point in the crankshaft positioning reference window of each crankshaft center hole candidate pixel point based on the deviation difference between each crankshaft positioning reference point in the window and the crankshaft center hole candidate pixel point.
[0124] Since the crankshaft center hole falls on the crankshaft machining reference line, all the candidate pixel points of the crankshaft center hole are analyzed, and the pixel point that best matches the position of the crankshaft center hole is selected. First, each candidate pixel point of the crankshaft center hole is locally analyzed, and the crankshaft reference point matching index of each crankshaft positioning reference point in the crankshaft positioning reference window of each candidate pixel point of the crankshaft center hole is calculated. The specific method is as follows:
[0125] Taking each candidate pixel point of the crankshaft center hole as the central pixel point, a local window is constructed, which is recorded as the crankshaft positioning reference window of each candidate pixel point of the crankshaft center hole;
[0126] Preset eccentricity distance trimming index;
[0127] Preferably, as an embodiment of the present application, a local window with a size of 35×35 is constructed as a crankshaft positioning reference window; the eccentric distance trimming index is preset to a value of 1, and as other implementation methods, the implementer can set it according to actual conditions.
[0128] The distance between each crankshaft positioning reference point and the central pixel point in the crankshaft positioning reference window is recorded as the offset difference distance of each crankshaft positioning reference point in the crankshaft positioning reference window;
[0129] The eccentric distances of the crankshaft center hole of each crankshaft positioning reference point in the crankshaft positioning reference window of each crankshaft center hole candidate pixel point are respectively in a positive cooperative relationship with the preset eccentric distance trimming index and the offset difference distance;
[0130] Preferably, as an embodiment of the present application, the Euclidean distance between each crankshaft positioning reference point and the center pixel point in the crankshaft positioning reference window is calculated; secondly, the sum of the eccentric distance trimming index and the offset difference distance is taken as the eccentric distance of the crankshaft center hole of each crankshaft positioning reference point.
[0131] Furthermore, the crankshaft positioning reference points corresponding to different crankshaft positioning edges have different degrees of deviation from the crankshaft center. Since the components such as the balance weight in the crankshaft have a certain eccentricity with the crankshaft center, they should be given a smaller weight when calculating the matching degree of the crankshaft center hole position.
[0132] Each crankshaft positioning reference point in the crankshaft positioning reference window corresponds to a crankshaft positioning edge, and each crankshaft positioning edge corresponds to a crankshaft edge variation index;
[0133] The crankshaft reference reference weight of each crankshaft positioning reference point within the crankshaft positioning reference window of each crankshaft center hole candidate pixel point is in a negative synergistic relationship with the corresponding crankshaft edge variation index;
[0134] Based on the crankshaft reference weight and the crankshaft center hole eccentricity, determine the crankshaft reference point matching index of each crankshaft positioning reference point in the crankshaft positioning reference window of each crankshaft center hole candidate pixel point, wherein the crankshaft reference point matching index is in a positive cooperative relationship with the crankshaft reference weight and in a negative cooperative relationship with the crankshaft center hole eccentricity;
[0135] It can be understood that a negative synergistic relationship indicates that the dependent variable decreases as the independent variable increases, and increases as the independent variable decreases. The specific relationship can be a subtraction relationship, a division relationship, a negative exponential idempotence, etc., which is determined by actual application and this application does not impose any special restrictions on this.
[0136] Preferably, as an embodiment of the present application, the calculation result of an exponential function with a natural constant as the base and the inverse of the crankshaft edge change index as the exponent is used as the crankshaft reference reference weight of each crankshaft positioning reference point in the crankshaft positioning reference window of each crankshaft center hole alternative pixel point; secondly, the ratio of the crankshaft reference reference weight to the square of the eccentricity distance of the crankshaft center hole is used as the crankshaft reference point matching index of each crankshaft positioning reference point in the crankshaft positioning reference window of each crankshaft center hole alternative pixel point.
[0137] It should be noted that the preset eccentric distance correction index is to prevent the distance between the crankshaft positioning reference point and the crankshaft center hole alternative pixel from being 0 when they coincide with each other; secondly, when the crankshaft edge variation index of the crankshaft positioning edge is larger, the shape of the corresponding crankshaft component deviates more from a circle, the greater the deviation between the determined crankshaft positioning reference point and the crankshaft center, the smaller the effect on determining the position of the crankshaft center hole, and the smaller the corresponding crankshaft reference reference weight.
[0138] Further, the present application provides a flowchart of the steps of the method for obtaining the crankshaft reference point matching index as shown in Figure 3 shown.
[0139] At this point, the crankshaft reference point matching index of each crankshaft positioning reference point within the crankshaft positioning reference window of each crankshaft center hole candidate pixel point is obtained.
[0140] Step 6: Based on the crankshaft reference point matching index, calculate the crankshaft center hole position matching degree of each crankshaft center hole candidate pixel point to locate the crankshaft center hole.
[0141] Based on the above analysis, according to the crankshaft reference point matching index of each crankshaft positioning reference point in the crankshaft positioning reference window, the crankshaft center hole position matching degree of each crankshaft center hole candidate pixel point is calculated. The specific method is:
[0142] The reference matching coefficient of the crankshaft positioning reference window of each candidate pixel point of the crankshaft center hole is respectively in a positive cooperative relationship with the crankshaft reference point matching index of all crankshaft positioning reference points in the crankshaft positioning reference window;
[0143] Obtain the number of all crankshaft positioning reference points within the crankshaft positioning reference window of each crankshaft center hole candidate pixel point, recorded as the local reference number;
[0144] The crankshaft center hole position matching degree of each crankshaft center hole candidate pixel point is in a positive cooperative relationship with the reference matching coefficient and the local reference quantity respectively;
[0145] Preferably, as an embodiment of the present application, the benchmark matching coefficient of the crankshaft positioning reference window of each crankshaft center hole alternative pixel point is the sum of the crankshaft reference point matching indexes of all crankshaft positioning reference points in the crankshaft positioning reference window; the product of the benchmark matching coefficient and the local benchmark number is used as the crankshaft center hole position matching degree of each crankshaft center hole alternative pixel point.
[0146] It should be noted that there are many edges formed by circular parts such as the front and rear shafts in the crankshaft image, and the corresponding crankshaft positioning reference points are more and closer to the crankshaft center. Therefore, when the crankshaft positioning reference points in the crankshaft positioning reference window are closer to the center pixel point and the number is greater, the crankshaft center hole candidate pixel point is more consistent with the crankshaft center hole selection, and the crankshaft center hole position matching degree is greater.
[0147] According to the crankshaft center hole position matching degree of all crankshaft center hole candidate pixel points, the coordinate position of the crankshaft center hole candidate pixel point with the largest crankshaft center hole position matching degree is obtained as the position of the crankshaft center hole to complete the positioning of the crankshaft center hole.
[0148] It should be understood that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0149] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0150] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the present application. It should be pointed out that, for those of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application. Therefore, any simple modification, equivalent change and modification made to the above embodiments according to the technical essence of the present application without departing from the content of the technical solution of the present application, shall fall within the protection scope of the technical solution of the present application.
Claims
1. A crankshaft machining positioning method based on computer vision, characterized in that: The method comprises the following steps: Collecting a crankshaft image, obtaining a crankshaft edge image, and acquiring each crankshaft positioning edge on the crankshaft edge image; According to the change difference of each edge pixel point on the crankshaft positioning edge, the crankshaft edge change index of each crankshaft positioning edge is calculated to determine each crankshaft proximal positioning edge and crankshaft eccentric positioning edge; Calculate the crankshaft centrifugal positioning edge reference coefficient of each edge pixel point on each crankshaft centrifugal positioning edge according to the local changes and distribution characteristics of each edge pixel point within each crankshaft centrifugal positioning edge; Based on the crankshaft centrifugal positioning edge reference coefficient, the crankshaft positioning reference points of all crankshaft positioning edges and all crankshaft center hole candidate pixel points are obtained; Construct a crankshaft positioning reference window, and calculate the crankshaft reference point matching index of each crankshaft positioning reference point in the crankshaft positioning reference window of each crankshaft center hole candidate pixel point according to the deviation difference between each crankshaft positioning reference point in the window and the crankshaft center hole candidate pixel point; Based on the crankshaft reference point matching index, calculating the crankshaft center hole position matching degree of each crankshaft center hole candidate pixel point to locate the crankshaft center hole; The method for determining the proximal positioning edge of each crankshaft and the centrifugal positioning edge of the crankshaft is: Analyze the average of the crankshaft edge variation indexes of all crankshaft positioning edges as the crankshaft edge variation threshold; If the crankshaft edge variation index of a crankshaft positioning edge is less than or equal to the crankshaft edge variation threshold, the crankshaft positioning edge is recorded as the crankshaft proximal positioning edge; if the crankshaft edge variation index of a crankshaft positioning edge is greater than the crankshaft edge variation threshold, the crankshaft positioning edge is recorded as the crankshaft eccentric positioning edge.
2. A crankshaft machining positioning method based on computer vision as claimed in claim 1, characterized in that: The step of calculating the crankshaft edge variation index of each crankshaft positioning edge comprises: Obtaining the coordinates of all edge pixel points in the crankshaft edge image, performing curve fitting on all edge pixel points of the same crankshaft positioning edge, and obtaining the crankshaft edge curve of each crankshaft positioning edge; Obtaining the curvature of each edge pixel point on the crankshaft edge curve of each crankshaft positioning edge, and recording it as the curvature of each edge pixel point of each crankshaft positioning edge; Obtain the maximum curvature, minimum curvature and curvature standard deviation of each crankshaft positioning edge; taking the difference between the maximum curvature and the minimum curvature as the absolute difference in curvature of each crankshaft positioning edge; The number of pixel points of each crankshaft positioning edge is obtained, and the number of pixel points of all crankshaft positioning edges is normalized to serve as the edge change weighting coefficient of each crankshaft positioning edge; The curvature standard deviation, the curvature absolute difference and the edge variation weighted coefficient are forward fused to serve as the crankshaft edge variation index of each crankshaft positioning edge.
3. A crankshaft machining positioning method based on computer vision as claimed in claim 2, characterized in that: The method of calculating the crankshaft centrifugal positioning edge reference coefficient of each edge pixel point on each crankshaft centrifugal positioning edge includes: Calculate the local crankshaft edge change index of each edge pixel point on each crankshaft centrifugal positioning edge according to the local change of each edge pixel point on each crankshaft centrifugal positioning edge; Calculate the crankshaft centrifugal edge symmetry weight of each edge pixel point on each crankshaft centrifugal positioning edge according to the distribution of the curvature of each edge pixel point on each crankshaft centrifugal positioning edge; The crankshaft centrifugal positioning edge reference coefficient of each edge pixel point on each crankshaft centrifugal positioning edge is in a positive cooperative relationship with the local crankshaft edge variation index and the crankshaft centrifugal edge symmetry weight.
4. A crankshaft machining positioning method based on computer vision as claimed in claim 3, characterized in that: The calculation method of the local crankshaft edge variation index is: A local window is constructed with each edge pixel point on the centrifugal positioning edge of each crankshaft as the center; The crankshaft centrifugal positioning edge contained in the local window of each edge pixel point is recorded as the crankshaft centrifugal reference edge; The crankshaft edge variation index of the crankshaft centrifugal reference edge is calculated and recorded as the local crankshaft edge variation index of each edge pixel point on each crankshaft centrifugal positioning edge.
5. A crankshaft machining positioning method based on computer vision as claimed in claim 4, characterized in that: The calculation method of the crankshaft centrifugal edge symmetry weight is: Calculate the curvature skewness of the crankshaft centrifugal reference edge according to the skewness of the curvature of all edge pixel points on the crankshaft centrifugal reference edge; The crankshaft centrifugal edge symmetry weight of each edge pixel point on each crankshaft centrifugal positioning edge is in a positive cooperative relationship with the curvature skewness.
6. A crankshaft machining positioning method based on computer vision as claimed in claim 4, characterized in that: The method for obtaining the crankshaft positioning reference points of all crankshaft positioning edges and all crankshaft center hole candidate pixel points is as follows: Obtaining the edge pixel point corresponding to the minimum crankshaft centrifugal positioning edge reference coefficient among all edge pixel points of each crankshaft centrifugal positioning edge, and recording the crankshaft centrifugal reference edge corresponding to the edge pixel point as the crankshaft centrifugal optimal reference edge; Obtaining the center of each crankshaft proximal positioning edge and the center of the crankshaft centrifugal optimal reference edge; The center of the crankshaft centrifugal optimal reference edge is used as the center of each crankshaft centrifugal positioning edge, and the center of each crankshaft proximal positioning edge and the crankshaft centrifugal positioning edge are recorded as crankshaft positioning reference points; Obtain the coordinates of all crankshaft positioning reference points and perform linear fitting, and the fitted straight line is recorded as the crankshaft machining reference line; All edge pixel points located on the crankshaft machining reference line in all crankshaft edge images are recorded as candidate pixel points for the crankshaft center hole.
7. A crankshaft machining positioning method based on computer vision as claimed in claim 1, characterized in that: The calculation method of the crankshaft reference point matching index is: Taking each candidate pixel point of the crankshaft center hole as the central pixel point, a local window is constructed, which is recorded as the crankshaft positioning reference window of each candidate pixel point of the crankshaft center hole; Calculating the eccentricity distance of the crankshaft center hole of each crankshaft positioning reference point in the crankshaft positioning reference window of each crankshaft center hole candidate pixel point according to the position difference between each crankshaft positioning reference point in the crankshaft positioning reference window and the crankshaft center hole candidate pixel point; Each crankshaft positioning reference point in the crankshaft positioning reference window corresponds to a crankshaft positioning edge, and each crankshaft positioning edge corresponds to a crankshaft edge variation index; The crankshaft reference reference weight of each crankshaft positioning reference point within the crankshaft positioning reference window of each crankshaft center hole candidate pixel point is in a negative synergistic relationship with the corresponding crankshaft edge variation index; Based on the crankshaft reference weight and the eccentricity of the crankshaft center hole, the crankshaft reference point matching index of each crankshaft positioning reference point within the crankshaft positioning reference window of each crankshaft center hole candidate pixel point is determined, wherein the crankshaft reference point matching index is positively coordinated with the crankshaft reference weight and negatively coordinated with the eccentricity of the crankshaft center hole.
8. A crankshaft machining positioning method based on computer vision as claimed in claim 7, characterized in that: The calculation method of the eccentric distance of the crankshaft center hole is: Preset eccentricity distance trimming index; The distance between each crankshaft positioning reference point and the central pixel point in the crankshaft positioning reference window is recorded as the offset difference distance of each crankshaft positioning reference point in the crankshaft positioning reference window; The eccentric distances of the crankshaft center hole of each crankshaft positioning reference point within the crankshaft positioning reference window of each crankshaft center hole candidate pixel point are respectively in a positive cooperative relationship with the preset eccentric distance trimming index and the offset difference distance.
9. The method for crankshaft machining and positioning based on computer vision as claimed in claim 1, characterized in that: The calculating the crankshaft center hole position matching degree of each crankshaft center hole candidate pixel point to locate the crankshaft center hole includes: The reference matching coefficient of the crankshaft positioning reference window of each candidate pixel point of the crankshaft center hole is respectively in a positive cooperative relationship with the crankshaft reference point matching index of all crankshaft positioning reference points in the crankshaft positioning reference window; Obtain the number of all crankshaft positioning reference points within the crankshaft positioning reference window of each crankshaft center hole candidate pixel point, recorded as the local reference number; The crankshaft center hole position matching degree of each crankshaft center hole candidate pixel point is in a positive cooperative relationship with the reference matching coefficient and the local reference quantity respectively; The coordinate position of the candidate pixel point of the crankshaft center hole corresponding to the maximum crankshaft center hole position matching degree is obtained as the position of the crankshaft center hole.
Citation Information
Patent Citations
Three-dimensional positioning method for automobile engine crankshaft bush cover
CN111598945A
Shaft part shaft diameter measuring method based on parallel binocular machine vision
CN114322801A