Visual Inspection Method for Slag Inclusion Defects in the Crankshaft Casting Process
By analyzing edge features and structural division of the surface images of crankshaft castings, identifying and combining the slag inclusion areas, the refined classification of slag inclusion defects in crankshaft castings is achieved, and the problem of difficulty in efficient identification and classification in the prior art is solved, and the crankshaft quality and equipment safety are improved.
Patent Information
- Application Number
- CN202510449614.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-11
- Publication Date
- 2025-06-20
- Estimated Expiration
- 2045-04-11
AI Technical Summary
During the crankshaft casting process, it is difficult for the prior art to efficiently and accurately identify and classify slag inclusion defects, resulting in a decrease in crankshaft quality and safety hazards.
By collecting the surface images of the crankshaft castings, analyzing the edge features for structural division, identifying grayscale features to identify the slag inclusion area, and combining the slag inclusion area through similarity analysis, and finally classifying them according to the crankshaft structural part to which the slag inclusion area belongs.
The detailed identification and classification of slag inclusion defects in crankshaft castings is realized, the accuracy of detection is improved, and the subsequent targeted repair of defects at different locations is facilitated, which improves the quality of the crankshaft and the safety of the equipment.
Smart Images

Figure CN119991651B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of visual inspection, and particularly to a visual inspection method for slag inclusion defects in the crankshaft casting process. Background Art
[0002] In industries such as automobile manufacturing and machinery manufacturing, the crankshaft, as a key power transmission component, its quality and performance are directly related to the reliability and service life of the whole machine. However, during the crankshaft casting process, due to the influence of various factors such as raw materials and process conditions, defects often occur. These defects not only reduce the performance of the crankshaft but may also lead to serious safety accidents. Slag inclusion is one of the common defects in the crankshaft casting process, which will destroy the continuity of the metal structure, thereby significantly reducing the mechanical properties of the crankshaft, including plasticity, toughness, and fatigue strength, etc. Therefore, efficient and accurate detection of slag inclusion defects during the crankshaft casting process is of great significance for improving the quality of the crankshaft and ensuring the safe operation of the equipment.
[0003] The crankshaft includes crankshaft structural parts such as the front end, balance weight, oil passage, main journal, chamfer, crank arm, connecting rod journal, balance hole, rear end, and rear main seal surface. The influence of slag inclusion on the crankshaft is different for different crankshaft structural parts, and the repair means for it are also different. The situation of slag inclusion defects in crankshaft castings during the casting process is diverse, that is, slag inclusion defects may exist in each crankshaft structural part of the crankshaft casting, while general slag inclusion defect recognition is based on the whole for recognition, and subsequent refined classification and repair cannot be achieved.
[0004] Therefore, there is an urgent need for a method to achieve the classification and recognition of slag inclusion defects in the crankshaft casting process. Summary of the Invention
[0005] In order to solve the above technical problems, the purpose of the present invention is to provide a visual inspection method for slag inclusion defects in the crankshaft casting process.
[0006] According to the first aspect of the embodiment of the present invention, a visual inspection method for slag inclusion defects in the crankshaft casting process is provided, and the technical solution adopted is specifically as follows:
[0007] Collect the surface image of the crankshaft casting;
[0008] Analyze the edge features of the surface image, perform the structural division of the surface image, and obtain several crankshaft structural parts;
[0009] Analyze the gray-scale features of the crankshaft structural parts, and identify the slag inclusion areas of the crankshaft structural parts;
[0010] Analyze the similarity between the slag inclusion areas of adjacent crankshaft structural parts, and complete the merging of the slag inclusion areas;
[0011] Classify the crankshaft castings with the slag inclusion regions according to the crankshaft structural parts to which the slag inclusion regions belong on the crankshaft castings.
[0012] In some embodiments of the present invention, analyze the edge features of the surface image, perform structural division of the surface image, and obtain several crankshaft structural parts, including:
[0013] Perform edge detection on the surface image to obtain a crankshaft edge image;
[0014] Rotate the crankshaft edge image to obtain a crankshaft edge positive image;
[0015] Based on the crankshaft edge positive image, identify the boundary lines between adjacent crankshaft structural parts, and combine with the edge lines to perform structural division of the surface image, and obtain several crankshaft structural parts.
[0016] In some embodiments of the present invention, based on the crankshaft edge positive image, identify the boundary lines between adjacent crankshaft structural parts, including:
[0017] Set the threshold of the number of consecutive pixel points;
[0018] In the crankshaft edge positive image, judge whether the number of consecutive pixel points other than the edge lines in the vertical direction is greater than or equal to the threshold of the number of consecutive pixel points;
[0019] If so, the consecutive pixel points other than the edge lines in the vertical direction are the suspected boundary lines between adjacent crankshaft structural parts;
[0020] Judge whether the line connected to the suspected boundary line is a crankshaft edge line;
[0021] If so, the consecutive pixel points other than the edge lines in the vertical direction are the boundary lines between adjacent crankshaft structural parts;
[0022] Traverse all the pixel points along the vertical direction other than the edge lines in the crankshaft edge positive image to identify the boundary lines between adjacent crankshaft structural parts.
[0023] In some embodiments of the present invention, combine with the edge lines to perform structural division of the surface image, and obtain several crankshaft structural parts, including:
[0024] According to the boundary lines, combine with the edge lines to construct a rectangular region, and the rectangular region represents the initial crankshaft structural part;
[0025] Combine with the structural features of the crankshaft casting to perform merging processing on the initial crankshaft structural part to obtain several crankshaft structural parts.
[0026] In some embodiments of the present invention, rotating the crankshaft edge image to obtain a positive crankshaft edge image includes:
[0027] In the crankshaft edge image, select the leftmost pixel point, connect the leftmost pixel point with its two adjacent pixel points on both sides, and respectively count the maximum lengths of consecutive pixel points along the two connection directions, denoted as and , and denote the angles between the two connection directions and the horizontal line direction as and , where corresponds to the angle , corresponds to the angle ;
[0028] In the crankshaft edge image, select the rightmost pixel point, connect the rightmost pixel point with its two adjacent pixel points on both sides, and respectively count the maximum lengths of consecutive pixel points along the two connection directions, denoted as and , and denote the angles between the two connection directions and the horizontal direction as and , where corresponds to the angle , corresponds to the angle ;
[0029] Compare the magnitudes of , , and , and select the angle corresponding to the maximum length as the rotation angle;
[0030] Rotate the crankshaft edge image clockwise by the rotation angle to obtain a positive crankshaft edge image.
[0031] In some embodiments of the present invention, after obtaining the positive crankshaft edge image, the method further includes:
[0032] Construct a rectangle based on the edge line corresponding to the maximum length and its adjacent edge lines, and the rectangle is the front-end area of the crankshaft casting.
[0033] In some embodiments of the present invention, analyzing the gray-scale features of the crankshaft structural part to identify the slag inclusion area of the crankshaft structural part includes:
[0034] Analyze the gray-scale differences between the pixel points on the crankshaft structural part and their neighborhood pixel points, and divide the crankshaft structural part into several sub-blocks;
[0035] Analyze the quantity distribution characteristics and gray-scale distribution characteristics of the pixel points in the divided block, and identify the slag inclusion area of the crankshaft structure part.
[0036] In some embodiments of the present invention, analyzing the quantity distribution characteristics and gray-scale distribution characteristics of the pixel points in the divided block, and identifying the slag inclusion area of the crankshaft structure part includes:
[0037] Analyze the ratio relationship of the quantity of pixel points and the magnitude of the gray-scale difference between the crankshaft structure part and the divided block, and obtain the possibility that the divided block is a slag inclusion area;
[0038] Preset a first possibility threshold;
[0039] Judge whether the possibility that the divided block is a slag inclusion area is greater than the first possibility threshold;
[0040] If so, the divided block is a slag inclusion area;
[0041] Traverse each divided block of all crankshaft structure parts, and identify the slag inclusion area of the crankshaft structure part.
[0042] In some embodiments of the present invention, analyzing the similarity between the slag inclusion areas of adjacent crankshaft structure parts to complete the merging of the slag inclusion areas includes:
[0043] Analyze the distance and gray-scale difference between the slag inclusion areas of adjacent crankshaft structure parts, and obtain the possibility that the slag inclusion areas of adjacent crankshaft structure parts are the same slag inclusion area;
[0044] Preset a second possibility threshold;
[0045] Judge whether the possibility that the slag inclusion areas of adjacent crankshaft structure parts are the same slag inclusion area is greater than the second possibility threshold;
[0046] If so, merge the slag inclusion areas of adjacent crankshaft structure parts, and divide the merged slag inclusion area into the slag inclusion structure part where the larger slag inclusion area is located;
[0047] Traverse all the slag inclusion areas of all adjacent crankshaft structure parts to complete the merging of the slag inclusion areas.
[0048] In some embodiments of the present invention, collecting the surface image of the crankshaft casting includes:
[0049] Collect the original surface image of the crankshaft casting;
[0050] Use semantic segmentation technology to perform segmentation processing on the original surface image to obtain the surface image of the crankshaft casting.
[0051] Compared with the prior art, the visual inspection method for slag inclusion defects in the crankshaft casting process provided by the present invention is based on the clear boundary of each mechanism on the surface of the crankshaft casting. First, by analyzing the edge features of the surface image of the crankshaft casting, the structure division of the surface image is completed, and several crankshaft structural parts are obtained. The accurate division of the crankshaft structural parts enables the identified slag inclusion defects to be located in specific structural areas, thereby making the identification of slag inclusion defects more refined and accurate, improving the accuracy of slag inclusion detection, and also facilitating subsequent repair by different means according to the positions of different slag inclusion defects. Then, analyze the gray-scale features of the crankshaft structural parts to identify the slag inclusion areas of the crankshaft structural parts; and analyze the similarity between the slag inclusion areas of adjacent crankshaft structural parts to complete the merging of the slag inclusion areas; finally, classify the crankshaft castings with slag inclusion areas according to the crankshaft structural parts to which the slag inclusion areas belong on the crankshaft casting, so as to achieve classified repair and improve the accuracy of slag inclusion defect identification and repair. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0053] Figure 1 Schematic diagram of the basic process of a visual inspection method for slag inclusion defects in the crankshaft casting process provided by an embodiment of the present invention;
[0054] Figure 2 Schematic diagram of the surface image of a crankshaft casting provided by an embodiment of the present invention;
[0055] Figure 3 Schematic diagram of the structural decomposition of a crankshaft casting provided by an embodiment of the present invention;
[0056] Figure 4 Schematic diagram of the edge image of a crankshaft provided by an embodiment of the present invention;
[0057] Figure 5 Schematic diagram of an included angle division provided by an embodiment of the present invention;
[0058] Figure 6 Schematic diagram of the positive image of the crankshaft edge provided by an embodiment of the present invention;
[0059] Figure 7 Schematic diagram of a suspected boundary line provided by an embodiment of the present invention;
[0060] Figure 8 A schematic diagram of a boundary line provided by an embodiment of the present invention;
[0061] Figure 9 A schematic diagram of an initial crankshaft structure part provided by an embodiment of the present invention;
[0062] Figure 10 A schematic diagram of a crankshaft structure part and its name markings provided by an embodiment of the present invention. Detailed implementation manners
[0063] In order to further elaborate on the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following combines the accompanying drawings and preferred embodiments to detail the specific implementation manners, structures, features and effects of the visual inspection method for slag inclusion defects in the crankshaft casting process according to the present invention. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. In addition, the specific features, structures or characteristics in one or more embodiments can be combined in any suitable form.
[0064] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field to which the present invention belongs. Terms such as "including", "comprising" or any other variant thereof are intended to cover non-exclusive inclusion, so that a circuit structure, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such article or device. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the article or device including the element.
[0065] The situations of slag inclusion defects in crankshaft castings during the casting process are diverse, that is, slag inclusion defects may exist in various structures of crankshaft castings, and general slag inclusion defect identification is based on the whole for identification, and subsequent refined classification and repair cannot be achieved. The present invention divides the structure of the crankshaft casting and then completes the identification of slag inclusion defects, which is convenient for subsequent repair of slag inclusion defects.
[0066] The following specifically describes the specific solution of a visual inspection method for slag inclusion defects in the crankshaft casting process provided by the present invention with reference to the accompanying drawings.
[0067] Please refer to Figure 1 , which shows the basic process of a visual inspection method for slag inclusion defects in the crankshaft casting process provided by an embodiment of the present invention.
[0068] As Figure 1As shown in the figure, a visual inspection method for slag inclusion defects in the crankshaft casting process provided by an embodiment of the present invention specifically includes:
[0069] S100: Collect the surface image of the crankshaft casting.
[0070] The present invention mainly identifies and analyzes the slag inclusion defects existing in the crankshaft casting process. During the crankshaft casting process, the casting material may contain incompletely melted metal particles or sand molds, refractory materials, etc., resulting in the mechanical properties and surface quality of the casting being affected. Using image processing algorithms can effectively identify these slag inclusion defects. Therefore, it is first necessary to use a high-resolution industrial camera to collect the surface image of the crankshaft casting. The specific implementation method is as follows: Use a high-resolution industrial camera to capture the original surface image of the crankshaft casting, ensure that the lighting conditions are stable during the process of collecting the original surface image, and avoid the influence of shadows and reflections on the detection results. Preprocess the collected original surface image of the crankshaft casting to improve the image quality, and use semantic segmentation technology to segment the crankshaft casting as the foreground and other areas as the background to complete the segmentation process of the original surface image and obtain the surface image of the crankshaft casting, as Figure 2 shown.
[0071] So far, the surface image of the crankshaft casting has been collected.
[0072] Slag inclusion is one of the common defects in the crankshaft casting process, which will destroy the continuity of the metal structure, thereby significantly reducing the mechanical properties of the crankshaft, including plasticity, toughness and fatigue strength, etc. The crankshaft casting includes crankshaft structural parts such as main journal, crank arm and oil passage. The influence of slag inclusion on the crankshaft is different on different crankshaft structural parts. Therefore, first divide the structure of the crankshaft casting, and then perform slag inclusion detection on different structures to facilitate the staff to classify and process. The process of performing slag inclusion detection on the crankshaft casting includes steps S200 to S400.
[0073] S200: Analyze the edge features of the surface image, perform structural division of the surface image, and obtain several crankshaft structural parts.
[0074] Based on the collected surface image of the crankshaft casting, specific analysis is carried out. During the crankshaft casting process, slag inclusion defects may appear in each crankshaft structural part. The distribution of each crankshaft structural part on the crankshaft casting has regularity, that is, the positions of adjacent crankshaft structural parts on the crankshaft casting are fixed. Starting from the front end of the crankshaft casting, it mainly includes: front end, balance weight, main journal, crank arm, connecting rod journal, rear end, etc., as Figure 3 shown. And the crankshaft casting has clear edges and obvious boundary lines between each crankshaft structural part on the crankshaft casting. Therefore, the crankshaft image can be divided based on the characteristics shown by each crankshaft structural part on the crankshaft casting.
[0075] Based on the above analysis, in the embodiments of the present invention, by analyzing the edge features of the surface image, the structure of the surface image is divided to obtain several crankshaft structure parts. Further, it includes:
[0076] First, based on the characteristic that the crankshaft casting has clear edges, edge detection is performed on the surface image to obtain a crankshaft edge image, as Figure 4 shown.
[0077] Then, since the placement angles of the crankshaft castings are complex and diverse, the distribution angles of the crankshafts on the surface images of the collected crankshaft castings also have diversity. Therefore, in the embodiments of the present invention, based on the crankshaft edge image obtained after edge detection, the surface image of the crankshaft casting is rotated to make the image of the crankshaft casting be distributed in the positive direction, obtaining a crankshaft edge positive image, which is convenient for structure division. The specific implementation method is:
[0078] In the crankshaft edge image, select the leftmost pixel point, connect the leftmost pixel point with its adjacent pixel point with a gray value of 1, and judge whether there are continuously existing pixel points with a gray value of 1 along this connection direction. In the crankshaft edge image, the gray value of the edge pixel point is 1. When there are 5 continuously existing pixel points with a gray value of 1 in this connection direction, it indicates that this connection direction is the edge line direction of the crankshaft casting. Then, along this connection direction, count the maximum length of the continuous pixel points (that is, the number of the most continuous pixel points), denoted as ; and, since the crankshaft casting has excellent structural properties and has multiple continuous directions on the edge, therefore, the included angle (acute angle) between this connection direction and the horizontal line direction is denoted as , the maximum length corresponds to the included angle , as Figure 5 shown, and subsequent analysis and judgment are carried out for this direction. It should be noted that due to the unique structure of the crankshaft casting, there are generally two adjacent pixel points for the leftmost pixel point in the crankshaft edge image. Here, first select one adjacent pixel point for analysis and judgment.
[0079] Then select another pixel point adjacent to the leftmost pixel point, connect the leftmost pixel point with the other adjacent pixel point, and repeat the above steps to obtain the maximum length of the continuous pixel points in this connection direction and the included angle corresponding to the maximum length , as Figure 5 shown. If there are no continuously existing pixel points in this connection direction, the judgment of this adjacent pixel point is abandoned.
[0080] Similarly, in the crankshaft edge image, select the rightmost pixel point, connect the rightmost pixel point with the adjacent pixel points on its two sides, and respectively count the maximum lengths of the continuous pixel points along the two connection directions, denoted as and , and denote the angles between the two connection directions and the horizontal direction as and , where the maximum length corresponds to the angle , the maximum length corresponds to the angle , as shown in Figure 5 .
[0081] Since the left and right sides of the crankshaft casting are the rear main sealing surface and the front end respectively. Among them, the front end shows the characteristic of a longer horizontal edge line, which is quite different from the rear main sealing surface. Therefore, in the embodiments of the present invention, by comparing , , and , the edge line with the maximum length is the horizontal edge line of the front end. Select the angle corresponding to the maximum length as the rotation angle, as shown in Figure 5 , is the maximum length, and the corresponding rotation angle is .
[0082] Rotate the crankshaft edge image clockwise by the rotation angle, that is, rotate the crankshaft edge image clockwise by the rotation angle , and the surface image of the crankshaft casting can be turned into a horizontal image to obtain the positive crankshaft edge image, as shown in Figure 6 .
[0083] After obtaining the positive crankshaft edge image, some embodiments of the present invention further include: according to the edge line corresponding to the maximum length and its adjacent edge lines, that is, select and corresponding edge lines as the two edges of the front end, and construct a rectangle with these two edges, then the rectangle is the front end area of the crankshaft casting, as shown in Figure 10 .
[0084] Finally, slag inclusions on the crankshaft casting generally appear as lumps and blocks, and their lengths in a certain continuous direction are relatively small. There are distinct boundaries between the various crankshaft structural parts of the crankshaft casting, and the boundary lines are all connected to the edge line of the crankshaft casting. Therefore, in the embodiments of the present invention, based on the positive crankshaft edge image, identify the boundary lines between adjacent crankshaft structural parts, combine with the edge lines, and perform structural division of the surface image to obtain several crankshaft structural parts.
[0085] Among them, based on the positive image of the crankshaft edge, the boundary lines between adjacent crankshaft structural parts are identified. The specific implementation method is as follows:
[0086] The structure of the crankshaft casting is distinct, and the boundary lines between adjacent crankshaft structural parts are relatively clearly visible. Therefore, it can be judged from the vertical lines on the positive image of the crankshaft edge. When connecting the edge lines of the crankshaft casting and there is a continuous pixel point distribution, it is determined as the boundary line between adjacent crankshaft structural parts. Specifically, by setting the threshold of the number of continuous pixel points, the value of the threshold of the number of continuous pixel points can be 10; in the positive image of the crankshaft edge, taking the pixel point with the first gray value of 1 in each column as the starting pixel point, judge whether the number of continuous pixel points other than the edge line in the vertical direction is greater than or equal to the threshold of the number of continuous pixel points; if so, that is, the number of continuous pixel points other than the edge line in the vertical direction is greater than 10, then the continuous pixel points other than the edge line in the vertical direction are the suspected boundary lines between adjacent crankshaft structural parts, and mark them, such as Figure 7 shown.
[0087] After marking all the suspected boundary lines, it is further necessary to analyze in combination with the edge lines of the crankshaft casting. Obtain the connected lines along the marked suspected boundary lines and judge whether the lines are the edge lines of the crankshaft casting. Since the boundary lines between the respective crankshaft structural parts of the crankshaft casting are all connected to the edge lines of the crankshaft casting, when the line connected to the marked suspected boundary line is not the edge line of the crankshaft casting, the mark of the suspected boundary line is cancelled. This is to eliminate the error phenomenon of the suspected boundary lines marked due to the distribution of large slag inclusions at the crankshaft edge. Specifically, judge whether the line connected to the suspected boundary line is the crankshaft edge line; if so, the continuous pixel points other than the edge line in the vertical direction are the boundary lines between adjacent crankshaft structural parts. Among them, the method for judging whether the line is the crankshaft edge line can be, on this line, taking the intersection point with the suspected boundary line as the starting point, counting the number of continuous pixel points with a gray value of 1. If there are more than 5 continuous pixel points with a gray value of 1, then the line is the crankshaft edge line.
[0088] Starting from the front-end area, traverse all the vertical-direction pixel points other than the edge lines in the positive image of the crankshaft edge to identify the boundary lines between adjacent crankshaft structural parts, such as Figure 8 shown.
[0089] So far, all the boundary lines between adjacent crankshaft structural parts in the positive image of the crankshaft edge are obtained.
[0090] Combined with the edge lines, the structure of the surface image is divided to obtain several crankshaft structural parts. The specific implementation method is as follows:
[0091] According to the intersection lines and in combination with the edge lines, that is, taking the intersection lines and the edge lines as sides, a rectangular area is constructed to divide the structure of the crankshaft casting. The rectangular area represents the initial crankshaft structure part, such as Figure 9 as shown.
[0092] Since the structure of the crankshaft casting is distinct, some integral structures on the crankshaft casting are divided into multiple parts, such as the crank arms; there are also some parts without specific functional names. Therefore, it is necessary to combine the structural characteristics of the crankshaft casting to merge the initial crankshaft structure parts, obtain several crankshaft structure parts, and mark their names, such as Figure 10 as shown. Specifically, the crank arm structure on the crankshaft casting is divided into three parts and merged; the rear main sealing surface is divided into two parts and merged; there is a structure (without a name) between the front end and the balance weight, and here it is merged with the front end; there is also a structure between the oil passage, the main journal, and the chamfer, and here it is merged with the main journal.
[0093] Thus, the structural division of the surface image is completed, and several crankshaft structure parts are obtained.
[0094] S300: Analyze the gray-scale characteristics of the crankshaft structure parts to identify the slag inclusion areas of the crankshaft structure parts.
[0095] Through step S200, the structural division of the surface image of the crankshaft casting is completed. When slag inclusions exist on different structures of the crankshaft casting, the effects on the crankshaft are different, and the corresponding repair methods may vary. Therefore, it is necessary to identify the slag inclusion defects on different crankshaft structure parts. Slag inclusion defects are generally formed by incompletely melted metal particles, or slag, grit, etc. being wrapped inside the casting during the solidification process, and slag inclusions generally appear as dots, flakes, or lumps, and the color of the slag inclusions is usually different from that of the surrounding materials. The slag inclusion defects on the crankshaft casting can be identified based on the above characteristics of the slag inclusions.
[0096] Based on the above analysis, in the embodiments of the present invention, the slag inclusion areas of the crankshaft structure parts are identified by analyzing the gray-scale characteristics of the crankshaft structure parts. Further, it includes:
[0097] First, analyze the gray-scale differences between the pixel points on the crankshaft structure parts and their neighboring pixel points, and divide the crankshaft structure parts into several blocks. The specific implementation method is: Select the th crankshaft structure part as a whole for analysis. Obtain the gray-scale value of the th pixel point on the th crankshaft structure part on the surface image of the crankshaft casting, select the eight-neighborhood of the th pixel point on the th crankshaft structure part for analysis, and calculate the th crankshaft structure part on the The difference between a pixel and the th pixel within its eight - neighborhood:
[0098]
[0099] In the formula, represents the gray - level difference between the th pixel on the th crankshaft structural part and the th pixel within its eight - neighborhood; represents the gray - level value of the th pixel on the th crankshaft structural part; represents the gray - level value of the th pixel within the eight - neighborhood of the th pixel on the th crankshaft structural part.
[0100] The similarity between a pixel on the crankshaft structural part and its neighborhood pixels is represented by the absolute value of the difference between the gray - level value of the pixel on the crankshaft structural part and the gray - level value of the pixel within its eight - neighborhood, and the crankshaft structural part is divided into blocks accordingly.
[0101] Set a gray - level difference threshold . When the gray - level difference , they are divided into the same block. Repeat the above steps to traverse all the pixels on the th crankshaft structural part and divide them into different blocks.
[0102] Then, analyze the quantity distribution characteristics and gray - level distribution characteristics of the pixels in the block to identify the slag - inclusion area of the crankshaft structural part. The specific implementation method is as follows: Obtain the number of pixels in the th block on the th crankshaft structural part, and, obtain the number of all pixels on the th crankshaft structural part. Then analyze the ratio relationship of the number of pixels between the crankshaft structural part and the block, that is, obtain ; Obtain the gray - level mean value of pixels in the th block on the th crankshaft structural part, and, obtain the gray - level mean value of all pixels on the th crankshaft structural part. Then analyze the magnitude of the gray - level difference between the crankshaft structural part and the block, that is, obtain ; Combine the ratio relationship of the quantity and the magnitude of the gray - level difference to obtain the possibility that the block is a slag - inclusion area and construct the The probability formula for the th block on the
[0103]
[0104] In the formula, represents the probability that the th block on the th crankshaft structure part is a slag inclusion area; represents the number of pixel points in the th block on the th crankshaft structure part; represents the total number of pixel points on the th crankshaft structure part; represents the average gray value of the pixel points in the th block on the th crankshaft structure part; represents the average gray value of all pixel points on the th crankshaft structure part; represents the linear normalization function.
[0105] In the above formula, the performance of the th block on the th crankshaft structure part is mainly used to analyze the possibility of it belonging to the slag inclusion defect. For a certain crankshaft structure part on the crankshaft casting, the slag inclusion defect on its surface is generally smaller compared to the entire crankshaft structure part. In terms of the quantity ratio, that is, the fewer the number of pixel points in a certain block, the greater the possibility that it belongs to the slag inclusion; except for the slag inclusion part on the crankshaft structure part, its color performance is similar and the quantity is large. Therefore, the color of the slag inclusion part has a large difference compared to the average color of the entire crankshaft structure part. Therefore, The larger the value, the greater the gray value difference of the pixel points between the crankshaft structure part and the block, and the greater the possibility that the block is a slag inclusion area;
[0106] Preset the first probability threshold ; judge whether the probability that the block is a slag inclusion area is greater than the first probability threshold; if so, that is , then the block is a slag inclusion area; traverse each block of all crankshaft structure parts to identify the slag inclusion areas of the crankshaft structure parts. Obtain the slag inclusion areas on each structure of the crankshaft casting.
[0107] S400: Analyze the similarity between the slag inclusion regions of adjacent crankshaft structural parts and complete the merging of the slag inclusion regions.
[0108] For the slag inclusion regions identified on the crankshaft casting, they may originally belong to the same slag inclusion defect, but due to the division of the crankshaft structure, they are divided into two parts. Therefore, it is necessary to further determine whether the identified slag inclusion regions can be merged.
[0109] Since each crankshaft structural part of the crankshaft casting is relatively large, when there is a slag inclusion in adjacent crankshaft structural parts, it may be the same slag inclusion region; when there is a slag inclusion region in non-adjacent structural regions, since the crankshaft structural parts where they are located have no connection, they cannot be the same slag inclusion region.
[0110] Therefore, in the embodiment of the present invention, analyze the similarity between the slag inclusion regions of adjacent crankshaft structural parts and complete the merging of the slag inclusion regions. Further, it includes: analyzing the distance and gray level difference between the slag inclusion regions of adjacent crankshaft structural parts to obtain the possibility that the slag inclusion regions of adjacent crankshaft structural parts are the same slag inclusion region. The possibility calculation formula for the slag inclusion regions of adjacent crankshaft structural parts being the same slag inclusion region is constructed as:
[0111]
[0112] In the formula, represents the possibility that the th slag inclusion region on the th crankshaft structural part of the crankshaft casting and the th slag inclusion region on the th crankshaft structural part are the same slag inclusion region; represents the distance difference sequence of the pixel points in the slag inclusion region on the th crankshaft structural part and the th crankshaft structural part of the crankshaft casting, where the distance difference sequence is a sequence composed of the distances between any pixel point in the slag inclusion region on the th crankshaft structural part and any pixel point in the slag inclusion region on the th crankshaft structural part; represents the minimum value function; represents the average gray level of the pixel points in the th block on the th crankshaft structural part of the crankshaft casting; represents the average gray level of the pixel points in the th block on the th crankshaft structural part of the crankshaft casting; represents the linear normalization function; is to prevent the denominator from being 0.
[0113] The above formula mainly calculates based on the shortest distance between slag inclusion regions on adjacent crankshaft structural parts and the average gray value. Suppose the slag inclusions on the crankshaft casting are divided into two parts by different crankshaft structural parts, the color manifestations of these two parts are almost the same, and the position distributions of these two parts on the crankshaft casting are connected. Therefore, The smaller the value, the closer the distance between the two slag inclusion regions, that is, the closer the position distributions of the two slag inclusion regions are, indicating that the possibility that the two slag inclusion regions are the same slag inclusion region is greater; The smaller the value, the more similar the average gray values of the two slag inclusion regions, indicating that the color manifestations of the two slag inclusion regions are more consistent, and indicating that the possibility that the two slag inclusion regions are the same slag inclusion region is greater.
[0114] Preset a second possibility threshold, ; determine whether the possibility that the slag inclusion regions of adjacent crankshaft structural parts are the same slag inclusion region is greater than the second possibility threshold; if so, that is , indicating that the two slag inclusion regions belong to the same slag inclusion region, then merge the slag inclusion regions of adjacent crankshaft structural parts; then based on the sizes of the two slag inclusion regions, divide the merged slag inclusion region into the slag inclusion structure part where the larger slag inclusion region is located.
[0115] Traverse all slag inclusion regions of all adjacent crankshaft structural parts to complete the merging of slag inclusion regions.
[0116] S500: Classify the crankshaft castings with the slag inclusion regions according to the crankshaft structural parts to which the slag inclusion regions belong on the crankshaft casting.
[0117] Through the above steps, the slag inclusion regions of each crankshaft structural part on the crankshaft casting are identified. Since the functions of different crankshaft structural parts on the crankshaft casting are different, for the slag inclusion defects appearing on different crankshaft structural parts, the repair treatment methods are also different. Therefore, classifying the crankshaft castings with the slag inclusion regions according to the crankshaft structural parts to which the slag inclusion regions belong on the crankshaft casting is convenient for subsequent repair treatment. The specific implementation method is: first, automatically classify the crankshaft castings with the slag inclusion regions according to the distribution positions of the slag inclusion regions on the crankshaft casting. At the same time, when multiple crankshaft castings continuously have slag inclusion defects, an alarm is sent to the staff in time to check whether there are problems with the casting equipment.
[0118] It should be noted that: the above sequence of embodiments of the present invention is only for description and does not represent the advantages and disadvantages of the embodiments. The processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0119] The various embodiments in this specification are described in a progressive manner. For the same or similar parts among the various embodiments, reference can be made to each other, and the key point of each embodiment is to illustrate the differences from other embodiments.
Claims
1. A visual detection method for slag inclusion defects in a crankshaft casting process, characterized in that: The method comprises: Acquire surface images of crankshaft castings; Analyzing edge features of the surface image, performing structural division of the surface image, and obtaining a number of crankshaft structural parts; Analyzing the grayscale features of the crankshaft structure to identify the slag inclusion area of the crankshaft structure; Analyzing the similarity between the slag inclusion regions of adjacent crankshaft structural parts to complete the merging of the slag inclusion regions; Classifying the crankshaft casting having the slag inclusion area according to the crankshaft structural part to which the slag inclusion area belongs on the crankshaft casting; Analyze the edge features of the surface image, perform structural division on the surface image, and obtain several crankshaft structural parts, including: Performing edge detection on the surface image to obtain a crankshaft edge image; Rotating the crankshaft edge image to obtain a crankshaft edge positive image; Based on the positive image of the crankshaft edge, identifying the boundary lines between adjacent crankshaft structural parts, combining the edge lines, performing structural division of the surface image, and obtaining a plurality of crankshaft structural parts; Based on the crankshaft edge positive image, identifying the boundary lines between adjacent crankshaft structural parts, including: Set the threshold of the number of consecutive pixels; In the crankshaft edge positive image, determining whether the number of continuous pixel points other than edge lines in the vertical direction is greater than or equal to the continuous pixel point number threshold; If yes, the continuous pixel points except the edge lines in the vertical direction are the suspected boundary lines between the adjacent crankshaft structural parts; Determining whether the line connected to the suspected boundary line is a crankshaft edge line; If yes, the continuous pixel points except the edge lines in the vertical direction are the boundary lines between adjacent crankshaft structural parts; All pixel points along the vertical direction except the edge lines in the positive image of the crankshaft edge are traversed to identify the boundary lines between adjacent crankshaft structural parts.
2. The method for visual detection of slag inclusion defects in crankshaft casting process according to claim 1, characterized in that: Combined with the edge lines, the surface image is structurally divided to obtain several crankshaft structural parts, including: According to the boundary lines, combined with the edge lines, a rectangular area is constructed, wherein the rectangular area represents the initial crankshaft structure portion; In combination with the structural features of the crankshaft casting, the initial crankshaft structural parts are combined to obtain a plurality of crankshaft structural parts.
3. The method for visual detection of slag inclusion defects in crankshaft casting process according to claim 1, characterized in that: The crankshaft edge image is rotated to obtain a crankshaft edge positive image, including: In the crankshaft edge image, the leftmost pixel is selected, and the leftmost pixel and the adjacent pixels on both sides are connected. The maximum length of the continuous pixels along the two connecting lines is counted and recorded as and , and the angle between the two connecting lines and the horizontal line is recorded as and ,in Corresponding angle , Corresponding angle ; In the crankshaft edge image, the rightmost pixel is selected, and the rightmost pixel and the adjacent pixels on both sides are connected. The maximum length of the continuous pixels along the two connecting lines is counted and recorded as and , and the angle between the two connecting lines and the horizontal direction is recorded as and ,in Corresponding angle , Corresponding angle ; Compare , , and The size of the length is selected, and the angle corresponding to the maximum length is selected as the rotation angle; The crankshaft edge image is rotated clockwise by the rotation angle to obtain a crankshaft edge positive image.
4. The method for visual detection of slag inclusion defects in crankshaft casting process according to claim 3, characterized in that: After obtaining the positive image of the crankshaft edge, the method further includes: A rectangle is constructed according to the edge line corresponding to the maximum length and its adjacent edge lines, and the rectangle is the front end area of the crankshaft casting.
5. The method for visual detection of slag inclusion defects in crankshaft casting process according to claim 1, characterized in that: Analyzing the grayscale features of the crankshaft structure to identify the slag inclusion area of the crankshaft structure includes: Analyze the grayscale difference between a pixel point on the crankshaft structure and its neighboring pixel points, and divide the crankshaft structure into a plurality of blocks; The quantity distribution characteristics and grayscale distribution characteristics of the pixels in the blocks are analyzed to identify the slag inclusion area of the crankshaft structure.
6. The method for visual detection of slag inclusion defects in crankshaft casting process according to claim 5, characterized in that: Analyzing the number distribution characteristics and grayscale distribution characteristics of the pixels in the blocks to identify the slag inclusion area of the crankshaft structure, including: Analyze the pixel number ratio and grayscale difference between the crankshaft structure and the block to obtain the possibility that the block is a slag inclusion area; Presetting a first possibility threshold; Determine whether the possibility that the block is a slag inclusion area is greater than the first possibility threshold; If yes, the block is a slag inclusion area; Each block of all crankshaft structural parts is traversed to identify the slag inclusion area of the crankshaft structural part.
7. The method for visual detection of slag inclusion defects in crankshaft casting process according to claim 1, characterized in that: Analyzing the similarity between the slag inclusion regions of adjacent crankshaft structural parts and completing the merging of the slag inclusion regions, including: Analyze the distance and grayscale difference between the slag inclusion regions of the adjacent crankshaft structural parts to obtain the possibility that the slag inclusion regions of the adjacent crankshaft structural parts are the same slag inclusion region; Presetting a second possibility threshold; Determining whether the possibility that the slag inclusion regions of the adjacent crankshaft structural parts are the same slag inclusion region is greater than the second possibility threshold; If yes, merging the slag inclusion areas of the adjacent crankshaft structural parts, and dividing the merged slag inclusion areas into the slag inclusion structural part where the larger slag inclusion area is located; All the slag inclusion regions of all adjacent crankshaft structural parts are traversed to complete the merging of the slag inclusion regions.
8. The method for visual detection of slag inclusion defects in crankshaft casting process according to claim 1, characterized in that: Acquire surface images of crankshaft castings, including: Collect the original surface image of the crankshaft casting; The original surface image is segmented using semantic segmentation technology to obtain a surface image of the crankshaft casting.
Citation Information
Patent Citations
Semitrailer axle defect identification method based on computer vision
CN115984272A
Engine crankshaft defect detection device and detection method
CN117849055A