Visual detection method for slag inclusion defect in 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 crankshaft castings is achieved, solving the problem of intricate identification of slag inclusion defects in the prior art, and improving detection accuracy and repair efficiency.
Patent Information
- Application Number
- CN202510449614.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-11
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2045-04-11
AI Technical Summary
During the crankshaft casting process, the prior art is difficult to efficiently and accurately identify and classify slag inclusion defects, resulting in a reduction in the mechanical properties of the crankshaft and the inability to perform fine repair.
By collecting the surface images of the crankshaft castings, analyzing edge features for structural division, identifying the slag inclusion areas, and combining the slag inclusion areas according to similarity, finally classifying the crankshaft castings with slag inclusion areas.
The detailed identification and classification of slag inclusion defects of crankshaft castings is realized, the accuracy of detection is improved, the subsequent repair processing is facilitated, and the quality and safety of crankshafts are improved.
Smart Images

Figure CN119991651A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of visual detection, and in particular to a slag inclusion defect visual detection method for a crankshaft casting process. Background Art
[0002] In the automotive manufacturing, machinery manufacturing and other industries, the crankshaft is a key power transmission component, and its quality and performance are directly related to the reliability and service life of the whole machine. However, during the crankshaft casting process, defects often occur due to the influence of various factors such as raw materials and process conditions. These defects will not only reduce the performance of the crankshaft, but may also cause 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. Therefore, efficient and accurate slag inclusion defect detection during the crankshaft casting process is of great significance to improving the quality of the crankshaft and ensuring the safe operation of the equipment.
[0003] The crankshaft includes the front end, counterweight, oil channel, main journal, chamfer, crank arm, connecting rod journal, balance hole, rear end and rear main sealing surface. The slag inclusion on different crankshaft structures has different effects on the crankshaft, and the means of repairing it are also different. There are many situations in which slag inclusion defects appear in the casting process of crankshaft castings, that is, slag inclusion defects may exist in various crankshaft structures of crankshaft castings, and the general slag inclusion defect identification is based on overall identification, and it is impossible to achieve fine classification and repair later.
[0004] Therefore, there is an urgent need for a method to classify and identify slag inclusion defects in the crankshaft casting process. Summary of the invention
[0005] In order to solve the above technical problems, the object of the present invention is to provide a slag inclusion defect visual detection method for a crankshaft casting process.
[0006] According to a first aspect of an embodiment of the present invention, a visual detection method for slag inclusion defects in a crankshaft casting process is provided, and the technical solution adopted is specifically as follows: 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; The crankshaft casting having the slag inclusion area is classified according to the crankshaft structure part to which the slag inclusion area belongs on the crankshaft casting.
[0007] In some embodiments of the present invention, the edge features of the surface image are analyzed, and the structure of the surface image is divided to obtain a number of 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 crankshaft edge positive image, the boundary lines between adjacent crankshaft structural parts are identified, and the surface image is structurally divided in combination with the edge lines to obtain a number of crankshaft structural parts.
[0008] In some embodiments of the present invention, identifying the boundary lines between adjacent crankshaft structural parts based on the crankshaft edge positive image includes: 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.
[0009] In some embodiments of the present invention, the surface image is structurally divided in combination with edge lines to obtain a number of 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.
[0010] In some embodiments of the present invention, rotating the crankshaft edge image to obtain a crankshaft edge positive image includes: 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.
[0011] In some embodiments of the present invention, 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.
[0012] In some embodiments of the present invention, 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.
[0013] In some embodiments of the present invention, 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 includes: 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.
[0014] In some embodiments of the present invention, analyzing the similarity between the slag inclusion regions of adjacent crankshaft structural parts to complete the merging of the slag inclusion regions includes: 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.
[0015] In some embodiments of the present invention, collecting a surface image of a crankshaft casting includes: Acquire 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.
[0016] Compared with the prior art, the visual detection method for slag inclusion defects in the crankshaft casting process provided by the present invention is based on the clear boundaries of the various surface structures of the crankshaft casting. First, by analyzing the edge features of the surface image of the crankshaft casting, the structural division of the surface image is completed to obtain a number of crankshaft structural parts. The accurate division of the crankshaft structural parts allows 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 the subsequent repair of different means for different locations of slag inclusion defects. Then, the grayscale features of the crankshaft structural part are analyzed to identify the slag inclusion area of the crankshaft structural part; and the similarities between the slag inclusion areas of adjacent crankshaft structural parts are analyzed to complete the merging of the slag inclusion areas; finally, according to the crankshaft structural part to which the slag inclusion area belongs on the crankshaft casting, the crankshaft casting with the slag inclusion area is classified, thereby achieving classified repair and improving the accuracy of slag inclusion defect identification and repair. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0018] Figure 1 A basic flow chart of a method for visually detecting slag inclusion defects in a crankshaft casting process provided by one embodiment of the present invention; Figure 2 A schematic diagram of a surface image of a crankshaft casting provided by one embodiment of the present invention; Figure 3 A schematic diagram of the structure decomposition of a crankshaft casting provided by one embodiment of the present invention; Figure 4 A schematic diagram of a crankshaft edge image provided by an embodiment of the present invention; Figure 5 A schematic diagram of angle division provided by an embodiment of the present invention; Figure 6 A schematic diagram of a positive image of a crankshaft edge provided by an embodiment of the present invention; Figure 7 A schematic diagram of a suspected boundary line provided by an embodiment of the present invention; Figure 8 A schematic diagram of a boundary line provided by an embodiment of the present invention; Fig. 9 A schematic diagram of an initial crankshaft structure provided by an embodiment of the present invention; Fig.10 A schematic diagram of a crankshaft structure and name marking provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0019] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of the specific implementation method, structure, features and effects of the visual detection method for slag inclusion defects in the crankshaft casting process proposed by the present invention in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.
[0020] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which the present invention belongs. Terms such as "comprises", "comprising" or any other variants thereof are intended to cover non-exclusive inclusion, so that a circuit structure, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such article or device. In the absence of further restrictions, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the article or device including the element.
[0021] There are many situations in which slag inclusion defects occur in crankshaft castings during the casting process, that is, slag inclusion defects may exist in various structures of crankshaft castings, and general slag inclusion defect identification is based on overall identification, and subsequent refined classification and repair cannot be achieved. The present invention divides the crankshaft casting into structures, and then completes slag inclusion defect identification, which facilitates subsequent repair of slag inclusion defects.
[0022] A specific scheme of a visual detection method for slag inclusion defects in a crankshaft casting process provided by the present invention is described in detail below in conjunction with the accompanying drawings.
[0023] See also Figure 1 , which shows the basic process of a slag inclusion defect visual detection method for a crankshaft casting process provided by an embodiment of the present invention.
[0024] like Figure 1 As shown, a visual detection method for slag inclusion defects in a crankshaft casting process provided by an embodiment of the present invention specifically includes: S100: Acquire the surface image of the crankshaft casting.
[0025] The present invention is mainly aimed at identifying and analyzing 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., which may affect the mechanical properties and surface quality of the casting. These slag inclusion defects can be effectively identified using image processing algorithms, so it is first necessary to use a high-resolution industrial camera to capture the surface image of the crankshaft casting. The specific implementation method is: 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 acquisition of the original surface image, and avoid the influence of shadows and reflections on the detection results. The collected original surface image of the crankshaft casting is preprocessed to improve the image quality, and the semantic segmentation technology is used to segment the crankshaft casting as the foreground and other areas as the background to complete the segmentation of the original surface image and obtain the surface image of the crankshaft casting, such as Figure 2 shown.
[0026] At this point, the surface image of the crankshaft casting has been collected.
[0027] 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. The crankshaft casting includes crankshaft structural parts such as the main journal, crank arm and oil channel. The effects of slag inclusion on different crankshaft structural parts on the crankshaft are different. Therefore, the crankshaft casting is first structurally divided, and then slag inclusion detection is performed for different structures to facilitate classification and processing by staff. The process of slag inclusion detection on crankshaft castings includes steps S200 to S400.
[0028] S200: Analyze edge features of the surface image, perform structural division of the surface image, and obtain a number of crankshaft structural parts.
[0029] A specific analysis is performed based on the collected surface images of the crankshaft casting. During the crankshaft casting process, slag inclusion defects may occur in various crankshaft structural parts. The distribution of various crankshaft structural parts on the crankshaft casting is regular, 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 and other parts, such as Figure 3 As shown. Moreover, the crankshaft casting has clear edges and obvious boundary lines between the various crankshaft structural parts on the crankshaft casting. Therefore, the crankshaft image can be divided based on the characteristics of the various crankshaft structural parts on the crankshaft casting.
[0030] Based on the above analysis, in an embodiment of the present invention, the edge features of the surface image are analyzed to perform structural division of the surface image to obtain several crankshaft structural parts. Further comprising: First, based on the characteristic of crankshaft castings with clear edges, edge detection is performed on the surface image to obtain the crankshaft edge image, such as Figure 4 shown.
[0031] Then, since the placement angles of the crankshaft casting are complex and diverse, the distribution angles of the crankshaft on the collected surface image of the crankshaft casting are also diverse. Therefore, in an embodiment of the present invention, the surface image of the crankshaft casting is rotated based on the crankshaft edge image obtained after edge detection, so that the image of the crankshaft casting is distributed in the positive direction, and the positive image of the crankshaft edge is obtained, which is convenient for structural division. The specific implementation method is as follows: In the crankshaft edge image, select the leftmost pixel point, connect the leftmost pixel point and its adjacent pixel point with a gray value of 1, and determine whether there are continuous pixels with a gray value of 1 along the direction of this line. In the crankshaft edge image, the gray value of the edge pixel point is 1. When there are 5 consecutive pixels with a gray value of 1 in the direction of this line, it means that the direction of this line is the edge line direction of the crankshaft casting. Then count the maximum length of continuous pixels along the direction of this line (that is, the maximum number of continuous pixels), recorded as ; and, since the crankshaft casting has excellent structural properties and has multiple continuous directions on the edge, the angle (acute angle) between the connecting line direction and the horizontal line direction is recorded as , maximum length Corresponding angle ,like Figure 5It should be noted that due to the unique structure of the crankshaft casting, the leftmost pixel in the crankshaft edge image generally has two adjacent pixels. Here, one adjacent pixel is selected for analysis and judgment.
[0032] Then select another pixel point adjacent to the leftmost pixel point, connect the leftmost pixel point and the other pixel point adjacent to it, repeat the above steps, and obtain the maximum length of the continuous pixels in the direction of this connection. and maximum length Corresponding angle ,like Figure 5 If there are no continuous pixels in the direction of the line, the judgment of the adjacent pixels is abandoned.
[0033] Similarly, in the crankshaft edge image, select the rightmost pixel point, connect the rightmost pixel point with the adjacent pixels on both sides, and count the maximum length of continuous pixels along the two connecting lines, which is recorded as and , and the angle between the two connecting lines and the horizontal direction is recorded as and , where the maximum length Corresponding angle , maximum length Corresponding angle ,like Figure 5 shown.
[0034] Since the left and right sides of the crankshaft casting are the rear main sealing surface and the front end, the front end has a long horizontal edge line, which is quite different from the rear main sealing surface. , , and The maximum length of the edge line is the horizontal edge line at the front end, and the angle corresponding to the maximum length is selected as the rotation angle, such as Figure 5 As shown, is the maximum length, and the corresponding rotation angle is .
[0035] Rotate the crankshaft edge image clockwise by angle, that is, rotate the crankshaft edge image clockwise by angle , the surface image of the crankshaft casting can be converted into a horizontal image, and the positive image of the crankshaft edge can be obtained, such as Figure 6 shown.
[0036] After obtaining the positive image of the crankshaft edge, in some embodiments of the present invention, the method further includes: selecting the edge line corresponding to the maximum length and its adjacent edge line. and The corresponding edge lines are used as the two edges of the front end, and a rectangle is constructed with them as two sides. The rectangle is the front end area of the crankshaft casting, such as Fig.10 shown.
[0037] Finally, slag inclusions on crankshaft castings are generally in the form of lumps or blocks, and their length in a certain continuous direction is relatively small, while there are relatively clear boundaries between the various crankshaft structural parts of the crankshaft casting, and the boundary lines are connected to the edge lines of the crankshaft casting. Therefore, in the embodiment of the present invention, based on the positive image of the crankshaft edge, the boundary lines between adjacent crankshaft structural parts are identified, and the surface image is structurally divided in combination with the edge lines to obtain several crankshaft structural parts.
[0038] Wherein, based on the positive image of the crankshaft edge, the boundary lines between adjacent crankshaft structural parts are identified, and the specific implementation method is as follows: The crankshaft casting has a distinct structure, and the boundary lines between adjacent crankshaft structural parts are relatively clear and visible. Therefore, it can be judged from the vertical lines on the positive image of the crankshaft edge. When the edge lines of the crankshaft casting are connected and there is a continuous pixel distribution, it is identified as the boundary line between adjacent crankshaft structural parts. Specifically, by setting a threshold for the number of continuous pixels, the threshold for the number of continuous pixels can be 10; in the positive image of the crankshaft edge, the first pixel with a gray value of 1 in each column is used as the starting pixel point, and it is judged whether the number of continuous pixels in the vertical direction other than the edge lines is greater than or equal to the threshold for the number of continuous pixels; if so, that is, the number of continuous pixels in the vertical direction other than the edge lines is greater than 10, then the continuous pixels in the vertical direction other than the edge lines are suspected boundary lines between adjacent crankshaft structural parts, and they are marked, such as Figure 7 shown.
[0039] After marking all the suspected boundary lines, it is further necessary to analyze them in combination with the edge lines of the crankshaft casting, obtain the lines connected to the marked suspected boundary lines along the marked suspected boundary lines, and determine whether the lines are the edge lines of the crankshaft casting. Since the boundary lines between the various crankshaft structural parts of the crankshaft casting are connected to the edge lines of the crankshaft casting, when the lines connected to the marked suspected boundary lines are not the edge lines of the crankshaft casting, the suspected boundary lines are unmarked. This is to eliminate the phenomenon that errors occur in the marked suspected boundary lines caused by large pieces of slag being distributed at the edge of the crankshaft. Specifically, it is determined whether the lines connected to the suspected boundary lines are the edge lines of the crankshaft; if so, the continuous pixel points in the vertical direction except the edge lines are the boundary lines between adjacent crankshaft structural parts. Among them, the method for judging whether the line is the edge line of the crankshaft can be that on the line, the number of continuous pixel points with a gray value of 1 is counted with the intersection point with the suspected boundary line as the starting point, and if there are more than 5 continuous pixel points with a gray value of 1, the line is the edge line of the crankshaft.
[0040] Starting from the front end area, all the pixels in 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, such as Figure 8 shown.
[0041] At this point, all boundary lines between adjacent crankshaft structural parts in the positive image of the crankshaft edge are obtained.
[0042] Combined with the edge lines, the surface image is divided into structures to obtain several crankshaft structural parts. The specific implementation method is as follows: According to the boundary lines and edge lines, a rectangular area is constructed with the boundary lines and edge lines as edges to divide the crankshaft casting into structural parts. The rectangular area represents the initial crankshaft structure, such as Fig. 9 shown.
[0043] Since the crankshaft casting has a distinct structure, some integrated structures on the crankshaft casting are divided into multiple parts, such as the crank arm; and there are also some parts without specific functional names. Therefore, it is necessary to combine the structural characteristics of the crankshaft casting, merge the initial crankshaft structure parts, obtain several crankshaft structure parts, and mark them with names, such as Fig.10 Specifically, the crank arm structure on the crankshaft casting is divided into three parts, which are merged; the rear main sealing surface is divided into two parts, which are merged; there is a structure (no name) between the front end and the balance weight, which is merged with the front end here; there is also a structure between the oil passage, the main journal, and the chamfer, which is merged with the main journal here.
[0044] At this point, the structural division of the surface image is completed, and several crankshaft structural parts are obtained.
[0045] S300: Analyze the grayscale features of the crankshaft structure and identify the slag inclusion area of the crankshaft structure.
[0046] 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 impact on the crankshaft is different, and the corresponding means of repair may be different. Therefore, it is necessary to identify slag inclusion defects on different crankshaft structural parts. Slag inclusion defects are generally formed by incompletely melted metal particles, or slag, gravel, etc. that are wrapped inside the casting during the solidification process, and the slag inclusions generally appear in the form of dots, sheets or lumps, and the color of the slag inclusions is usually different from the surrounding materials. The slag inclusion defects on the crankshaft casting can be identified based on the above characteristics of the slag inclusions.
[0047] Based on the above analysis, in an embodiment of the present invention, the slag inclusion area of the crankshaft structure is identified by analyzing the grayscale features of the crankshaft structure. Further, the method includes: First, the grayscale difference between the pixel point on the crankshaft structure and its neighboring pixel points is analyzed to divide the crankshaft structure into several blocks. The crankshaft structure is analyzed as a whole. The crankshaft structure Gray value of pixel , select The crankshaft structure Analyze the eight neighborhoods of pixels and calculate the The crankshaft structure A pixel and its eight neighbors The difference of pixels: In the formula, Indicates The crankshaft structure A pixel and its eight neighbors Grayscale difference of pixels; Indicates The crankshaft structure The gray value of each pixel; Indicates The crankshaft structure The eight-neighborhood of the pixel The gray value of a pixel.
[0048] The absolute value of the difference between the grayscale value of the pixel point on the crankshaft structure and the grayscale values of the pixels in its eight neighborhoods is used to represent the similarity between the pixel point on the crankshaft structure and its neighborhood pixels, and the crankshaft structure is divided into blocks.
[0049] Set grayscale difference threshold , when the grayscale difference , divide it into the same block. Repeat the above steps to traverse the All the pixels on the crankshaft structure are divided into different blocks.
[0050] Then, the number distribution characteristics and grayscale distribution characteristics of the pixels in the blocks are analyzed to identify the slag inclusion area of the crankshaft structure. The first crankshaft structure The number of pixels in a block , and obtain the The number of all pixels on the crankshaft structure , and then analyze the ratio of the number of pixels between the crankshaft structure and the blocks, and get ; Get the The first crankshaft structure The grayscale mean of the pixels in each block , and obtain the The grayscale mean of all pixels on the crankshaft structure , and then analyze the grayscale difference of pixels between the crankshaft structure and the blocks, and get ; Combined with the quantitative ratio relationship Grayscale difference , get the possibility of dividing the blocks into slag inclusion areas, and construct the The first crankshaft structure The probability formula for a block to be a slag inclusion area is: In the formula, Indicates The first crankshaft structure The possibility that each block is a slag inclusion area; Indicates The first crankshaft structure The number of pixels in a block; Indicates The number of all pixels on the crankshaft structure; Indicates The first crankshaft structure The grayscale mean of the pixels in each block; Indicates The grayscale mean of all pixels on the crankshaft structure; represents the linear normalization function.
[0051] The above formula mainly uses the The crankshaft structure The performance of each block is used to analyze the possibility of a slag inclusion defect. For a certain crankshaft structure on a crankshaft casting, the slag inclusion defects on its surface are generally smaller than those of the entire crankshaft structure, which is reflected in the percentage of quantity, that is, the smaller the number of pixels in a certain block, the greater the possibility that it is a slag inclusion; except for the slag inclusion part, the color performance of the crankshaft structure is similar, and the number is large, so the color of the slag inclusion part is compared with the average color of the entire crankshaft structure. Therefore, The larger the value, the greater the grayscale difference of the pixels between the crankshaft structure and the block, indicating that the block is more likely to be a slag inclusion area; The larger the value, the smaller the number of pixels in the block when the number of pixels in the crankshaft structure is constant, which means the smaller the size of the block is, and the greater the possibility that the block is a slag inclusion area.
[0052] Preset the first possibility threshold ; Determine whether the possibility of the block being a slag inclusion area is greater than the first possibility threshold; if so, , then the block is the slag inclusion area; traverse each block of all crankshaft structural parts to identify the slag inclusion area of the crankshaft structural part. Obtain the slag inclusion area on each structure of the crankshaft casting.
[0053] S400: Analyze the similarity between the slag inclusion regions of adjacent crankshaft structural parts, and complete the merging of the slag inclusion regions.
[0054] For the slag inclusion area identified on the crankshaft casting, it may originally belong to the same slag inclusion defect, but due to the division of the crankshaft structure, it is divided into two parts. Based on this, it is necessary to further determine whether the identified slag inclusion area can be merged.
[0055] Since each crankshaft structural part of the crankshaft casting is relatively large, when slag inclusions exist in adjacent crankshaft structural parts, they may be the same slag inclusion area; when slag inclusion areas are located in non-adjacent structural areas, since the crankshaft structural parts in which they are located are not connected, they cannot be the same slag inclusion area.
[0056] Therefore, in an embodiment of the present invention, the similarity between the slag inclusion regions of adjacent crankshaft structural parts is analyzed to complete the merging of the slag inclusion regions. Further comprising: analyzing the distance and grayscale 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 calculation formula for constructing the possibility that the slag inclusion regions of adjacent crankshaft structural parts are the same slag inclusion region is: In the formula, Indicates the crankshaft casting The first crankshaft structure The slag inclusion area and the The first crankshaft structure The possibility that the slag inclusion areas are the same slag inclusion area; Indicates the crankshaft casting The crankshaft structure and The distance difference sequence of the pixel points in the slag inclusion area on the crankshaft structure is Any pixel point in the slag inclusion area on the crankshaft structure is A sequence consisting of the distances between any pixel points in the slag inclusion area on the crankshaft structure; represents the minimum function; Indicates the number of crankshaft castings. The first crankshaft structure The grayscale mean of the pixels in each block; Indicates the number of crankshaft castings. The first crankshaft structure The grayscale mean of the pixels in each block; represents the linear normalization function; This is to prevent the denominator from being 0.
[0057] The above formula is mainly calculated based on the shortest distance between the slag inclusion areas on adjacent crankshaft structural parts and the average gray value. If the slag inclusion on the crankshaft casting is divided into two pieces by different crankshaft structural parts, the colors of the two pieces are almost the same, and the position distribution of the two pieces on the crankshaft casting is connected. Therefore, The smaller the value, the smaller the distance between the two slag inclusion areas, that is, the location distribution of the two slag inclusion areas is connected, indicating that the possibility that the two slag inclusion areas are the same slag inclusion area is greater; The smaller the value is, the more similar the average grayscale values of the two slag inclusion areas are, the greater the color consistency of the two slag inclusion areas is, and the greater the possibility that the two slag inclusion areas are the same slag inclusion area.
[0058] 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 a second possibility threshold; if so, , indicating that the two slag inclusion areas belong to the same slag inclusion area, the slag inclusion areas of the adjacent crankshaft structural parts are merged; then based on the sizes of the two slag inclusion areas, the merged slag inclusion area is divided into the slag inclusion structural part where the larger slag inclusion area is located.
[0059] All slag inclusion areas of all adjacent crankshaft structural parts are traversed to complete the merging of the slag inclusion areas.
[0060] S500: Classifying the crankshaft casting having the slag inclusion region according to the crankshaft structural portion to which the slag inclusion region belongs on the crankshaft casting.
[0061] Through the above steps, the slag inclusion areas of each crankshaft structural part on the crankshaft casting are identified. Since different crankshaft structural parts have different effects on the crankshaft casting, the repair treatment methods for the slag inclusion defects on different crankshaft structural parts are also different. Therefore, according to the crankshaft structural part to which the slag inclusion area belongs on the crankshaft casting, the crankshaft castings with the slag inclusion area are classified to facilitate subsequent repair treatment. The specific implementation method is: first, according to the distribution position of the slag inclusion area on the crankshaft casting, the crankshaft castings with the slag inclusion area are automatically classified. At the same time, when multiple crankshaft castings have slag inclusion defects in succession, an alarm is promptly issued to the staff to check whether there is a problem with the casting equipment.
[0062] It should be noted that the sequence of the above 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 accompanying 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.
[0063] Various embodiments in this specification are described in a progressive manner, and the same or similar parts between various embodiments can be referenced to each other, and each embodiment focuses on 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; The crankshaft casting having the slag inclusion area is classified according to the crankshaft structure part to which the slag inclusion area belongs on the crankshaft casting.
2. The method for visual detection of slag inclusion defects in crankshaft casting process according to claim 1, characterized in that: 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 crankshaft edge positive image, the boundary lines between adjacent crankshaft structural parts are identified, and the surface image is structurally divided in combination with the edge lines to obtain a number of crankshaft structural parts.
3. The method for visual detection of slag inclusion defects in crankshaft casting process according to claim 2, characterized in that: 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.
4. The method for visual detection of slag inclusion defects in crankshaft casting process according to claim 3, 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.
5. The method for visual detection of slag inclusion defects in crankshaft casting process according to claim 2, 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.
6. The method for visual detection of slag inclusion defects in crankshaft casting process according to claim 5, 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.
7. 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.
8. The method for visual detection of slag inclusion defects in crankshaft casting process according to claim 7, 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.
9. 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.
10. The method for visually detecting slag inclusion defects in a 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
Defect detector based on image recognition
JP1994027036A
Hardware defect detection method, apparatus and device
WO2025043898A1