A surface digital detection method for high-strength aluminum alloy castings

By using the mean-shift algorithm to cluster grayscale images of aluminum alloy castings, adjusting voting weights and drift speed, and identifying crack defect areas, this method solves the problems of low efficiency and insufficient accuracy in traditional detection methods, achieving efficient crack identification and reliable detection results.

CN120672667BActive Publication Date: 2025-12-23BEIJING JINGHANLIN MOLD MFG
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510686399.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-27
Publication Date
2025-12-23
Estimated Expiration
2045-05-27

AI Technical Summary

Technical Problem

Traditional methods for inspecting the surface of aluminum alloy castings are inefficient and lack accuracy, making it difficult to accurately identify surface cracks.

Method used

The mean-shift algorithm is used to cluster the grayscale images of aluminum alloy castings. By adjusting the changes in the window drift direction and distance, the voting weight and drift speed of the pixels are adjusted in real time to identify crack and defect areas.

Benefits of technology

It improves the accuracy of identifying surface cracks and defects in aluminum alloy castings and the reliability of detection results, overcoming the influence of texture features in traditional methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120672667B_ABST
    Figure CN120672667B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of image processing, in particular to a surface digital detection method for high-strength aluminum alloy castings, which comprises the following steps: collecting a surface image of an aluminum alloy casting, and performing gray-scale processing on the surface image to obtain a surface gray-scale image of the aluminum alloy casting; performing clustering processing on casting pixel points in the surface gray-scale image by using a mean shift algorithm; in the clustering processing process, based on change information of a window shift direction and a window shift distance, the voting weight and the shift speed of the casting pixel points corresponding to each clustering position are adjusted in real time until a shift stop condition is reached, and a final clustering result is obtained; according to the clustering result, a crack defect area in the surface gray-scale image is identified; and based on distribution range information of the crack defect area, a surface qualified detection result of the aluminum alloy casting is determined. The application can solve the technical problem of low precision in surface detection of aluminum alloy castings.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image processing, and particularly relates to a surface digital detection method of high-strength aluminum alloy castings. BACKGROUND

[0002] High-strength aluminum alloy castings refer to castings made of high-strength aluminum alloy materials. These aluminum alloys are alloyed, heat treated and specially cast to improve their strength and performance. These castings are widely used in aerospace, automotive industry, industrial equipment, sports equipment and building infrastructure fields. By detecting the surface of aluminum alloy castings, surface defects that may affect the structural strength or safety can be found in time to ensure the safety and reliability of the castings in actual application.

[0003] Traditional aluminum alloy casting surface detection methods rely on professional inspectors and are performed by visual inspection or other auxiliary instruments, which is low in efficiency. The surface of aluminum alloy castings is not completely smooth and has certain texture characteristics, making it difficult for existing image processing methods to directly identify cracks on the surface of the castings, thereby resulting in low accuracy of aluminum alloy casting surface detection. SUMMARY

[0004] In order to solve the technical problem of low accuracy of aluminum alloy casting surface detection, the purpose of the present application is to provide a surface digital detection method of high-strength aluminum alloy castings, and the technical solution adopted is as follows:

[0005] In the first aspect, the present application provides a surface digital detection method of high-strength aluminum alloy castings, which comprises:

[0006] Collecting a surface image of an aluminum alloy casting and performing grayscale processing on the surface image to obtain a surface grayscale image of the aluminum alloy casting;

[0007] Using a mean shift algorithm to perform clustering processing on casting pixel points in the surface grayscale image, and in the clustering processing, based on the change information of window shift direction and window shift distance, the voting weight and shift speed of casting pixel points corresponding to each clustering position are adjusted in real time until the drift stop condition is reached, and the final clustering result is obtained;

[0008] According to the clustering result, a crack defect area in the surface grayscale image is identified;

[0009] Based on the distribution range information of the crack defect area, a surface qualified detection result of the aluminum alloy casting is determined.

[0010] Optionally, the casting pixel points in the surface gray image are clustered by using the mean shift algorithm, and in the clustering process, based on change information of a window shift direction and a window shift distance, a voting weight and a shift speed of the casting pixel points corresponding to each cluster position are adjusted in real time until a shift stop condition is reached, and a final clustering result is obtained, including:

[0011] A neighborhood window corresponding to the surface gray image is generated, and the neighborhood window is used to move on the surface gray image, and each time the neighborhood window moves to a different cluster position;

[0012] The clustering process of the surface gray image is repeatedly performed by using the neighborhood window until each casting pixel point in the surface gray image is clustered, and based on the voting weight of each casting pixel point in the surface gray image, a clustering result of the surface gray image is generated;

[0013] The clustering process of the surface gray image includes:

[0014] A center point and a plurality of casting pixel points contained in the neighborhood window at a current cluster position are determined;

[0015] Based on the center point and the plurality of casting pixel points, a mean vector of the neighborhood window at the current cluster position is calculated;

[0016] According to the mean vectors corresponding to the current cluster position and a previous cluster position respectively, change information of a window shift direction and a window shift distance is determined;

[0017] Based on the change information, a voting weight of the plurality of casting pixel points contained in the neighborhood window at the current cluster position corresponding to a crack category is adjusted, and a shift speed of the neighborhood window at the current cluster position is adjusted according to the voting weight;

[0018] Based on the mean vector at the current cluster position, the neighborhood window is controlled to move from the current cluster position to a next cluster position.

[0019] Optionally, the neighborhood window corresponding to the surface gray image is generated, including:

[0020] A candidate casting pixel point that has not been clustered in the surface gray image is determined;

[0021] A candidate casting pixel point with the smallest gray value in the candidate casting pixel points is determined as a starting point;

[0022] A spherical neighborhood window is generated with the starting point as the center and a first preset threshold as a neighborhood radius.

[0023] Optionally, the calculating the mean vector of the neighborhood window at the current clustering position based on the center point and the plurality of casting pixel points comprises:

[0024] creating a clustering sample space with the lower left corner of the surface gray image as the origin, the right direction as the positive direction of the X axis, and the upward direction as the positive direction of the Y axis;

[0025] determining a first coordinate value of the center point in the clustering sample space and a plurality of second coordinate values of the plurality of casting pixel points in the clustering sample space at the current clustering position;

[0026] calculating the vector of each of the plurality of casting pixel points at the current clustering position based on the first coordinate value and the second coordinate value;

[0027] calculating the mean vector of the neighborhood window at the current clustering position according to the vectors of the plurality of casting pixel points.

[0028] Optionally, the controlling the movement of the neighborhood window from the current clustering position to the next clustering position based on the mean vector at the current clustering position comprises:

[0029] determining the direction and the length of the mean vector at the current clustering position as the window drift direction and the window drift distance when the neighborhood window moves from the current clustering position to the next clustering position, respectively;

[0030] controlling the movement of the neighborhood window from the current clustering position to the next clustering position according to the window drift direction and the window drift distance.

[0031] Optionally, the adjusting the drift speed of the neighborhood window at the current clustering position according to the voting weight comprises:

[0032] determining a second preset threshold for dividing the normal surface area and the crack defect area;

[0033] calculating the drift speed of the neighborhood window at the current clustering position based on the first preset threshold, the second preset threshold, the length of the mean vector at the current clustering position, and the voting weight.

[0034] Optionally, the clustering result comprises the number of votes of each clustering position on each of the plurality of casting pixel points and the voting weight corresponding to each vote;

[0035] the identifying the crack defect area in the surface gray image according to the clustering result comprises:

[0036] determine a classification result of each of the casting pixels based on voting weights and voting times of the plurality of the cluster positions on each of the casting pixels;

[0037] divide the surface gray scale image into a plurality of connected domains according to the classification result of each of the casting pixels;

[0038] identify a crack defect region in the plurality of connected domains based on connected domain size information.

[0039] Optionally, the determining of the classification result of each of the casting pixels based on the voting weights and the voting times of the plurality of the cluster positions on each of the casting pixels comprises:

[0040] determining voting weights and voting times of each of the casting pixels at the plurality of the cluster positions;

[0041] performing a cluster identification process on each of the casting pixels based on the voting weights and the voting times;

[0042] the cluster identification process comprises:

[0043] sequentially determining each of the casting pixels as a target casting pixel;

[0044] obtaining a target voting time and a target voting weight of the target casting pixel;

[0045] in a case where the target voting time is 1, if the target voting weight is greater than or equal to a second preset threshold, determining that a classification result of the target casting pixel is a crack pixel; if the target voting weight is less than the second preset threshold, determining that the classification result of the target casting pixel is a normal pixel; or

[0046] in a case where the target voting time is not 1, accumulating a plurality of the target voting weights under the target voting time, if an accumulated voting weight is greater than or equal to the second preset threshold, determining that the classification result of the target casting pixel is the crack pixel; if the accumulated voting weight is less than the second preset threshold, determining that the classification result of the target casting pixel is the normal pixel.

[0047] Optionally, the connected domain size information comprises a connected domain maximum length and a connected domain maximum width.

[0048] the dividing of the surface gray scale image into the plurality of connected domains according to the classification result of each of the casting pixels comprises:

[0049] constructing a connected domain by using casting pixels in the surface gray scale image that are divided into the same category and connected to each other, to obtain a plurality of connected domains contained in the surface gray scale image.

[0050] identifying, based on the connected domain size information, crack defect regions in the plurality of connected domains, includes:

[0051] calculating, based on the connected domain maximum length and the connected domain maximum width of each of the connected domains, a first evaluation value of each of the connected domains corresponding to a crack defect region;

[0052] determining, from the plurality of connected domains, a connected domain corresponding to the first evaluation value greater than a third preset threshold as a crack defect region.

[0053] Optionally, the distribution range information includes a crack maximum length and a crack maximum width of the crack defect region.

[0054] determining, based on the distribution range information of the crack defect region, a surface qualified detection result of the aluminum alloy casting, includes:

[0055] calculating, based on the crack maximum length and the crack maximum width of each of the crack defect regions, a second evaluation value of each of the crack defect regions, the second evaluation value being used to represent a degree of harm of cracks in the crack defect region to the aluminum alloy casting;

[0056] calculating, according to a number of regions containing the crack defect region in the surface gray-scale image and the second evaluation value of each of the crack defect regions, a surface qualified detection value of the aluminum alloy casting;

[0057] determining that the surface qualified detection result of the aluminum alloy casting is detection qualified when it is judged that the surface qualified detection value is greater than or equal to a fourth preset threshold.

[0058] determining that the surface qualified detection result of the aluminum alloy casting is detection unqualified when it is judged that the surface qualified detection value is less than the fourth preset threshold.

[0059] The present application has the following beneficial effects: through the technical scheme provided by the present application, after the surface image of the aluminum alloy casting is collected, the surface image is subjected to grayscale processing, and the surface grayscale image of the aluminum alloy casting is obtained, the mean shift algorithm can be used to cluster the casting pixel points in the surface grayscale image, in the clustering process, based on the change information of the window shift direction and the window shift distance, the voting weight and the shift speed of the casting pixel points corresponding to each clustering position are adjusted in real time until the shift stop condition is reached, and the final clustering result is obtained; then, the crack defect area in the surface grayscale image can be identified according to the clustering result; finally, based on the distribution range information of the crack defect area, the surface qualified detection result of the aluminum alloy casting is determined. In view of the fact that in the identification of the crack defects on the surface of the aluminum alloy casting, the traditional image processing method is often affected by the texture of the aluminum alloy surface, resulting in inaccurate crack defect identification. The present application can effectively solve the above problems by analyzing the characteristics of the aluminum alloy casting surface crack defect part when clustering is performed by using the mean shift algorithm, and adjusting the voting weight during classification according to the shift process, thereby improving the accuracy of crack defect identification and improving the reliability of the aluminum alloy casting surface detection result.

[0060] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present application. Other features and advantages of the present application will be described in detail in the subsequent specific embodiments section. BRIEF DESCRIPTION OF DRAWINGS

[0061] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present application or the prior art, the drawings needed in the embodiment or prior art description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and those skilled in the art can also obtain other drawings according to these drawings without creative labor.

[0062] Figure 1 A flowchart of a surface digital detection method of a high-strength aluminum alloy casting provided by an embodiment of the present application;

[0063] Figure 2 A schematic diagram of an aluminum alloy casting provided by an embodiment of the present application;

[0064] Figure 3 A flowchart of a surface digital detection method of a high-strength aluminum alloy casting provided by another embodiment of the present application. DETAILED DESCRIPTION

[0065] In order to further clarify the technical means and effects taken by the present application to achieve the predetermined inventive objectives, the following describes in detail the specific implementation, structure, features and effects of a surface digital detection method of high-strength aluminum alloy castings according to the present application, in combination with the accompanying drawings and preferred embodiments. 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.

[0066] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs.

[0067] The following specifically describes the specific scheme of a surface digital detection method of high-strength aluminum alloy castings provided by the present application in combination with the accompanying drawings.

[0068] Please refer to Figure 1 which shows a method flowchart of a surface digital detection method of high-strength aluminum alloy castings provided by one embodiment of the present application. The method includes the following steps:

[0069] Step 110, collect the surface image of the aluminum alloy casting and perform grayscale processing on the surface image to obtain the surface grayscale image of the aluminum alloy casting.

[0070] Among them, the aluminum alloy casting refers to a casting made of high-strength aluminum alloy material. These aluminum alloys are alloyed, heat treated and specially cast to improve their strength and performance. These castings are widely used in aerospace, automotive industry, industrial equipment, sports equipment and building infrastructure.

[0071] For the embodiments of the present disclosure, after the aluminum alloy casting is completed, when collecting the surface image of the aluminum alloy casting, the casting can be conveyed to the detection position, and the camera above the detection position is used to shoot the surface image of the aluminum alloy casting. The bottom plate of the detection position can be set to a color that is distinguishable from the color of the aluminum alloy casting, such as white. Because the color of the aluminum alloy casting is usually gray, the white area is removed in the shot image, and the remaining part is the aluminum alloy casting area, i.e. the surface image of the aluminum alloy casting is obtained. As shown in Figure 2 Further, the surface image can be grayscale processed to obtain the surface grayscale image of the aluminum alloy casting. The grayscale image can extract the texture features of the image, avoid the interference and errors caused by color to the image recognition, and thus improve the accuracy and speed of subsequent image processing.

[0072] Step 120, the pixels of the casting in the surface gray image are clustered by using the mean shift algorithm. In the clustering process, the voting weight and the shift speed of the pixels corresponding to each cluster position are adjusted in real time based on the change information of the window shift direction and the window shift distance until the shift stop condition is reached, and the final clustering result is obtained.

[0073] For the embodiments of the present disclosure, the pixels in the casting gray image can be clustered by using the mean shift algorithm, the voting weight of each cluster position to the pixels is calculated, and the shift speed in the clustering process is adjusted.

[0074] In a specific application scenario, the surface of the aluminum alloy casting is usually rough, and the gray level in the surface gray image is not uniform. The gray value of some normal areas may be similar to that of the surface crack area, and it is not easy to distinguish directly. However, the texture characteristics of the normal surface will make the window shift direction appear randomness when using mean shift clustering, and the shift distance is relatively small. The influence of the crack area on the window shift has the opposite performance. Therefore, the voting weight of each category to each pixel in the classification is adjusted by using the change of the window moving direction and distance in the clustering. Since the normal surface area cannot provide effective defect information, in order to improve the clustering efficiency, the shift speed needs to be accelerated. In the crack defect area, the shift speed can be appropriately reduced to ensure the clustering effect.

[0075] Step 130, according to the clustering result, the crack defect area in the surface gray image is identified.

[0076] In a specific application scenario, the crack is usually elongated and extends basically in a fixed direction, so the aspect ratio of the crack is usually large. The shape of the normal surface of the casting is related to the overall shape of the casting. Although it may be affected by the crack and have some irregular places, the overall aspect ratio is relatively small. For the embodiments of the present disclosure, the normal area and the crack defect area of the casting surface can be effectively distinguished by combining the distribution performance of the clustering result in the casting image.

[0077] Step 140, based on the distribution range information of the crack defect area, the surface qualified detection result of the aluminum alloy casting is determined.

[0078] The distribution range information of the crack defect area can include the maximum length of the crack in the crack defect area and the maximum width of the crack.

[0079] In a specific application scenario, the distribution range of the crack defect area can be represented based on the maximum length of the crack in the crack defect area and the maximum width of the crack. The larger the distribution range of the crack defect area, that is, the larger the maximum length of the crack and the maximum width of the crack, the more likely the crack will cause structural damage to the aluminum alloy casting during use, so the harm is greater.

[0080] In summary, the surface digital inspection method for high-strength aluminum alloy castings provided by this invention involves acquiring a surface image of the aluminum alloy casting and converting it to grayscale to obtain a grayscale image of the aluminum alloy casting surface. Then, a mean-shift algorithm is used to cluster the casting pixels in the grayscale image. During the clustering process, based on the changes in the window drift direction and distance, the voting weight and drift speed of the casting pixels corresponding to each cluster position are adjusted in real time until the drift stopping condition is met, yielding the final clustering result. Subsequently, based on the clustering result, crack defect regions in the grayscale image can be identified. Finally, based on the distribution range information of the crack defect regions, the surface qualification inspection result of the aluminum alloy casting is determined. Traditional image processing methods are often affected by the surface texture of aluminum alloys when identifying crack defects on the surface of aluminum alloy castings, leading to inaccurate crack defect identification. This invention analyzes the characteristics of surface crack defects in aluminum alloy castings when clustering them using the mean-shift algorithm. By adjusting the voting weights during classification based on the shift process, it effectively solves the aforementioned problems, improves the accuracy of crack defect identification, and enhances the reliability of surface inspection results for aluminum alloy castings.

[0081] based on Figure 1 The embodiments shown are refinements and extensions of the above embodiments. To fully illustrate the specific implementation process of the method in this embodiment, this embodiment provides the following: Figure 3 The specific method is shown. Figure 3 based on Figure 1 The example shown. Figure 3 As shown, the method includes the following steps:

[0082] Step 310: Acquire a surface image of the aluminum alloy casting and perform grayscale processing on the surface image to obtain a grayscale image of the aluminum alloy casting surface.

[0083] For the embodiments of this disclosure, the steps of the embodiments can be referred to the relevant description in step 210 of the embodiments, and no specific limitations are made here.

[0084] Step 320: Generate a neighborhood window corresponding to the surface grayscale image. The neighborhood window is used to move on the surface grayscale image, moving to a different cluster position each time.

[0085] In specific application scenarios, when generating a neighborhood window corresponding to a surface grayscale image, the midpoint and neighborhood radius of the neighborhood window can be determined first, and then a spherical neighborhood window can be generated based on the midpoint and neighborhood radius.

[0086] With the clustering process, the candidate casting pixel points not clustered can be determined in real time, and the candidate casting pixel point with the minimum gray value in the candidate casting pixel points is determined as the center point of the corresponding clustering position. It should be noted that when there are multiple candidate casting pixel points with the minimum gray value, one of the multiple candidate casting pixel points with the minimum gray value can be selected as the center point of the corresponding clustering position. For example, at the beginning of the clustering process, because the crack usually has a smaller gray value, all the casting pixel points in the surface gray image can be defined as candidate casting pixel points, and the candidate casting pixel point with the minimum gray value is determined as the starting point a0 of the first clustering position. When the neighborhood radius R is determined, because the gray value of the pixel point ranges from 0 to 255, in order to improve the accuracy of the classification, the neighborhood radius should not be set too large; but if the neighborhood radius is set too small, the drift speed will be slow, which affects the efficiency of the clustering, therefore, the starting point is taken as the center, 7 (an empirical value) is taken as the neighborhood radius R, and a spherical neighborhood window is generated.

[0087] Correspondingly, for the embodiment of the present disclosure, the embodiment steps can include: determining candidate casting pixel points not clustered in the surface gray image; determining a candidate casting pixel point with the minimum gray value in the candidate casting pixel points as a starting point; generating a spherical neighborhood window with the starting point as the center and a first preset threshold as the neighborhood radius.

[0088] Step 330, repeatedly performing the clustering process of the surface gray image by using the neighborhood window until each casting pixel point in the surface gray image is clustered, and generating a clustering result of the surface gray image based on the voting weight of each casting pixel point in the surface gray image.

[0089] Wherein, when each casting pixel point in the surface gray image is clustered, that is, the center point no longer changes, the mean vector of the current clustering position , the length of the mean vector of the current clustering position is determined, or the new center point is repeated with the previously walked center point, the drift is stopped, the classes finally converged to the same position are merged based on the voting weight of each casting pixel point in the surface gray image, and the clustering result of the surface gray image is obtained.

[0090] Correspondingly, for the embodiment of the present disclosure, the clustering process of the surface gray image in step 330 can include the following steps:

[0091] Step 330-1, determining the center point and multiple casting pixel points contained in the neighborhood window at the current clustering position.

[0092] In a specific application scenario, after the neighborhood window is determined, the neighborhood window can be controlled to move on the surface gray-scale image, and move to a different clustering position each time. For each clustering position, the center point where the neighborhood window is located and a plurality of casting pixel points contained in the spherical neighborhood window can be determined.

[0093] Step 330-2, based on the center point and the plurality of casting pixel points, a mean vector of the neighborhood window at the current clustering position is calculated.

[0094] In a specific application scenario, the lower left corner of the image can be first taken as the origin, the right direction as the positive direction of the X axis, and the upward direction as the positive direction of the Y axis to create a clustering sample space, and all casting pixel points can be put into the clustering sample space according to their corresponding coordinates to obtain the corresponding coordinate values (x, y). The gray value is taken as the Z axis, and the gray value range is 0 to 255. Therefore, the coordinates of each pixel point are (x, y, z). Then, based on the coordinate values of the center point in the clustering sample space and the coordinate values of the plurality of casting pixel points in the clustering sample space, the vector of each casting pixel point at the current clustering position (from the center point to each casting pixel point) can be calculated:

[0095]

[0096] In the formula, represents the vector of the i-th casting pixel point in the neighborhood window at the u-th clustering position; i represents the i-th casting pixel point in the neighborhood window at the u-th clustering position; I(x u,i ,y u,i ,g u,i ) represents the coordinate values of the i-th casting pixel point in the neighborhood window at the u-th clustering position in the clustering sample space; x u,i represents the X-axis coordinate value of the i-th casting pixel point in the neighborhood window at the u-th clustering position in the clustering sample space; y u,i represents the Y-axis coordinate value of the i-th casting pixel point in the neighborhood window at the u-th clustering position in the clustering sample space; g u,i represents the Z-axis coordinate value of the i-th casting pixel point in the neighborhood window at the u-th clustering position in the clustering sample space; I(x u,0 ,y u,0 ,g u,0 ) represents the coordinate values of the center point in the neighborhood window at the u-th clustering position in the clustering sample space; x u,0 represents the X-axis coordinate value of the center point in the neighborhood window at the u-th clustering position in the clustering sample space; y u,0 represents the Y-axis coordinate value of the center point in the neighborhood window at the u-th clustering position in the clustering sample space; g u,0 represents the Z-axis coordinate value of the center point in the neighborhood window at the u-th clustering position in the clustering sample space.

[0097] Furthermore, based on the vector of each casting pixel at the current cluster position, the mean vector of the neighborhood window at the current cluster position can be calculated:

[0098]

[0099] In the formula, This represents the mean vector of the neighborhood window at the u-th cluster position; n u This represents the number of casting pixels contained in the neighborhood window at the u-th cluster position; i represents the i-th casting pixel in the neighborhood window at the u-th cluster position. This represents the vector of the i-th casting pixel within the neighborhood window at the u-th cluster location.

[0100] Accordingly, for the embodiments of this disclosure, the steps may include: creating a clustering sample space with the lower left corner of the surface grayscale image as the origin, the positive X-axis direction to the right, and the positive Y-axis direction upward; determining the first coordinate value of the center point in the clustering sample space at the current clustering position, and the second coordinate values ​​of multiple casting pixels in the clustering sample space respectively; calculating the vector of each casting pixel at the current clustering position based on the first and second coordinate values; and calculating the mean vector of the neighborhood window at the current clustering position based on the vectors of multiple casting pixels.

[0101] Step 330-3: Determine the changes in window drift direction and window drift distance based on the mean vectors corresponding to the current cluster position and the previous cluster position.

[0102] In this embodiment of the disclosure, the mean vector corresponding to the current cluster position can be obtained. and the mean vector of the previous cluster position corresponding to the current cluster position. Mean vector of the previous cluster position The mean vector can be calculated using the same method as in step 330-2 of the embodiment, and will not be repeated here. Furthermore, it can be calculated based on the mean vector corresponding to the current cluster position. The mean vector corresponding to the previous cluster position Calculate the changes in window drift direction and window drift distance:

[0103]

[0104] In the formula, cosθ u This indicates changes in the window drift direction and drift distance. This represents the mean vector corresponding to the current cluster position. The modulus length; This represents the mean vector corresponding to the previous cluster position. the length of the vector represents the mean vector and the mean vector ; u represents the current cluster position being the u-th cluster position.

[0105] Step 330-4, based on the change information, adjusting the voting weight corresponding to the multiple casting pixel points belonging to the crack category contained in the neighborhood window at the current cluster position.

[0106] In a specific application scenario, although the normal aluminum alloy casting surface is not smooth, the texture distribution is relatively uniform, so the length of the mean vector obtained in the normal surface area is usually small, and the direction is relatively random. In the crack area of the aluminum alloy casting surface, since the crack shows that the gray value at each position is relatively small, the length of the mean vector obtained in the crack area is relatively large, and the direction points to the direction of crack growth. Because the hardness of the aluminum alloy casting is large, the degree of direction change during crack extension is small, so the direction of the crack area in the continuous two times of drift is relatively close.

[0107] Therefore, according to the change of and in the direction and the length, the possibility that the current neighborhood window is in the crack area can be reflected: and the smaller the direction change is, and the larger is, the more likely the corresponding neighborhood window is in the crack area. In order to more accurately distinguish the crack area, the greater the possibility that the neighborhood window is in the crack area, the greater the corresponding voting weight is:

[0108]

[0109] In the formula, φ u represents the voting weight corresponding to the multiple casting pixel points belonging to the crack category contained in the neighborhood window at the u-th cluster position; norm( ) represents a normalization function; represents the length of the mean vector at the current cluster position; cosθ u represents the change information of the window drift direction and the window drift distance; u represents the current cluster position being the u-th cluster position.

[0110] Step 330-5, adjusting the drift speed of the neighborhood window at the current cluster position according to the voting weight.

[0111] Since the effective defect information cannot be provided in the normal surface region, in order to improve the clustering efficiency, the drift speed needs to be accelerated, so although the obtained is small, the drift distance needs to be increased. When the neighborhood window moves to the crack region, in order to be able to obtain a relatively complete crack region, that is, as many pixel points in the same crack region as possible are covered in one clustering process, the drift distance needs to be appropriately reduced.

[0112] The voting weight φ u is calculated in the embodiment step 330-4, and then the second preset threshold k for dividing the normal surface region and the crack defect region is determined. By comparing the voting weight with the second preset threshold k, it is determined whether the drift distance is increased or the drift distance is reduced. Wherein, the drift distance is used to represent the drift speed, and the larger the drift distance is, the faster the speed is, and the smaller the drift distance is, the slower the speed is. Exemplarily, when φ u <k, it is considered that the neighborhood window in the u-th clustering position is a normal surface region, so the drift distance needs to be increased; otherwise, the drift distance needs to be reduced. The drift speed of the neighborhood window at the current clustering position is adjusted according to the voting weight as follows:

[0113]

[0114] In the formula, l u represents the distance that the neighborhood window needs to drift after adjustment in the u-th clustering position, that is, the corresponding drift speed; represents the length of the mean vector corresponding to the current clustering position ; u represents that the current clustering position is the u-th clustering position; k is the second preset threshold for dividing the normal surface region and the suspected crack region, and here k = 0.5; R is the neighborhood radius of the neighborhood window, that is, the first preset threshold; φ u represents the voting weight corresponding to the crack category of the plurality of casting pixel points contained in the neighborhood window in the u-th clustering position.

[0115] Correspondingly, for the embodiment of the present disclosure, the embodiment step can include: determining a second preset threshold for dividing the normal surface region and the crack defect region; and calculating the drift speed of the neighborhood window at the current clustering position based on the first preset threshold, the second preset threshold, the length of the mean vector at the current clustering position, and the voting weight.

[0116] Step 330-6: based on the mean vector at the current clustering position, the neighborhood window is moved from the current clustering position to the next clustering position.

[0117] For the embodiment of the present disclosure, the direction of the mean vector at the current clustering position can be determined as the moving direction, so that the mean vector The length of the module is the moving distance, the center point is moved from the starting point to the new center point position, and the corresponding neighborhood window is also moved in the same way, i.e., the size is unchanged, with the new center point as the center.

[0118] Correspondingly, for the embodiments of the present disclosure, the embodiment steps can include: determining the direction and the length of the module of the mean vector at the current clustering position as the window drift direction and the window drift distance when the neighborhood window is moved from the current clustering position to the next clustering position, respectively; and controlling the movement of the neighborhood window from the current clustering position to the next clustering position according to the window drift direction and the window drift distance.

[0119] Step 340, according to the clustering result, identifying the crack defect region in the surface gray image.

[0120] The clustering result includes the number of votes of each clustering position on each foundry pixel point and the voting weight corresponding to each vote.

[0121] Correspondingly, for the embodiments of the present disclosure, the step 340 of identifying the crack defect region in the surface gray image according to the clustering result can include the following steps:

[0122] Step 340-1, determining the classification result of each foundry pixel point based on the voting weight and the number of votes of each clustering position on each foundry pixel point.

[0123] Correspondingly, for the embodiments of the present disclosure, the embodiment steps can include: determining the voting weight and the number of votes of each foundry pixel point at the plurality of clustering positions; performing a clustering identification process on each foundry pixel point based on the voting weight and the number of votes; the clustering identification process includes: sequentially determining each foundry pixel point as a target foundry pixel point; obtaining a target voting number and a target voting weight of the target foundry pixel point; in the case that the target voting number is 1, if the target voting weight is greater than or equal to a second preset threshold, determining that the classification result of the target foundry pixel point is a crack pixel point; if the target voting weight is less than the second preset threshold, determining that the classification result of the target foundry pixel point is a normal pixel point; or, in the case that the target voting number is not 1, accumulating a plurality of target voting weights under the target voting number, if the accumulated voting weight is greater than or equal to the second preset threshold, determining that the classification result of the target foundry pixel point is a crack pixel point; if the accumulated voting weight is less than the second preset threshold, determining that the classification result of the target foundry pixel point is a normal pixel point.

[0124] For example, in the first classification, the neighborhood window passes pixel point a once in the process of moving from the start to the stop, and the voting weight calculated at the time is p, so the voting weight of pixel point a is p. If p is greater than or equal to the second preset threshold, it is determined that the classification result of pixel point a is a crack pixel point. Otherwise, it is determined that the classification result of pixel point a is a normal pixel point. In the first classification, the neighborhood window passes pixel point b five times in the process of moving from the start to the stop, and the voting weight calculated at each time is p1, p2, p3, p4, and p5. Therefore, the voting weight of pixel point b is Q1 = p1 + p2 + p3 + p4 + p5. If Q1 is greater than or equal to the second preset threshold, it is determined that the classification result of pixel point b is a crack pixel point. Otherwise, it is determined that the classification result of pixel point b is a normal pixel point.

[0125] Step 340-2: According to the classification result of each casting pixel point, the surface gray-scale image is divided into multiple connected domains.

[0126] Correspondingly, for the embodiments of the present disclosure, the embodiment steps can include: constructing a connected domain by using the casting pixel points in the surface gray-scale image that are divided into the same category and connected, to obtain multiple connected domains contained in the surface gray-scale image.

[0127] Step 340-3: Identifying a crack defect region in the multiple connected domains based on connected domain size information.

[0128] The connected domain size information includes a connected domain maximum length and a connected domain maximum width.

[0129] In a specific application scenario, a crack is usually slender and extends in a fixed direction, so the aspect ratio of the crack is usually large. The shape of the normal surface of the casting is related to the overall shape of the casting, and although it may be affected by the crack and have some irregularities, the overall aspect ratio is relatively small. Therefore, for each connected domain, the maximum length and the maximum width in the perpendicular direction of the maximum length line are determined, and the possibility of each connected domain being a crack region, i.e., the first evaluation value, is calculated.

[0130]

[0131] In the formula, q w represents the possibility of the wth connected domain being a crack region, i.e., the first evaluation value; norm() represents a normalization function; c w,max represents the connected domain maximum length of the wth connected domain; b w,max represents the connected domain maximum width of the wth connected domain.

[0132] In q wWhen m, the connected domain is considered as a crack defect region, where m is a third preset threshold, and the specific value can be set according to the actual application scene, such as 0.3.

[0133] Correspondingly, for the embodiments of the present disclosure, the embodiment steps can include: calculating a first evaluation value of each connected domain corresponding to a crack defect region based on the connected domain maximum length and the connected domain maximum width of each connected domain; determining the connected domain corresponding to the first evaluation value greater than the third preset threshold in the plurality of connected domains as the crack defect region.

[0134] Step 350, based on the distribution range information of the crack defect region, determining the surface qualified detection result of the aluminum alloy casting.

[0135] The distribution range information includes the crack maximum length and the crack maximum width of the crack defect region.

[0136] Correspondingly, for the embodiments of the present disclosure, the step 350 of determining the surface qualified detection result of the aluminum alloy casting based on the distribution range information of the crack defect region can include the following steps:

[0137] Step 350-1, calculating a second evaluation value of each crack defect region based on the crack maximum length and the crack maximum width of each crack defect region, the second evaluation value being used to represent the harm degree of the crack defect region to the aluminum alloy casting.

[0138] In a specific application scenario, the larger the range of the crack region, i.e. the larger the crack maximum length and the crack maximum width, the more likely the crack will cause structural damage to the casting during use, so the harm is greater. Therefore, the harm degree of each crack region, i.e. the second evaluation value is:

[0139] e w =c w,max ×b w,max

[0140] In the formula, e w represents the harm degree of the wth crack defect region, i.e. the second evaluation value; c w,max represents the crack maximum length of the wth crack defect region; b w,max represents the crack maximum width of the wth crack defect region.

[0141] Step 350-2, calculating the surface qualified detection value of the aluminum alloy casting according to the number of regions containing the crack defect region in the surface gray scale image and the second evaluation value of each crack defect region.

[0142] The calculation method of the surface qualified detection value of the aluminum alloy casting is:

[0143]

[0144] In the formula, H represents the surface qualified detection value of the aluminum alloy casting; norm() represents a normalization function; N represents the number of area of crack defect regions contained on the surface of the aluminum alloy casting, e w represents the harm degree of the w-th crack defect region, that is, the second evaluation value; w represents the w-th crack defect region.

[0145] Step 350-3, when it is judged that the surface qualified detection value is greater than or equal to the fourth preset threshold value, it is determined that the surface qualified detection result of the aluminum alloy casting is detection qualified.

[0146] The fourth preset threshold value can be set according to the actual application scene, for example, it can be set to 0.7.

[0147] When the surface qualified detection value H of the aluminum alloy casting is greater than or equal to 0.7, it is determined that the surface qualified detection result of the aluminum alloy casting is detection qualified.

[0148] Step 350-4, when it is judged that the surface qualified detection value is less than the fourth preset threshold value, it is determined that the surface qualified detection result of the aluminum alloy casting is detection unqualified.

[0149] When the surface qualified detection value H of the aluminum alloy casting is less than 0.7, it is determined that the surface qualified detection result of the aluminum alloy casting is detection unqualified.

[0150] In summary, in the technical scheme of the present application, after the surface image of the aluminum alloy casting is collected and the surface image is subjected to gray scale processing to obtain the surface gray scale image of the aluminum alloy casting, the mean shift algorithm can be used to cluster the casting pixel points in the surface gray scale image. In the clustering process, based on the change information of the window shift direction and the window shift distance, the voting weight and the shift speed of the casting pixel points corresponding to each clustering position are adjusted in real time until the drift stop condition is reached, and the final clustering result is obtained. Then, according to the clustering result, the crack defect regions in the surface gray scale image can be identified. Finally, based on the distribution range information of the crack defect regions, the surface qualified detection result of the aluminum alloy casting is determined. Since the traditional image processing method is often affected by the texture of the aluminum alloy surface when identifying the crack defects on the surface of the aluminum alloy casting, the crack defect identification is not accurate. The present application can effectively solve the above problems by analyzing the characteristics of the crack defect part on the surface of the aluminum alloy casting when using the mean shift algorithm for clustering, and adjusting the voting weight during classification according to the drift process, thereby improving the accuracy of crack defect identification and improving the reliability of the surface detection result of the aluminum alloy casting.

[0151] It should be noted that the above-mentioned embodiments of the application are merely intended to describe the application and are not intended to limit the application. In addition, the above-mentioned embodiments of the application are described in the order of the description. The order of the embodiments is not intended to represent the advantages of the embodiments. In some embodiments, multi-task processing and parallel processing are possible or advantageous.

[0152] Each of the embodiments in the specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other. Each embodiment focuses on the difference from other embodiments.

[0153] The above is only a preferred embodiment of the application, and is not intended to limit the application. Any modification, equivalent replacement, improvement, etc. within the principles of the application shall be included in the protection scope of the application.

Claims

1. A method for surface digitizing inspection of high strength aluminum alloy castings, characterized by, The method comprises: Collecting a surface image of an aluminum alloy casting and performing grayscale processing on the surface image to obtain a surface grayscale image of the aluminum alloy casting; Performing clustering processing on casting pixel points in the surface grayscale image by using a mean shift algorithm, and in the clustering processing, based on change information of a window shift direction and a window shift distance, voting weights of the casting pixel points corresponding to each clustering position are adjusted in real time until a shift stop condition is reached to obtain a final clustering result; According to the clustering result, a crack defect area in the surface grayscale image is identified; Based on distribution range information of the crack defect area, a surface qualified detection result of the aluminum alloy casting is determined; The final clustering result is obtained by: Generating a neighborhood window corresponding to the surface grayscale image, the neighborhood window being used to move on the surface grayscale image, and moving to a different clustering position each time; Repeating the clustering process on the surface grayscale image by using the neighborhood window until clustering of each casting pixel point in the surface grayscale image is completed, and based on the voting weights of each casting pixel point in the surface grayscale image, a clustering result of the surface grayscale image is generated; The clustering process on the surface grayscale image comprises: Determining a center point and a plurality of casting pixel points contained by the neighborhood window at a current clustering position; Based on the center point and the plurality of casting pixel points, calculating a mean vector of the neighborhood window at the current clustering position; According to the mean vectors corresponding to the current clustering position and a previous clustering position respectively, determining change information of a window shift direction and a window shift distance; wherein the change information of the window shift direction and the window shift distance is: ; In the formula, represents the change information of the window drift direction and the window drift distance; represents the module length of the mean vector corresponding to the current cluster position ; represents the module length of the mean vector corresponding to the last cluster position ; Based on the change information, adjusting the voting weights of the plurality of casting pixel points contained by the neighborhood window at the current clustering position corresponding to a crack category; the voting weights are: ; In the formula, represents the voting weight of the multiple casting pixel points contained in the neighborhood window at the i th cluster position corresponding to the crack category; represents a normalization function; Based on the mean vector at the current clustering position, controlling the movement of the neighborhood window from the current clustering position to a next clustering position; Based on the voting weights and the voting times of a plurality of the clustering positions on each casting pixel point, determining a classification result of each casting pixel point.

2. The method of digitally inspecting the surface of a high-strength aluminum alloy casting according to claim 1, wherein The generation of the neighborhood window corresponding to the surface grayscale image comprises: Determining a candidate casting pixel point that has not been clustered in the surface grayscale image; Determining a candidate casting pixel point with the smallest grayscale value in the candidate casting pixel points as a starting point; Generating a spherical neighborhood window with the starting point as the center and a first preset threshold as the neighborhood radius.

3. The method of digitally inspecting the surface of a high-strength aluminum alloy casting according to claim 1, wherein The calculation of the mean vector of the neighborhood window at the current clustering position based on the center point and the plurality of casting pixel points comprises: Creating a clustering sample space with the lower left corner of the surface grayscale image as the origin, the right direction as the positive direction of the X axis, and the upward direction as the positive direction of the Y axis; Determining a first coordinate value of the center point in the clustering sample space and a second coordinate value of each of the plurality of casting pixel points in the clustering sample space at the current clustering position; calculating a vector of each of the casting pixel points at the current clustering position based on the first coordinate value and the second coordinate value; calculating a mean vector of the neighborhood window at the current clustering position according to the vectors of the plurality of casting pixel points.

4. The method of digitally inspecting the surface of a high-strength aluminum alloy casting according to claim 1, wherein controlling the movement of the neighborhood window from the current clustering position to a next clustering position based on the mean vector at the current clustering position, including: determining a direction and a length of the mean vector at the current clustering position as a window drift direction and a window drift distance respectively when the neighborhood window moves from the current clustering position to the next clustering position; controlling the movement of the neighborhood window from the current clustering position to the next clustering position according to the window drift direction and the window drift distance.

5. The method of digitally inspecting the surface of a high-strength aluminum alloy casting according to claim 1, wherein the clustering result includes a voting number of each clustering position on each of the casting pixel points and a voting weight corresponding to each voting; the identification of the crack defect region in the surface gray image according to the clustering result, including: dividing the surface gray image into a plurality of connected domains according to the classification result of each of the casting pixel points; identifying the crack defect region in the plurality of connected domains based on connected domain size information.

6. The method of digitally inspecting the surface of a high-strength aluminum alloy casting according to claim 5, wherein the determination of the classification result of each of the casting pixel points based on the voting weight and the voting number of each of the casting pixel points at a plurality of clustering positions, including: determining the voting weight and the voting number of each of the casting pixel points at a plurality of clustering positions; performing a clustering identification process on each of the casting pixel points based on the voting weight and the voting number; the clustering identification process, including: determining each of the casting pixel points as a target casting pixel point in turn; obtaining a target voting number and a target voting weight of the target casting pixel point; in a case where the target voting number is 1, if the target voting weight is greater than or equal to a second preset threshold, determining the classification result of the target casting pixel point as a crack pixel point; if the target voting weight is less than the second preset threshold, determining the classification result of the target casting pixel point as a normal pixel point; or in a case where the target voting number is not 1, accumulating a plurality of target voting weights under the target voting number, if the accumulated voting weight is greater than or equal to the second preset threshold, determining the classification result of the target casting pixel point as a crack pixel point; if the accumulated voting weight is less than the second preset threshold, determining the classification result of the target casting pixel point as a normal pixel point.

7. The method of digitally inspecting the surface of a high-strength aluminum alloy casting according to claim 5, wherein the connected domain size information includes a connected domain maximum length and a connected domain maximum width; the division of the surface gray image into a plurality of connected domains according to the classification result of each of the casting pixel points, including: constructing a connected domain by using the casting pixel points in the surface gray image that are divided into the same category and connected, to obtain a plurality of connected domains included in the surface gray image; the identification of the crack defect region in the plurality of connected domains based on connected domain size information, including: The first evaluation value of each of the connected domains corresponding to a crack defect region is calculated based on the maximum length and the maximum width of each of the connected domains; The connected domains corresponding to the first evaluation value greater than a third preset threshold value in the plurality of connected domains are determined as the crack defect region.

8. The method of digitally inspecting the surface of a high-strength aluminum alloy casting according to claim 1, wherein, The distribution range information includes a maximum length and a maximum width of the crack defect region; The surface qualified detection result of the aluminum alloy casting is determined based on the distribution range information of the crack defect region, including: A second evaluation value of each of the crack defect regions is calculated based on the maximum length and the maximum width of each of the crack defect regions, and the second evaluation value is used to represent the damage degree of the crack in the crack defect region to the aluminum alloy casting; The surface qualified detection value of the aluminum alloy casting is calculated according to the number of regions containing the crack defect region in the surface gray-scale image and the second evaluation value of each of the crack defect regions; When it is judged that the surface qualified detection value is greater than or equal to a fourth preset threshold value, it is determined that the surface qualified detection result of the aluminum alloy casting is qualified; When it is judged that the surface qualified detection value is less than the fourth preset threshold value, it is determined that the surface qualified detection result of the aluminum alloy casting is unqualified.

Citation Information

Patent Citations

  • Automobile seat leather classification method, device and system based on computer vision

    CN114913512A

  • Method for detecting traffic violation

    US20160034778A1