Bicycle crank scanning method and system
Through ray scanning and crack boundary recognition technology, the problem of low sensitivity for detection of small pores and non-vertical cracks in bicycle cranks is solved, and high accuracy and high efficiency flaw detection detection is achieved.
Patent Information
- Application Number
- CN202411734363.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-03-14
AI Technical Summary
Existing bicycle crank flaw detection methods have problems of low sensitivity and low efficiency in detecting small pores and non-vertical cracks in high-strength materials.
The tomographic image of the crank is obtained through ray scanning, the crack boundary points are identified and the same boundary points are marked, and the non-vertical crack areas on the ray scanning image are reconstructed to improve detection accuracy.
High sensitivity detection of small pores and non-vertical cracks in the crank is achieved, and the accuracy and efficiency of flaw detection are improved.
Smart Images

Figure CN119619186A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of component flaw detection, and in particular to a scanning method and system for a bicycle crank. Background Art
[0002] In recent years, with the progress of material science and manufacturing technology, modern bicycle cranks are made of lightweight and high-strength materials, such as carbon fiber and titanium alloy or a variety of high-strength materials. Common flaw detection methods for high-strength bicycle cranks are generally ultrasonic flaw detection, eddy current flaw detection or radiographic flaw detection. Ultrasonic flaw detection is greatly affected by subjective factors, is limited by shape, requires poor preparation, quantification and positioning accuracy of the detection surface, and is limited by the material grain structure and organizational uniformity. Eddy current flaw detection can only detect defects on the surface or adjacent areas, and the depth is generally not more than 1 mm. Therefore, ultrasonic flaw detection and eddy current flaw detection are not suitable for rapid flaw detection in the mass production of cranks.
[0003] Therefore, in actual industrial production, in order to detect defects efficiently and quickly, industrial CT (computed tomography) or DR (direct digital X-ray) is generally used to perform non-destructive flaw detection using x-rays and gamma rays. The principle is to use x-rays and gamma rays to take photos of defect images, and then locate and identify inclusions, cracks, and holes in the crank material manually or through image processing software. However, for defects such as pores, only defects larger than 0.1 mm can be detected. Since the pore size in high-strength composite materials such as carbon fiber varies greatly at different porosities, when the porosity is lower than 4%, a considerable portion of the pore size is less than 0.1 mm, so the sensitivity in detecting porosity is low. In addition, it is difficult to detect crack defects. Cracks can generally only be detected when their planes are roughly parallel to the beam of rays. Only cracks perpendicular to the crank surface can be detected. See references: Jian Futing et al. Introduction to nondestructive testing of composite materials [J]. Scientific Consulting, 2012.DOI:CNKI:SUN:KXZC.0.2012-06-042, therefore, the existing detection method is generally to complement the X-ray detection method with the ultrasonic reflection method, the detection efficiency of the flaw detection is low, and due to the large subjective influence of the ultrasonic reflection method and the defects limited by the material grain structure and organizational uniformity, it is easy to miss the detection. Summary of the invention
[0004] The purpose of the present invention is to provide a bicycle crank scanning method and system to solve one or more technical problems existing in the prior art and at least provide a beneficial choice or create conditions.
[0005] In order to achieve the above object, according to one aspect of the present invention, a method for scanning a bicycle crank is provided, the method comprising the following steps: S100, obtaining a X-ray scanning image of the crank; S200, identifying crack boundary points in the X-ray scanning image; S300, marking all the same boundary points corresponding to each crack boundary point; S400: reconstructing the non-vertical crack region on the ray scanning image according to all the same boundary points corresponding to each crack boundary point.
[0006] Furthermore, in S100, the method for obtaining the tomographic image of the crank is: scanning the crank by a radiographic flaw detection method to obtain a radiographic scanning image.
[0007] Preferably, the radiographic flaw detection method is to scan using the XB-18 real-time digital imaging detection system of Maicixiongye.
[0008] Preferably, the X-ray scanning image is corrected for scattered rays.
[0009] Since the pore size in high-strength composite materials such as carbon fiber and titanium alloy varies greatly at different porosities, when the porosity is lower than 4%, a considerable portion of the pore size is less than 0.1 mm, so the sensitivity of detecting porosity is low. Therefore, the existing ray flaw detection technology cannot detect many small pore positions, and non-vertical cracks, such as cracks that are not parallel to the detection beam or perpendicular to the crank surface, are photographed and appear as some incoherent points. When the cracks are small, if the size of these points is less than 0.1 mm, they cannot be photographed. Therefore, the present application solves the above problems by the following methods: Further, in S200, the method for identifying the crack boundary point in the ray scanning image is: Grayscale the X-ray scanning image to obtain a grayscale image; mark the vertical crack area on the grayscale image; divide the grayscale image into grids to obtain multiple grids on the grayscale image; take the point with the smallest grayscale value in each grid that has no intersection with the vertical crack area as the reference point; (the reference point is the darkest point in the grid. If there are multiple points with a grayscale value of 0 in the grid, the point with the shortest distance from the center of the grid is taken as the reference point); the reference point with a grayscale value smaller than the average grayscale value of all points on the grayscale image is recorded as a damage point; Determine whether each damage point meets the crack development conditions. If so, mark the damage point as a crack boundary point.
[0010] Among them, the crack development conditions are: The current damage point is recorded as AP, and the grid corresponding to AP is recorded as APG; if there is a damage point in each grid connected to APG, then the damage point with the smallest absolute difference between the gray value of AP and that of AP is recorded as BP, and the grid corresponding to BP is recorded as BPG; with AP as the endpoint, a ray APRay is drawn from AP to BP; the sequence of each grid that APRay passes through in sequence is recorded as APL; In APL, each grid is judged in turn starting from the second grid. If the average grayscale value of at least one grid meets the first condition, the crack development condition is met; wherein, the first condition is specifically: the average grayscale value of the first grid in APL decreases in sequence to the average grayscale value of the current grid, and the average grayscale value of the next grid of the current grid is greater than the average grayscale value of the current grid. (The crack development condition is that the darkest grid appears in the continuation direction of the grid where the crack deepens at the damage point along the direction of the ray APRay).
[0011] Once a crack is generated, it usually has a sharp root, a certain depth and is perpendicular to the surface. At the same time, it is often accompanied by severe decarburization and non-metallic inclusions around it. Through grid division, it is possible to quickly locate the nearby damage points in the area around the crack manifestation point (i.e., damage point) that is difficult to identify by X-ray scanning, and select points related to the crack boundary from these damage points based on the crack development characteristics (crack extension conditions) as crack boundary points. This method ensures the accurate positioning of the crack area and position in the subsequent identification process, thereby improving the accuracy of X-ray flaw detection. Since the crack boundary point is the crack boundary, which is a point related to the crack boundary selected from the damage points according to the crack propagation condition in the ray scanning, in order to identify all the characteristic points on the same boundary (same boundary points) on the crack, the present application provides the following methods: Furthermore, in S300, the method of marking all the same boundary points corresponding to each crack boundary point is: Mark the same boundary points corresponding to each crack boundary point in turn. The specific method is as follows: Graying the X-ray scanning image to obtain a grayscale image; meshing the grayscale image to obtain multiple grids on the grayscale image; recording the current crack boundary point as CP, and taking the grid containing CP as CPG; if there is a crack boundary point in each grid connected to CPG, then marking the crack boundary point with the smallest absolute value of the difference between the grayscale value of the crack boundary point and CP as DP, and taking the grid containing DP as DPG; The point on the boundary of CPG where the absolute value of the difference between the grayscale value of DP and that of DP is the minimum is recorded as HP1, and the point on the boundary of CPG where the absolute value of the difference between the grayscale value of DP and that of DP is the maximum is recorded as LP1; the point on the boundary of DPG where the absolute value of the difference between the grayscale value of CP and that of CP is the minimum is recorded as HP2, and the point on the boundary of DPG where the absolute value of the difference between the grayscale value of CP and that of CP is the maximum is recorded as LP2; Connect HP1 and HP2 to get the straight line MaxLine, connect LP1 and LP2 to get the straight line MinLine, and the area between the straight lines MaxLine and MinLine is the crack continuation area corresponding to the current crack boundary point (that is, the side between the straight lines MaxLine and MinLine that includes the current crack boundary point CP); Mark all the same boundary points corresponding to the current crack boundary point in the crack continuation area.
[0012] Furthermore, the method for marking all the same boundary points corresponding to the current crack boundary point is: In the direction from CP to DP, each grid is sequentially formed into a first sequence starting from CPG in the crack continuation area; all points with the smallest grayscale value in each grid in the first sequence are marked as the same boundary points corresponding to the current crack boundary point.
[0013] The same boundary points obtained above are marked from the crack continuation area of the crack continuation where the current crack boundary point is located. The lines connecting these same boundary points and the current crack boundary point can accurately fit at least one edge of the crack. Although the screening speed is fast due to the simplicity of the method, the same boundary points obtained by screening sometimes have more burrs on the boundaries, and smoothing the boundaries will result in greater distortion. In order to further avoid outliers at these point positions, the present application uses the following method to determine whether each grid is a same-boundary core grid in the same crack continuation direction as the current crack boundary point, thereby further improving the recognition accuracy: Preferably, the method of marking all the same boundary points corresponding to the current crack boundary point is replaced by: In the direction from CP to DP, each grid is sequentially formed into a second sequence starting from CPG in the crack continuation area; i is the sequence number of the grid in the second sequence, starting from i=2, within the range of i, it is sequentially determined whether each grid in the second sequence is a grid with the same boundary core, and the point with the smallest gray value in each grid that is a grid with the same boundary core is marked as the same boundary point corresponding to the current crack boundary point; Among them, the method for judging the core grids with the same boundary is: PG(i-1)>PG(i) and PG(i)<PG(i+1), where PG(i) is the average grayscale value of each grid from the first grid to the i-th grid in the second sequence.
[0014] Although the same boundary points obtained above are determined by the following method in turn for each grid whether it is the same boundary core grid in the same crack continuation direction as the current crack boundary point, when the cracks at some positions are fine, if these will lose the positions of some same boundary points, resulting in the distortion of the boundary finally formed by all the same boundary points, for this reason, the present application identifies these lost positions by the inertia of the cumulative changes of all the first grids to the current grid in the direction of crack continuation through the following crack cumulative index value, thereby reducing the degree of distortion of the boundary finally formed by all the same boundary points, and the specific method is as follows: Preferably, the method of marking all the same boundary points corresponding to the current crack boundary point is replaced by: In the direction from CP to DP, each grid is sequentially formed into a third sequence starting from CPG in the crack continuation area; j is the sequence number of the grid in the third sequence, starting from j=2, within the range of j, it is sequentially determined whether each grid in the third sequence is a core grid with the same boundary, and the point with the smallest gray value in each grid that is a core grid with the same boundary is marked as the same boundary point corresponding to the current crack boundary point; Among them, the determination method of the core grid with the same boundary is: Index(j-1)>Index(j) and Index(j)<Index(j+1); Among them, Index(j) is the crack cumulative index value of each grid from the first grid to the j-th grid in the third sequence; the method of obtaining the crack cumulative index value Index(j) is specifically as follows: let the number of times the grayscale value decreases between adjacent grids in the third sequence be GrayD, and the number of times the grayscale value increases be GrayS; then the crack cumulative index value Index(j)=GrayD÷(GrayD+GrayS)×100.
[0015] Further, in S400, the method for reconstructing the non-vertical crack region on the ray scanning image according to all the same boundary points corresponding to each crack boundary point is: Constructing the boundary of each crack boundary point in sequence, the boundary construction method is specifically as follows: connecting all the same boundary points corresponding to the current crack boundary point in sequence from near to far according to the distance from the current crack boundary point to obtain the boundary of the current crack boundary point; Each crack region is constructed in turn according to each boundary line, specifically: among each crack boundary point except the crack boundary point corresponding to the current boundary line, the crack boundary point closest to the crack boundary point corresponding to the current boundary line on one side of the current boundary line is the crack upper line, and the crack boundary point closest to the crack boundary point corresponding to the current boundary line on the other side of the current boundary line is the crack lower line, and the average gray value of the point with the smallest gray value in all grids between the current boundary line and the crack upper line is recorded as G1; The average gray value of the points with the smallest gray value in all grids between the current boundary and the lower crack line is G2; If G1>G2, the lower crack line is recorded as the crack boundary, otherwise the upper crack line is recorded as the crack boundary; The two endpoints of the current boundary are used as the first connection point and the second connection point respectively; the two endpoints of the crack boundary are used as the third connection point and the fourth connection point respectively; then the first connection point and the third connection point are connected, and the second connection point and the fourth connection point are connected respectively, and the closed area formed between the current boundary and the crack boundary is used as the non-vertical crack area.
[0016] The above method reconstructs the non-vertical crack area that cannot be identified by the radiographic flaw detection method through the crack boundary and each boundary, which can solve the problem of missed detection in the non-vertical direction of the radiographic flaw detection method under traditional conditions, and improves the detection efficiency without the need for complementary detection with the ultrasonic reflection method.
[0017] Preferably, the method for marking the vertical crack area on the grayscale image is: identifying edge lines on the surface of the grayscale image through an edge detection algorithm, and forming multiple model ranges with each edge line; marking the model range in which the average grayscale value of all points in each model range is less than the average grayscale value of all points on the grayscale image as a vertical crack area.
[0018] Preferably, the edge line of the vertical crack region includes at least one straight line.
[0019] Among them, the straight line recognition method detects the edge line by detecting the straight line through Hough transform.
[0020] The present invention also provides a bicycle crank scanning system, the bicycle crank scanning system comprising: a processor, a memory, and a computer script program stored in the memory and executable on the processor, the processor implementing the steps in the bicycle crank scanning method when executing the computer script program, the bicycle crank scanning system can be run in computing devices such as desktop computers, notebook computers, PDAs, and cloud data centers, and the executable system may include, but is not limited to, a processor, a memory, and a server cluster, and the processor executing the computer program runs in the following system units: A crank image acquisition unit, used for acquiring a X-ray scanning image of the crank; A crack boundary point identification unit, used for identifying crack boundary points in a ray scanning image; The same boundary point marking unit is used to mark all the same boundary points corresponding to each crack boundary point; A crack region reconstruction unit, used to reconstruct the non-vertical crack region on the ray scanning image according to all the same boundary points corresponding to each crack boundary point; The crank flaw detection and identification unit is used to judge that the crank is unqualified when the total area of all non-vertical crack regions on the X-ray scanning image exceeds an area threshold.
[0021] The beneficial effects of the present invention are as follows: the present invention provides a scanning method and system for a bicycle crank, which can detect cracks that are not perpendicular to the surface of the crank sample even when the cracks are not parallel to the ray beam, and can solve the problem of missed detection in the non-perpendicular direction to the ray by the ray flaw detection method by reconstructing the non-vertical crack area on the ray scanning image through the crack boundary and each boundary, thereby improving the accuracy of detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The above and other features of the present invention will become more obvious by describing in detail the embodiments shown in the accompanying drawings. The same reference numerals in the accompanying drawings of the present invention represent the same or similar elements. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other accompanying drawings can be obtained based on these accompanying drawings without creative work. In the accompanying drawings: Figure 1 Shown is a flow chart of a method for scanning a bicycle crank; Figure 2 The figure shows a crack edge enhancement image after the non-vertical crack region on the ray scanning image is reconstructed by the method of Example 1; Figure 3 The image shown is a crack edge enhancement image after the non-vertical crack region on the ray scanning image is reconstructed using the method of Example 2; Figure 4 The image shown is a crack edge enhancement image after the non-vertical crack region on the ray scanning image is reconstructed using the method of Example 3; Figure 5 Shown is an unreconstructed enhanced X-ray scanning image of the crack edge; Figure 6 Shown is a diagram of a scanning system based on a bicycle crank. DETAILED DESCRIPTION
[0023] The following will be combined with the embodiments and drawings to clearly and completely describe the concept, specific structure and technical effects of the present invention, so as to fully understand the purpose, scheme and effect of the present invention. It should be noted that the embodiments and features in the embodiments of this application can be combined with each other without conflict.
[0024] Example 1 like Figure 1 The flowchart of the scanning method of a bicycle crank according to the present invention is shown below. Figure 1 A method for scanning a bicycle crank according to an embodiment of the present invention will be described.
[0025] The present invention provides a method for scanning a bicycle crank, which specifically comprises the following steps: S100, obtaining a X-ray scanning image of the crank; S200, identifying crack boundary points in the X-ray scanning image; S300, marking all the same boundary points corresponding to each crack boundary point; S400: reconstructing the non-vertical crack region on the ray scanning image according to all the same boundary points corresponding to each crack boundary point.
[0026] Furthermore, in S100, the method for obtaining the tomographic image of the crank is: scanning through the XB-18 Maicixiongye real-time digital imaging detection system to obtain a X-ray scanning image.
[0027] Wherein, the ray scanning image is corrected for scattered rays.
[0028] Further, in S200, the method for identifying the crack boundary point in the ray scanning image is: Graying the X-ray scanning image to obtain a grayscale image; marking the vertical crack area on the grayscale image; gridding the grayscale image to obtain multiple grids on the grayscale image; taking the point with the smallest grayscale value in each grid that has no intersection with the vertical crack area as a reference point; and recording the reference point with a grayscale value smaller than the average grayscale value of all points on the grayscale image as a damage point; Determine whether each damage point meets the crack development conditions. If so, mark the damage point as a crack boundary point.
[0029] Among them, the crack development conditions are: The current damage point is recorded as AP, and the grid corresponding to AP is recorded as APG; if there is a damage point in each grid connected to APG, then the damage point with the smallest absolute difference between the gray value of AP and that of AP is recorded as BP, and the grid corresponding to BP is recorded as BPG; with AP as the endpoint, a ray APRay is drawn from AP to BP; the sequence of each grid that APRay passes through in sequence is recorded as APL; In APL, each grid is judged in turn starting from the second grid. If the average grayscale value of at least one grid satisfies the first condition, the crack development condition is met; wherein the first condition is specifically: the average grayscale value of the first grid in APL decreases in sequence to the average grayscale value of the current grid, and the average grayscale value of the next grid of the current grid is greater than the average grayscale value of the current grid.
[0030] Furthermore, in S300, the method of marking all the same boundary points corresponding to each crack boundary point is: Mark the same boundary points corresponding to each crack boundary point in turn. The specific method is as follows: Graying the X-ray scanning image to obtain a grayscale image; meshing the grayscale image to obtain multiple grids on the grayscale image; recording the current crack boundary point as CP, and taking the grid containing CP as CPG; if there is a crack boundary point in each grid connected to CPG, then marking the crack boundary point with the smallest absolute value of the difference between the grayscale value of the crack boundary point and CP as DP, and taking the grid containing DP as DPG; The point on the boundary of CPG where the absolute value of the difference between the grayscale value of DP and that of DP is the minimum is recorded as HP1, and the point on the boundary of CPG where the absolute value of the difference between the grayscale value of DP and that of DP is the maximum is recorded as LP1; the point on the boundary of DPG where the absolute value of the difference between the grayscale value of CP and that of CP is the minimum is recorded as HP2, and the point on the boundary of DPG where the absolute value of the difference between the grayscale value of CP and that of CP is the maximum is recorded as LP2; Connect HP1 and HP2 to get the straight line MaxLine, connect LP1 and LP2 to get the straight line MinLine, and the area between the straight lines MaxLine and MinLine is the crack continuation area corresponding to the current crack boundary point; Mark all the same boundary points corresponding to the current crack boundary point in the crack continuation area.
[0031] Furthermore, the method for marking all the same boundary points corresponding to the current crack boundary point is: In the direction from CP to DP, each grid is sequentially formed into a first sequence starting from CPG in the crack continuation area; the point with the smallest gray value in each grid in the first sequence is marked as the same boundary point corresponding to the current crack boundary point.
[0032] Among them, the key source code of the C++ language description of the specific implementation of marking all the same boundary points corresponding to each crack boundary point is: class CrackAnalysis { public: void processImage(GrayImage&image, Point CP) { std::vector <std::vector <bool>>grid; / / used for grid division std::vector <point>CPG; / / Current crack boundary point grid std::vector <point>DPG; / / DP grid Point DP = findClosestCrackPoint(image, CPG, CP); std::vector <point>DPG = getConnectedGridPoints(DP); Point HP1 = findBoundaryPoint(image, CPG, DP, true); Point LP1 = findBoundaryPoint(image, CPG, DP, false); Point HP2 = findBoundaryPoint(image, DPG, CP, true); Point LP2 = findBoundaryPoint(image, DPG, CP, false); drawLine(HP1, HP2); / / Draw MaxLine drawLine(LP1, LP2); / / Draw MinLine markContinuityRegion(image, HP1, HP2, LP1, LP2, CP);} private: Point findClosestCrackPoint(GrayImage&image, const std::vector <point>&CPG, const Point&CP) { Point closest; int minDiff = INT_MAX; for (const Point&p : CPG) { int diff = std::abs(image.getGrayValue(p.x, p.y) - image.getGrayValue(CP.x, CP.y)); if (diff<minDiff) { minDiff = diff; closest = p;}} return closest; } std::vector <point>getConnectedGridPoints(const Point&DP) { std::vector <point>connectedPoints; / / Logic to get the grid point connected to DP return connectedPoints; } Point findBoundaryPoint(GrayImage&image, const std::vector <point>&gridPoints, const Point&reference, bool findMin) { Point boundaryPoint; int targetGrayValue = image.getGrayValue(reference.x, reference.y); int bestDiff = findMin ? INT_MAX : -1; for (const Point&p : gridPoints) { int diff = std::abs(image.getGrayValue(px, py) - targetGrayValue); if ((findMin&&diff<bestDiff) || (!findMin&&diff> bestDiff)) { bestDiff = diff; boundaryPoint = p;}} return boundaryPoint;}.
[0033] Further, in S400, the method for reconstructing the non-vertical crack region on the ray scanning image according to all the same boundary points corresponding to each crack boundary point is: Constructing the boundary of each crack boundary point in sequence, the boundary construction method is specifically as follows: connecting all the same boundary points corresponding to the current crack boundary point in sequence from near to far according to the distance from the current crack boundary point to obtain the boundary of the current crack boundary point; Each crack region is constructed in turn according to each boundary line, specifically: among each crack boundary point except the crack boundary point corresponding to the current boundary line, the crack boundary point closest to the crack boundary point corresponding to the current boundary line on one side of the current boundary line is the crack upper line, and the crack boundary point closest to the crack boundary point corresponding to the current boundary line on the other side of the current boundary line is the crack lower line, and the average gray value of the point with the smallest gray value in all grids between the current boundary line and the crack upper line is recorded as G1; The average gray value of the points with the smallest gray value in all grids between the current boundary and the lower crack line is G2; If G1>G2, the lower crack line is recorded as the crack boundary, otherwise the upper crack line is recorded as the crack boundary; The two endpoints of the current boundary are used as the first connection point and the second connection point respectively; the two endpoints of the crack boundary are used as the third connection point and the fourth connection point respectively; then the first connection point and the third connection point are connected, and the second connection point and the fourth connection point are connected respectively, and the closed area formed between the current boundary and the crack boundary is used as the non-vertical crack area.
[0034] Among them, the key source code described in C++ language for the specific implementation of the method of reconstructing the non-vertical crack area on the ray scanning image according to all the same boundary points corresponding to each crack boundary point is: double distance(const Point&other) const { return std::sqrt((x - other.x) * (x - other.x) + (y - other.y) * (y -other.y)); }}; struct GrayImage { std::vector <std::vector <int>>pixels; / / Gray value matrix int width, height; int getGrayValue(int x, int y) { if (x<0 || x>= width || y<0 || y>= height) return -1; / / Bounds check return pixels[y][x];}}; class CrackRegionAnalysis { public: void processCrackPoints(GrayImage&image, const std::vector <point>&crackPoints) { for (const Point&CP : crackPoints) { std::vector <point>boundaryPoints = getBoundaryPoints(CP,crackPoints); Point upperLinePoint = findClosestPointToLine(CP, boundaryPoints,true); Point lowerLinePoint = findClosestPointToLine(CP, boundaryPoints,false); double G1 = calculateAverageGrayValue(image, CP, upperLinePoint); double G2 = calculateAverageGrayValue(image, CP, lowerLinePoint); Point crackBoundary = (G1>G2) ? lowerLinePoint : upperLinePoint; createCrackRegion(CP, crackBoundary);}} private: std::vector <point>getBoundaryPoints(const Point&CP, const std::vector <point>&crackPoints) { std::vector <point>boundaryPoints; / / Logic to get the boundary points related to CP return boundaryPoints;} Point findClosestPointToLine(const Point&CP, const std::vector <point>&boundaryPoints, bool upper) { Point closestPoint; double minDistance = std::numeric_limits <double>::max(); for (const Point&p : boundaryPoints) { double distance = CP.distance(p); if (upper ? (py<CP.y) : (p.y> CP.y)) { if (distance <minDistance) { minDistance = distance; closestPoint = p;}}} return closestPoint;} double calculateAverageGrayValue(GrayImage&image, const Point&CP,const Point&linePoint) { double totalGrayValue = 0; int count = 0; / / Assume that the grid between the current boundary and the upper / lower line is traversed for (int y = std::min(CP.y, linePoint.y); y<= std::max(CP.y,linePoint.y); ++y) { for (int x = std::min(CP.x, linePoint.x); x<= std::max(CP.x,linePoint.x); ++x) { int grayValue = image.getGrayValue(x, y); if (grayValue != -1) { / / Make sure the gray value is valid totalGrayValue += grayValue; count++;}}} return (count>0) ? (totalGrayValue / count) : 0; }}.
[0035] Preferably, the method for marking the vertical crack area on the grayscale image is: identifying edge lines on the surface of the grayscale image through an edge detection algorithm, and forming multiple model ranges with each edge line; marking the model range in which the average grayscale value of all points in each model range is less than the average grayscale value of all points on the grayscale image as a vertical crack area.
[0036] Preferably, the edge line of the vertical crack region includes at least one straight line.
[0037] Among them, the straight line recognition method detects the edge line by detecting the straight line through Hough transform.
[0038] Preferably, the method further includes identifying the vertical crack area while identifying the crack boundary point, and when the total area of all existing vertical crack areas exceeds an area threshold, the crank is judged to be unqualified.
[0039] Further, when the total area of all existing vertical crack regions plus the total area of all non-vertical crack regions exceeds an area threshold, the crank is judged to be unqualified.
[0040] Example 2 This embodiment 2 replaces the method of marking all the same boundary points corresponding to the current crack boundary point based on embodiment 1, specifically: Preferably, the method of marking all the same boundary points corresponding to the current crack boundary point is replaced by: In the direction from CP to DP, each grid is sequentially formed into a second sequence starting from CPG in the crack continuation area; i is the sequence number of the grid in the second sequence, starting from i=2, within the range of i, it is sequentially determined whether each grid in the second sequence is a grid with the same boundary core, and the point with the smallest gray value in each grid that is a grid with the same boundary core is marked as the same boundary point corresponding to the current crack boundary point; Among them, the method for judging the core grids with the same boundary is: PG(i-1)>PG(i) and PG(i)<PG(i+1), where PG(i) is the average grayscale value of each grid from the first grid to the i-th grid in the second sequence.
[0041] Among them, the key source code of the C++ language description of the specific implementation of the method of marking all the same boundary points corresponding to the current crack boundary point in Example 2 is: class CrackPropagation { public: void analyzePropagation(GrayImage&image, const Point&CP, const Point&DP) { std::vector <point>CPG; / / Current crack point grid / / Calculate the second sequence std::vector <double>PG = calculateAverageGrayValues(image, CPG); / / Find the core grid with the same boundary markSameBoundaryPoints(PG, CPG);} private: std::vector <double>calculateAverageGrayValues(GrayImage&image, conststd::vector <point>&CPG) { std::vector <double>PG(CPG.size()); for (size_t i = 0; i < CPG.size(); ++i) { const Point& grid = CPG[i]; double totalGray = 0; int count = 0; / / Calculate the gray values of the points around the grid for (int dy = -1; dy <= 1; ++dy) { for (int dx = -1; dx <= 1; ++dx) { int x = grid.x + dx; int y = grid.y + dy; int grayValue = image.getGrayValue(x, y); if (grayValue != -1) { totalGray += grayValue; count++;}}} PG[i] = (count > 0)? (totalGray / count) : 0; } return PG;} void markSameBoundaryPoints(const std::vector <double>&PG, const std::vector <point>&CPG) { for (size_t i = 2; i<PG.size() - 1; ++i) { if (PG[i - 1]>PG[i]&&PG[i]<PG[i + 1]) { / / 判断同边界芯网格 double minGray = std::numeric_limits <double>::max(); Point minPoint; / / Find the point with the smallest gray value for (const Point&grid : CPG) { double grayValue = PG[i]; / / Assume that the gray value of the current grid is in PG if (grayValue <minGray) { minGray = grayValue; minPoint = grid;}}.
[0042] Example 3 This embodiment 3 replaces the method of marking all the same boundary points corresponding to the current crack boundary point based on embodiment 1, specifically: Preferably, the method of marking all the same boundary points corresponding to the current crack boundary point is replaced by: In the direction from CP to DP, each grid is sequentially formed into a third sequence starting from CPG in the crack continuation area; j is the sequence number of the grid in the third sequence, starting from j=2, within the range of j, it is sequentially determined whether each grid in the third sequence is a core grid with the same boundary, and the point with the smallest gray value in each grid that is a core grid with the same boundary is marked as the same boundary point corresponding to the current crack boundary point; Among them, the determination method of the core grid with the same boundary is: Index(j-1)>Index(j) and Index(j)<Index(j+1); Among them, Index(j) is the crack accumulation index value of each grid from the first grid to the jth grid in the third sequence; the method for obtaining the crack accumulation index value Index(j) is specifically as follows: The number of times the gray value decreases between adjacent grids in the third sequence is GrayD, and the number of times the gray value increases is GrayS; then the crack accumulation index value Index(j)=GrayD÷(GrayD+GrayS)×100.
[0043] Among them, the key source code of the C++ language description of the specific implementation of the method of marking all the same boundary points corresponding to the current crack boundary point in Example 3 is: class CrackPropagation { public: void analyzePropagation(GrayImage&image, const std::vector <point>&CPG) { std::vector <double>Index; / / Crack accumulation index value sequence generateThirdSequence(image, CPG, Index); markSameBoundaryPoints(Index, CPG);} private: void generateThirdSequence(GrayImage&image, const std::vector <point>&CPG, std::vector <double>&Index) { Index.clear(); for (size_t j = 0; j < CPG.size(); ++j) { const Point& grid = CPG[j]; int grayValue = image.getGrayValue(grid.x, grid.y); if (j > 0) { int prevGrayValue = image.getGrayValue(CPG[j - 1].x, CPG[j - 1].y); int GrayD = 0, GrayS = 0; if (prevGrayValue != -1 && grayValue != -1) { if (grayValue < prevGrayValue) { GrayD++; } else if (grayValue > prevGrayValue) { GrayS++;}} / / Calculate the cumulative crack index double indexValue = (GrayD + GrayS > 0)? (static_cast <double>(GrayD) / (GrayD + GrayS) * 100) : 0; Index.push_back(indexValue); } else { Index.push_back(0); / / The index value of the first grid is set to 0 }}} void markSameBoundaryPoints(const std::vector <double>&Index, conststd::vector <point>&CPG) { for (size_t j = 2; j<Index.size() - 1; ++j) { if (Index[j - 1]>Index[j]&&Index[j]<Index[j + 1]) { / / 判断同边界芯网格 double minGray = std::numeric_limits <double>::max(); Point minPoint; / / Find the point with the smallest gray value in the core grid corresponding to the same boundary for (const Point&grid : CPG) { int grayValue = indexToGrayValue(image, grid); / / Get the gray value of the current grid if (grayValue <minGray) { minGray = grayValue; minPoint = grid;}}.
[0044] Comparative Example 1 The crank is scanned by the XB-18 real-time digital imaging detection system of Maicixiongye to obtain a X-ray scanning image. When the total area of all non-vertical crack areas on the X-ray scanning image exceeds 0.5% of the total area, the crank is judged to be unqualified.
[0045] Experimental conditions: Destructive experiment: Before the test, a number of irregular narrow slits with a depth of approximately 1.0mm-3.0mm in the horizontal and vertical directions were cut on the titanium alloy crank.
[0046] 10 damaged titanium alloy cranks were inspected by the methods of Example 1, Example 2, Example 3 and Comparative Example 1. The methods of scanning the cranks in Example 1, Example 2 and Example 3 are all to scan the cranks by using the XB-18 Maicixiongye real-time digital imaging detection system. Then, the non-vertical crack areas on the ray scanning images were reconstructed by the methods of Example 1, Example 2 and Example 3, and the crack edge enhancement images were performed. When the total area of all non-vertical crack areas on the ray scanning images exceeded 0.5% of the total area, the cranks were judged to be unqualified.
[0047] Among them, the method for crack edge enhancement is: the method for crack edge enhancement is performed by OpenCV's Laplace operator: after marking the region of interest ROI (i.e., crack area), the region of interest ROI image is read, and the second-order derivative of the pixels in the crack area is calculated using the Laplace operator through OpenCV's cv2.Laplacian() function; the output of the Laplace operator is converted to an absolute value and scaled through OpenCV's cv2.convertScaleAbs() function to obtain a scaled edge image; edge sharpening is performed: a 3×3 convolution kernel is created, which enhances the edge details in the scaled edge image by subtracting the pixel values around the edge of the scaled edge image and increasing the weight of the center pixel; the image is convolved using the cv2.filter2D() function to obtain a sharpened edge image; edge enhancement: the region of interest ROI image and the sharpened edge image are combined using cv2.addWeighted() to generate an edge-enhanced image. By adjusting the weight coefficient, the mixing ratio of the ROI image and the sharp edge image is controlled. The weight of the sharp edge image is 0.4, and the weight of the ROI is 0.6, and the crack edge enhancement of the gradient amplitude is obtained. The functions involved are functions of the OpenCV library. (Note: In order to clearly display the crack area, the crack edge is enhanced through the Laplace operator of OpenCV); The same X-ray source is used to detect the flaw of one of the damaged titanium alloy cranks at the same flaw detection angle. Figure 2 , Figure 3 , Figure 4 The figures show the crack edge enhancement images after the non-vertical crack area on the ray scanning image is reconstructed by the methods of Example 1, Example 2, and Example 3, respectively. It can be seen that the images of the non-vertical crack area on Example 1, Example 2, and Example 3 are clear in turn; Figure 5 Enhanced radioscan image for the unreconstructed crack edge.
[0048] Relative to Figure 5 In terms of Figure 2 Correspondingly, in Embodiment 1, the lines connecting the boundary points marked in the crack continuation region of the crack where the current crack boundary point is located and the current crack boundary point can accurately fit at least one edge of the crack, thereby reconstructing the crack obtained by photographing the crank surface that is not parallel to the detection beam or perpendicular to the crank surface; relative to Figure 2 , Figure 3 The corresponding embodiment 2 can obtain the same boundary point by determining whether each grid is a same boundary core grid in the same crack continuation direction as the current crack boundary point in turn through the following method, thereby reconstructing the crack obtained by photographing the crack perpendicular to the crank surface; Figure 4 Relative to Figure 3 It can be seen that Example 3 can reconstruct some finer cracks.
[0049] Experimental results: Example 1: Seven unqualified cranks were identified among ten damaged titanium alloy cranks by the flaw detection method of Example 1.
[0050] Example 2: 9 unqualified cranks were identified among 10 damaged titanium alloy cranks by the flaw detection method of Example 2.
[0051] Example 3: Ten unqualified cranks were identified from ten damaged titanium alloy cranks by the flaw detection method of Example 3.
[0052] Comparative Example 1: 5 unqualified cranks were identified among 10 damaged titanium alloy cranks by the flaw detection method of Comparative Example 1.
[0053] An embodiment of the present invention provides a scanning system based on a bicycle crank, such as Figure 6 Shown is a diagram of a scanning system based on a bicycle crank of the present invention. The scanning system based on a bicycle crank of this embodiment includes: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps in the above-mentioned scanning system based on a bicycle crank embodiment are implemented.
[0054] The system comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to run in the following units of the system: A crank image acquisition unit, used for acquiring a X-ray scanning image of the crank; A crack boundary point identification unit, used for identifying crack boundary points in a ray scanning image; The same boundary point marking unit is used to mark all the same boundary points corresponding to each crack boundary point; A crack region reconstruction unit, used for reconstructing the non-vertical crack region on the ray scanning image according to all the same boundary points corresponding to each crack boundary point; The crank flaw detection and identification unit is used to judge that the crank is unqualified when the total area of all non-vertical crack regions on the X-ray scanning image exceeds an area threshold.
[0055] Among them, the area threshold is 0.5% of the total area.
[0056] The scanning system based on a bicycle crank can be run in computing devices such as desktop computers, laptop computers, PDAs, and cloud servers. The scanning system based on a bicycle crank can run systems including, but not limited to, processors and memories. Those skilled in the art can understand that the example is only an example of a scanning system based on a bicycle crank, and does not constitute a limitation on the scanning system based on a bicycle crank. It can include more or less components than the example, or combine certain components, or different components. For example, the scanning system based on a bicycle crank can also include input and output devices, network access devices, buses, etc.
[0057] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the scanning system based on a bicycle crank, and uses various interfaces and lines to connect various parts of the entire scanning system based on a bicycle crank.
[0058] The memory can be used to store the computer program and / or module, and the processor realizes various functions of the scanning system based on a bicycle crank by running or executing the computer program and / or module stored in the memory and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0059] Although the description of the present invention has been quite detailed and has been described in particular with respect to several described embodiments, it is not intended to be limited to any of these details or embodiments or any particular embodiment, so as to effectively cover the intended scope of the present invention. In addition, the present invention is described above with the embodiments foreseeable by the inventors, and its purpose is to provide a useful description, and those non-substantial changes to the present invention that are not currently foreseen may still represent equivalent changes of the present invention.< / double> < / point> < / double> < / double> < / double> < / point> < / double> < / point> < / double> < / point> < / double> < / double> < / point> < / double> < / double> < / point> < / double> < / point> < / point> < / point> < / point> < / point> < / point> < / int> < / point> < / point> < / point> < / point> < / point> < / point> < / point> < / bool>
Claims
1. A method for scanning a bicycle crank, characterized in that: The method comprises the following steps: S100, obtaining a X-ray scanning image of the crank; S200, identifying crack boundary points in the X-ray scanning image; S300, marking all the same boundary points corresponding to each crack boundary point; S400: reconstructing the non-vertical crack region on the ray scanning image according to all the same boundary points corresponding to each crack boundary point.
2. A bicycle crank scanning method according to claim 1, characterized in that: In S200, the method for identifying the crack boundary point in the ray scanning image is: Graying the X-ray scanning image to obtain a grayscale image; marking the vertical crack area on the grayscale image; meshing the grayscale image to obtain multiple grids on the grayscale image; The point with the smallest gray value in each grid that has no intersection with the vertical crack area is taken as the reference point; the reference point with a gray value less than the average gray value of all points on the gray image is recorded as a damage point; it is determined whether each damage point meets the crack development conditions, and if so, the damage point is marked as a crack boundary point.
3. A bicycle crank scanning method according to claim 2, characterized in that: The crack development conditions are as follows: the current damage point is AP, and the grid corresponding to AP is APG; if there is a damage point in each grid connected to APG, then the damage point with the smallest absolute difference between the gray value of AP and that of the damage point is BP, and the grid corresponding to BP is BPG; A ray APRay is made from AP to BP with AP as the endpoint; the sequence of each grid that APRay passes through in sequence is recorded as APL; in APL, each grid is judged in sequence starting from the second grid, and if the average grayscale value of at least one grid meets the first condition, the crack development condition is met; wherein the first condition is specifically: the average grayscale value of the first grid in APL decreases in sequence to the average grayscale value of the current grid, and the average grayscale value of the next grid of the current grid is greater than the average grayscale value of the current grid.
4. A bicycle crank scanning method according to claim 1, characterized in that: In S300, the method of marking all the same boundary points corresponding to each crack boundary point is: Mark the same boundary points corresponding to each crack boundary point in turn. The specific method is as follows: Grayscale the X-ray scanning image to obtain a grayscale image; mesh the grayscale image to obtain multiple grids on the grayscale image; record the current crack boundary point as CP, and take the grid containing CP as CPG; if there is a crack boundary point in each grid connected to CPG, then mark the crack boundary point with the smallest absolute value of the difference between the grayscale value of CP and CP among these crack boundary points as DP, and take the grid containing DP as DPG; record the point with the smallest absolute value of the difference between the grayscale value of DP and DP on the boundary of CPG as HP1, and record the point with the smallest absolute value of the grayscale value of DP on the boundary of CPG as HP2. The point with the largest absolute value of the difference is LP1; the point with the smallest absolute value of the difference in grayscale value with CP on the boundary of DPG is HP2, and the point with the largest absolute value of the difference in grayscale value with CP on the boundary of DPG is LP2; connect HP1 and HP2 to get the straight line MaxLine, connect LP1 and LP2 to get the straight line MinLine, and the area between the straight lines MaxLine and MinLine is the crack continuation area corresponding to the current crack boundary point; mark all the same boundary points corresponding to the current crack boundary point in the crack continuation area.
5. A bicycle crank scanning method according to claim 4, characterized in that: The method for marking all the same boundary points corresponding to the current crack boundary point is: starting from CPG in the crack continuation area in the direction from CP to DP, each grid is sequentially formed into a first sequence; the point with the smallest gray value in each grid in the first sequence is marked as the same boundary point corresponding to the current crack boundary point.
6. A method for scanning a bicycle crank according to claim 5, characterized in that: The method of marking all the same boundary points corresponding to the current crack boundary point is replaced by: starting from CPG in the direction from CP to DP, each grid is sequentially formed into a second sequence in the crack continuation area; i is the sequence number of the grid in the second sequence, starting from i=2, within the range of i, each grid in the second sequence is sequentially judged whether it is a same boundary core grid, and the point with the smallest gray value in all grids that are same boundary core grids is marked as the same boundary point corresponding to the current crack boundary point; wherein, the method for judging the same boundary core grid is: PG(i-1)>PG(i) and PG(i)<PG(i+1), wherein PG(i) is the average gray value of each grid from the first grid to the i-th grid in the second sequence.
7. A bicycle crank scanning method according to claim 5, characterized in that: The method of marking all the same-boundary points corresponding to the current crack boundary point is replaced by: starting from CPG in the direction from CP to DP, each grid is sequentially formed into a third sequence in the crack continuation area; taking j as the sequence number of the grid in the third sequence, starting from j=2, within the range of j, each grid in the third sequence is judged in turn whether it is a same-boundary core grid, and the point with the smallest gray value in all grids that are the same-boundary core grids is marked as the same-boundary point corresponding to the current crack boundary point.
8. The method for scanning a bicycle crank according to claim 1, characterized in that: In S400, the method for reconstructing the non-vertical crack region on the ray scanning image according to all the same boundary points corresponding to each crack boundary point is: Constructing the boundary of each crack boundary point in sequence, the boundary construction method is specifically as follows: connecting all the same boundary points corresponding to the current crack boundary point in sequence from near to far according to the distance from the current crack boundary point to obtain the boundary of the current crack boundary point; Each crack region is constructed in turn according to each boundary line, specifically: among each crack boundary point except the crack boundary point corresponding to the current boundary line, the crack boundary point closest to the crack boundary point corresponding to the current boundary line on one side of the current boundary line is the crack upper line, and the crack boundary point closest to the crack boundary point corresponding to the current boundary line on the other side of the current boundary line is the crack lower line, and the average gray value of the point with the smallest gray value in all grids between the current boundary line and the crack upper line is recorded as G1; The average gray value of the points with the smallest gray value in all grids between the current boundary and the lower crack line is G2; If G1>G2, the lower crack line is recorded as the crack boundary, otherwise the upper crack line is recorded as the crack boundary; The two endpoints of the current boundary are used as the first connection point and the second connection point respectively; the two endpoints of the crack boundary are used as the third connection point and the fourth connection point respectively; then the first connection point and the third connection point are connected, and the second connection point and the fourth connection point are connected respectively, and the closed area formed between the current boundary and the crack boundary is used as the non-vertical crack area.
9. A scanning system for a bicycle crank, characterized in that: The bicycle crank scanning system comprises: a processor, a memory, and a computer script program stored in the memory and running on the processor. When the processor executes the computer script program, the steps in the bicycle crank scanning method described in any one of claims 1 to 8 are implemented.