Method, device and equipment for detecting surface defects of die casting
Through the point cloud acquisition and curvature clustering method of three-dimensional machine vision technology, the surface defects of die castings are accurately positioned, solving the problems of insufficient accuracy and efficiency in traditional detection methods, and achieving efficient and accurate defect detection.
Patent Information
- Application Number
- CN202510634664.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-16
- Publication Date
- 2025-08-22
AI Technical Summary
Traditional artificial visual inspection and two-dimensional machine vision detection methods have low accuracy in die casting surface defect detection, and the two-dimensional machine vision detection technology lacks detection efficiency and accuracy of three-dimensional three-dimensional parts, resulting in a high misjudgment rate.
Three-dimensional machine vision technology is adopted, and the scanning path is planned to drive the rotation device to drive the scanning camera to rotate for three-dimensional point cloud acquisition, calculate the curvature of the point cloud and cluster high curvature points, determine the defect area, and combine the reference point cloud and denoising processing to accurately locate the defect area.
It improves the accuracy and efficiency of surface defect detection of die castings, reduces the consumption of system computing resources, and solves the problem of high misjudgment rate in traditional methods.
Smart Images

Figure CN120525845A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of machine vision technology, and in particular to a method, device and equipment for detecting surface defects of die-cast parts. Background Art
[0002] As one of the core processes in precision manufacturing, die-casting technology is widely used in high-end manufacturing fields such as the automotive industry (engine blocks, transmission housings), aerospace (turbine blades), and electronic equipment (heat dissipation modules). This process uses the principle of high-pressure injection molding to achieve near-net shape of molten aluminum or zinc alloy under a clamping force of 800-1200 tons. However, due to process variables such as mold wear, unstable metal flow, and uneven thermal stress distribution, the surface of the formed die-cast parts is prone to three-dimensional morphological defects, which seriously affect the sealing performance and structural strength of the workpiece.
[0003] Traditional manual visual inspection faces significant technical bottlenecks in quality control: inspectors are limited to a visual resolution of 0.1mm, resulting in a high rate of missed detection of micron-level surface indentations. Furthermore, metal dust contamination and 60-80dB noise pollution in the production line environment can easily lead to false detections. Consequently, traditional manual visual inspection suffers from low accuracy in detecting surface defects on die-cast parts.
[0004] In order to solve the problem of low accuracy of manual visual inspection, the current mainstream technical route focuses on the development of two-dimensional machine vision inspection systems. For example, a multi-spectral fusion detection solution is constructed, which integrates visible light, infrared and laser displacement sensors to form a multimodal data acquisition array, and uses convolutional neural networks to realize cross-modal correlation analysis of defect characteristics. For another example, a crack propagation dynamics model is proposed. By quantifying the anisotropic diffusion coefficient of the pixel points in the crack area (λ = 0.67 ± 0.12), a crack propagation prediction equation is established in combination with thermodynamic simulation data to shorten the mold optimization cycle. However, since die-castings are generally three-dimensional parts, when using the above-mentioned two-dimensional machine vision inspection technology to detect surface defects of die-castings, there will still be problems such as high misjudgment rate and inaccurate defect detection. Summary of the Invention
[0005] Based on this, it is necessary to provide a surface defect detection method, device, computer equipment, computer-readable storage medium and computer program product for die-casting parts that can improve detection accuracy in order to address the above technical problems.
[0006] In a first aspect, the present application provides a method for detecting surface defects of a die casting. In one embodiment, the method includes:
[0007] Controlling a servo motor to drive a rotating device according to a planned scanning path, and driving a scanning camera mounted on the rotating device to rotate via the rotating device to collect a three-dimensional point cloud of the die-casting to obtain a target point cloud of the die-casting; the target point cloud is a point cloud of all or part of the area to be measured of the die-casting;
[0008] Calculating the curvature of each point in the target point cloud, and extracting points whose curvature is greater than or equal to a preset curvature threshold from the target point cloud to obtain a set of high curvature points;
[0009] Clustering the set of high curvature points to obtain defect point clusters;
[0010] The size of the defect area of the die casting is determined according to the maximum value and the minimum value corresponding to the defect point cluster on the three coordinate axes in the three-dimensional coordinate system.
[0011] In one embodiment, the rotating device drives a scanning camera mounted on the rotating device to rotate to collect a three-dimensional point cloud of the die-casting to obtain a target point cloud of the die-casting, including:
[0012] The scanning camera carried by the rotating device is driven to rotate by the rotating device to collect an initial point cloud for the die casting;
[0013] Acquiring an area selection range, and screening a region to be measured of the die casting from the initial point cloud according to the area selection range;
[0014] De-noising the point cloud in the area to be measured to obtain the target point cloud.
[0015] In one embodiment, the die casting has a corresponding reference point cloud, and the region selection range is a position range set for the reference point cloud and used to select the region to be measured;
[0016] The step of screening the area to be measured of the die casting from the initial point cloud according to the area selection range includes:
[0017] The initial point cloud is registered with the reference point cloud, and according to the region selection range, the region to be measured of the die casting is screened from the registered point cloud.
[0018] In one embodiment, before registering the initial point cloud with the reference point cloud, the method further comprises:
[0019] Acquiring a two-dimensional image collected for the die-casting, and analyzing the type of the die-casting based on the two-dimensional image;
[0020] A reference point cloud matching the type is determined.
[0021] In one embodiment, the rotating device drives a scanning camera mounted on the rotating device to rotate to collect an initial point cloud for the die casting, including:
[0022] The scanning camera is controlled by the rotating device to rotate at corresponding rotation angles at each position node of the scanning path, and then three-dimensional point cloud collection is performed on the die casting to obtain the initial point cloud.
[0023] In one embodiment, the rotating device drives a scanning camera mounted on the rotating device to rotate to collect an initial point cloud for the die casting, including:
[0024] By means of the rotating device, the scanning camera is controlled to maintain an initial posture and move along a first direction of the guide rail;
[0025] Performing a first point cloud scan on the die casting during the movement process until the scanning camera is moved to the end of the guide rail, and then rotating the scanning camera to a target angle;
[0026] The scanning camera is controlled by the rotating device to rotate to the target angle, and moves along the second direction of the guide rail, and performs a second point cloud scan on the die casting during the movement; wherein the second direction is opposite to the first direction;
[0027] The result of the first scan and the result of the second scan are combined to obtain the initial point cloud.
[0028] In one embodiment, the target angle is 90 degrees; or, the target angle corresponds to the type of the die-casting part, and different types of die-casting parts have their own corresponding target angles.
[0029] In one embodiment, the acquisition area selection range includes:
[0030] displaying the initial point cloud and the three-dimensional image of the die-cast part in association with each other;
[0031] In response to a region selection operation on the three-dimensional image, the region range selected by the region selection operation in the three-dimensional image is mapped to the initial point cloud to obtain the region selection range.
[0032] In a second aspect, the present application further provides a surface defect detection device for a die casting, the device comprising:
[0033] a point cloud acquisition module, configured to control a servo motor to drive a rotating device according to a planned scanning path, thereby driving a scanning camera mounted on the rotating device to rotate, so as to acquire a three-dimensional point cloud of the die-casting part and obtain a target point cloud of the die-casting part; the target point cloud is a point cloud of all or part of the area to be measured of the die-casting part;
[0034] a curvature calculation module, configured to calculate the curvature of each point in the target point cloud, and extract points whose curvature is greater than or equal to a preset curvature threshold from the target point cloud to obtain a set of high curvature points;
[0035] A clustering module, configured to cluster the set of high curvature points to obtain defect point clusters;
[0036] The defect area positioning module is used to determine the size of the defect area of the die casting according to the maximum value and the minimum value corresponding to the three coordinate axes of the defect point cluster in the three-dimensional coordinate system.
[0037] In a third aspect, the present application further provides a computer device, which includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of each embodiment of the present application when executing the computer program.
[0038] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of each embodiment of the present application when executed by a processor.
[0039] In a fifth aspect, the present application further provides a computer program product, which includes a computer program that implements the steps in each embodiment of the present application when executed by a processor.
[0040] In the above-mentioned surface defect detection method, device, computer equipment, storage medium and computer program product for die-castings, the planned scanning path is used to drive the rotating device to drive the scanning camera to rotate, thereby achieving full coverage of the three-dimensional point cloud acquisition of the surface morphology of the die-casting, and obtaining more accurate and complete point cloud data. Furthermore, based on the curvature of the accurate point cloud data, high curvature points are screened out from the point cloud, which is equivalent to preliminarily screening out points with a high probability of defects. Then, the high curvature points are clustered to effectively eliminate noise points, thereby accurately locating the defective areas on the surface of the die-casting, and improving the accuracy of surface defect detection of the die-casting. In addition, this solution does not require complex image reconstruction processing. Based on the three-dimensional machine vision detection technology combined with the above-mentioned specific processing, the surface defect detection of the die-casting can be accurately realized, saving system computing resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1A diagram showing an application environment of a method for detecting surface defects of a die casting according to an embodiment;
[0042] Figure 2 1 is a schematic flow chart of a method for detecting surface defects of a die casting according to an embodiment;
[0043] Figure 3 Schematic diagram of a flow chart of target point cloud determination steps in one embodiment;
[0044] Figure 4 is a simplified flow chart of a method for detecting surface defects of a die casting in one embodiment;
[0045] Figure 5 is a schematic diagram of a rotary scanning camera according to one embodiment;
[0046] Figure 6 is a structural block diagram of a surface defect detection device for die castings in one embodiment;
[0047] Figure 7 is a structural block diagram of a surface defect detection device for die castings in another embodiment;
[0048] Figure 8 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0050] Die castings are three-dimensional parts with complex geometric shapes produced by pressure casting. Specifically, a pressure casting machine, equipped with a casting mold, pours heated, liquid metal such as copper, zinc, aluminum, or an aluminum alloy into the inlet of the die casting machine. The die casting machine then casts the copper, zinc, aluminum, or aluminum alloy part into the shape and size defined by the mold. These parts are generally called die castings.
[0051] Since die-castings generally have complex geometric shapes and are three-dimensional parts, traditional two-dimensional machine vision inspection technology is not accurate enough in detecting surface defects of die-castings. Specifically, first of all, two-dimensional machine vision inspection technology generally performs two-dimensional grayscale imaging. However, two-dimensional grayscale imaging is not sensitive enough to the defect contrast of dark die-castings (surface reflectivity <15%), resulting in a high failure rate in the extraction of meat defect features below 1mm. Secondly, traditional 2D edge detection algorithms have difficulty in parsing the depth gradient characteristics of three-dimensional depressions, resulting in a high misjudgment rate of morphological defects and surface textures. In addition, two-dimensional machine vision inspection technology generally uses a fixed imaging system (that is, the acquisition range or acquisition angle of the image acquisition device is fixed), and is therefore limited by the size of the field of view angle. The blind area coverage of complex curved surfaces is large, and multiple clamping is required, resulting in reduced detection efficiency. The above problems restrict the realization of millimeter-level detection accuracy.
[0052] In order to improve the above-mentioned problems existing in two-dimensional machine vision detection technology, in some schemes, three-dimensional machine vision detection technology is used to detect surface defects of die-castings. Specifically, in this scheme, the corresponding two-dimensional feature map (generated based on two-dimensional image data) and three-dimensional feature map (generated based on three-dimensional point cloud data) are mainly generated for the surface of the die-casting, so as to perform two-dimensional reconstruction and three-dimensional reconstruction respectively, and obtain the two-dimensional reconstruction map and three-dimensional reconstruction map corresponding to the surface of the die-casting when it is in a qualified state. Further, according to the difference between the two-dimensional feature map and the two-dimensional reconstruction map, and the difference between the three-dimensional feature map and the three-dimensional reconstruction map, it is judged whether the surface of the die-casting is unqualified. In other words, in this scheme, it is mainly through the method of two-dimensional reconstruction and three-dimensional reconstruction, from the perspective of two dimensions and three dimensions, to compare the surface feature differences of the die-casting in the actual state and the qualified state, so as to judge whether the surface of the die-casting in the actual state is qualified.
[0053] In the above solution, due to the use of complex image reconstruction technology, the complexity of defect detection processing is relatively high, which causes a large consumption of system computing resources and, to a certain extent, leads to relatively low efficiency of defect detection for die-cast parts.
[0054] Based on this, a surface defect detection method for die-casting parts is proposed in each embodiment of the present application, which aims to improve the accuracy of surface defect detection of the die-casting machine based on three-dimensional machine vision detection technology combined with specific processing in the embodiments of the present application without the need for image reconstruction, thereby reducing the consumption of system computing resources and detecting the specific size of the defect area at the same time, thereby achieving accurate and efficient defect detection effect.
[0055] For example, the surface defect detection method of the die casting provided in the embodiment of the present application can be applied to Figure 1In the application environment shown, the computer device 102 can communicate with the detection device 104. The detection device 104 adopts a multi-axis linkage system architecture and can specifically include a precision linear motor platform 1, a rotation device 2, a scanning camera 3, and a clamping device 4. For example, the computer device 102 can be a host computer or a controller.
[0056] The clamping device 4 is used to fix the die casting on the detection device 104. For example, the clamping device 4 is a high-precision dynamic clamping device that can ensure that the workpiece repeat positioning error is less than 0.1 mm and there is no clamping deformation.
[0057] The precision linear motor platform 1 may include a servo motor and a motion device. For example, the motion device may include a linear guide module or a robotic arm or other motion mechanism that can be driven by a servo motor.
[0058] The rotating device 2 is mounted on the motion device, and the scanning camera 3 is mounted on the rotating device 2. For example, the rotating device 2 can be a high-precision rotation stage, such as a two-axis rotation stage. The scanning camera 3 can be a structured light camera, a line scan camera, or a 3D fly-scan camera. The present embodiment does not limit the type of scanning camera 3, as long as it can capture a 3D point cloud.
[0059] Computer device 102 can send instructions to the servo motor, instructing the servo motor to drive the motion device. For example, computer device 102 can implement multi-dimensional scanning path planning through a programmable motion controller and issue corresponding instructions to the servo motor. By driving the motion device, the rotating device and its mounted scanning camera 3 move. During this movement, the scanning camera 3 follows a pre-planned scanning path to collect three-dimensional point cloud data of the complex curved surface of the die-cast part fixed to the clamping device 4.
[0060] It should be understood that the rotating device 2 can control the rotation of the scanning camera 3 to change the scanning angle of the die-casting. Therefore, during the movement of the scanning camera, the rotating device 2 can be driven based on the planned scanning path, and the scanning camera 3 can be rotated by the rotating device 2, so that the scanning camera 3 can achieve full coverage point cloud acquisition of the die-casting surface morphology, obtaining more accurate and complete point cloud data.
[0061] The scanning camera 3 can send the collected point cloud data to the computer device 102, and the computer device 102 can determine the target point cloud of the die casting based on the sent point cloud data. Furthermore, the computer device 102 can calculate the curvature of each point in the target point cloud, and extract points whose curvature is greater than or equal to a preset curvature threshold from the target point cloud to obtain a set of high curvature points, and cluster the set of high curvature points to obtain a defect point cluster. The computer device 102 can determine the size of the defect area of the die casting based on the defect point cluster. For example, the computer device 102 can determine the size of the defect area of the die casting based on the maximum and minimum values corresponding to the three coordinate axes of the defect point cluster in the three-dimensional coordinate system.
[0062] Computer device 102 can be a terminal or a server. Terminals can include, but are not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, and smart car devices. Portable wearable devices can include smart watches, smart bracelets, and head-mounted devices. The server can be implemented as a standalone server or a server cluster consisting of multiple servers.
[0063] It should be understood that the die-casting surface defect detection method in the embodiments of the present application can more accurately and relatively comprehensively collect three-dimensional point cloud data of the die-casting, thereby more accurately identifying surface defects of the die-casting based on the more accurate three-dimensional point cloud data. Furthermore, the above method does not require complex processing such as image reconstruction. Instead, it relies on high-precision collected three-dimensional point cloud data and clusters defect points based on high-curvature points. This method can conveniently determine the size of the defect area of the die-casting based on the defect point clusters, thereby improving the accuracy of defect identification and reducing the consumption of system computing resources during the defect identification process.
[0064] For ease of understanding, the surface defect detection method for die-casting parts in the embodiment of the present application will be described in more detail below.
[0065] like Figure 2 As shown, in some embodiments of the present application, a surface defect detection method for die castings is proposed, which can be applied to Figure 1 The computer device 102 specifically includes the following steps:
[0066] S201, controlling the servo motor to drive the rotating device according to the planned scanning path, and driving the scanning camera mounted on the rotating device to rotate through the rotating device to perform three-dimensional point cloud acquisition on the die-casting part to obtain a target point cloud of the die-casting part; the target point cloud is all or part of the point cloud within the area to be measured of the die-casting part.
[0067] In some embodiments, the computer device pre-plans a scanning path. The scanning path includes multiple position nodes, each of which has a corresponding rotation angle. For example, different position nodes may correspond to different rotation angles. The computer device may control the scanning camera, using the rotation device, to rotate the scanning camera at the corresponding rotation angle at each position node of the scanning path, and then collect a three-dimensional point cloud of the die-casting to obtain the initial point cloud.
[0068] Specifically, the computer device can control the servo motor to drive the linear guide module, thereby driving the rotation device and the scanning camera 3 carried by it to move. During the movement of the scanning camera 3, the rotating device 2 is driven based on the pre-planned scanning path, so that the rotating device 2 controls the scanning camera 3 to rotate the corresponding rotation angle at each position node of the scanning path, and maintains the rotated state to perform three-dimensional point cloud collection on the die-casting. It should be understood that the initial point cloud is obtained by fusing the point cloud data collected at all rotation angles. It is equivalent to that at each position node, the scanning camera 3 dynamically uses the angle matching the position node to collect the three-dimensional point cloud data of the die-casting (i.e., multi-degree-of-freedom scanning). Compared with the fixed imaging system, this case uses multi-degree-of-freedom scanning to seamlessly fuse the multi-view scanning data, which can more accurately collect the point cloud data of the die-casting surface, so that the detection flexibility of complex surface features is improved to the requirements of industrial-grade detection standards.
[0069] In other embodiments, the computer device can also avoid rotating the scanning camera too frequently. Instead, the number of rotations or the frequency of rotations can be minimized while ensuring that the scanning camera can capture comprehensive 3D point cloud information on the die-casting surface. This ensures scanning stability. The specific process is described in detail later.
[0070] After the three-dimensional point cloud is collected, an initial point cloud is obtained. The computer device can determine the area to be measured of the die casting from the initial point cloud (that is, determine the point cloud within the area to be measured).
[0071] In some embodiments, the computer device can control the scanning camera to collect point cloud data only for the die-casting. In this way, the initial point cloud after collection is a point cloud that only includes or substantially includes the die-casting's test area. Therefore, the initial point cloud can be used as the point cloud within the die-casting's test area. In other embodiments, the scanning camera's collection range is larger than the die-casting's test area itself. Therefore, the collected initial point cloud includes point clouds of the surrounding area in addition to the die-casting's test area. Therefore, the computer device can filter out point clouds that match the die-casting's test area from the initial point cloud, thus obtaining the point cloud within the die-casting's test area.
[0072] After determining the area to be measured of the die-casting, the computer device may use all or part of the point cloud within the area to be measured of the die-casting as the target point cloud of the die-casting.
[0073] S202 , calculating the curvature of each point in the target point cloud, and extracting points whose curvature is greater than or equal to a preset curvature threshold from the target point cloud to obtain a set of high curvature points.
[0074] Among them, high curvature points refer to points in the target point cloud whose curvature is greater than or equal to the preset curvature threshold K threshold The value of the preset threshold is determined based on actual measurement experience. For example, if the curvature of a point K>K threhold , then the point is determined to be a high curvature point.
[0075] Specifically, the computer device can calculate the curvature of each point in the target point cloud and compare each point with a preset curvature threshold. The computer device can extract (or retain) points with curvature greater than or equal to the preset curvature threshold as high curvature points and remove points with curvature less than the preset curvature threshold, thereby obtaining a set of high curvature points.
[0076] For example, the computer device may calculate the curvature of each point in the target point cloud according to a Gaussian curvature algorithm or a mean curvature algorithm.
[0077] Taking the Gaussian curvature algorithm as an example, the calculation formula is as follows:
[0078]
[0079] Where K is the curvature; the surface is parameterized as r(x,y), where x and y are parametric variables describing the surface (also called parametric coordinates), used to represent points on the surface as a mapping from a two-dimensional parametric space to a three-dimensional space. r(x,y) is the mapping from the parametric plane (x,y) to a three-dimensional surface point; L = r xx n; N×r yy n; E = r x r y ; E=r x r y ; G=r y r y ; Among them, r x ,r y ,r xx ,r yy ,r xy is the partial differential of the surface; It is the unit normal vector, perpendicular to the tangent plane, used to quantify the "direction" and "degree" of surface curvature; LN-M 2 : Surface external curvature information, EG-F 2: The intrinsic metric stretch rate of the surface.
[0080] S203: Clustering the set of high curvature points to obtain defect point clusters.
[0081] Specifically, the computer device clusters the set of high curvature points, thereby removing the discrete point cloud and obtaining defect point clusters. It should be understood that defect points generally have relatively high curvature, so high curvature points are likely to be defect points. By clustering the high curvature points in step S203, the resulting point clusters are recorded as defect point clusters.
[0082] Exemplarily, the computer device may cluster high curvature points based on a Euclidean clustering algorithm or a K-means clustering algorithm.
[0083] It should be understood that after calculating the Gaussian curvature of each point in the target point cloud using a discrete differential geometry algorithm (i.e., obtaining a Gaussian curvature distribution map), high-curvature points can be clustered based on a dynamic threshold segmentation technique combined with neighborhood feature analysis to obtain defect point clusters, which can accurately locate surface defect areas (i.e., defect areas on the die-casting surface). For details, see the description of step S204. It should be noted that the clustering process in step S203 can filter out noise points, thereby improving the signal-to-noise ratio. For example, through an adaptive radius Euclidean clustering algorithm, intelligent filtering of noise points can be achieved by establishing a spatial topology constraint model.
[0084] S204 , determining the size of the defect region of the die casting according to the maximum and minimum values corresponding to the defect point cluster on three coordinate axes in the three-dimensional coordinate system.
[0085] Among them, the three-dimensional coordinate system can be a three-dimensional coordinate system established based on the target point cloud. The three-dimensional coordinate system includes three coordinate axes, namely the X-axis, the Y-axis and the Z-axis. The computer device can determine the maximum value of the defect point cluster on the X-axis, the Y-axis and the Z-axis, and determine the minimum value of the defect point cluster on the X-axis, the Y-axis and the Z-axis. The computer device can determine the area (i.e., bounding box) formed by the maximum and minimum values on the three coordinate axes (i.e., the X, Y, and Z directions) as the defect area of the die casting, thereby determining the size of the defect area of the die casting.
[0086] For example, the computer device may determine the size (size) S of the defect area according to the following formula:
[0087] S=max(X max -X min , Y max -Y min ,Z max -Z min );
[0088] Among them, Xmax refers to the maximum value on the X coordinate axis, Xmin refers to the minimum value on the X coordinate axis, Ymax refers to the maximum value on the Y coordinate axis, Ymin refers to the minimum value on the Y coordinate axis, Zmax refers to the maximum value on the Z coordinate axis, and Zmin refers to the minimum value on the Z coordinate axis.
[0089] The above-mentioned die-casting surface defect detection method uses a planned scanning path to drive a rotating device to rotate the scanning camera, achieving full coverage of the die-casting surface topography in a three-dimensional point cloud, thereby obtaining more accurate and complete point cloud data. Furthermore, based on the curvature of the accurate point cloud data, high-curvature points are screened from the point cloud, which is equivalent to initially screening points with a high probability of defects. Furthermore, high-curvature points are clustered to effectively eliminate noise points, thereby precisely locating defective areas on the die-casting surface and improving the accuracy of die-casting surface defect detection.
[0090] Moreover, the above solution does not require complex image reconstruction processing. Based on three-dimensional machine vision detection technology combined with the above-mentioned specific processing, it can accurately realize the detection of surface defects of die-casting parts, saving system computing resources.
[0091] In addition, the above-mentioned solution of the present application has made a breakthrough in solving the problem of missed feature detection on the surface of dark metal castings due to low contrast in traditional two-dimensional visual inspection.
[0092] In some embodiments, as Figure 3 As shown, in step S201, the scanning camera carried by the rotating device is driven to rotate by the rotating device to collect a three-dimensional point cloud of the die-casting part to obtain a target point cloud of the die-casting part (hereinafter referred to as the target point cloud determination step), including the following steps:
[0093] S2011: driving a scanning camera mounted on the rotating device to rotate via the rotating device to collect an initial point cloud for the die-casting part.
[0094] S2012, obtaining the area selection range.
[0095] The region selection range specifically refers to the x, y, and z range used to locate the region to be tested on the die-casting. Therefore, the x, y, and z range corresponding to the region selection range is used to determine the range of the region to be tested on the die-casting. For example, the region selection range can be a pre-set fixed position range. Alternatively, the region selection range can be a position range automatically and dynamically selected by a computer device based on analysis of the type of the die-casting to be tested, corresponding to the current die-casting to be tested.
[0096] S2013: Filter the area to be measured of the die-casting from the initial point cloud according to the area selection range.
[0097] Specifically, the computer device can filter the point clouds located within the region selection range from the initial point cloud, that is, obtain the region to be measured of the die casting.
[0098] S2014: De-noise the point cloud in the area to be measured to obtain the target point cloud.
[0099] Specifically, due to the characteristics of die-cast parts, which often have interfering noise on their surfaces, the point cloud within the selected test area will generally contain noise. Therefore, the computer equipment can denoise the point cloud within the test area, and the denoised point cloud is the target point cloud. It should be understood that the denoised target point cloud within the test area is more suitable for subsequent processing related to curvature screening of defect points, reducing the interference of noise points and improving the accuracy of defect identification.
[0100] For example, the computer device may use a point cloud filtering technique to perform denoising on the point cloud within the area to be measured. For example, the computer device may use a filtering algorithm such as Gaussian filtering, median filtering, and moving least squares method to perform denoising on the point cloud within the area to be measured.
[0101] Taking Gaussian filtering as an example, the formula for Gaussian filtering is:
[0102]
[0103] Where p0 is the coordinate value of the current point; p i is the coordinate value of the i-th point in the neighborhood; N' is the number of points in the neighborhood; G(||p i -p0||) is the Gaussian weight of the i-th point, and F(x,y,z) is the coordinate value of the point after filtering.
[0104] In some embodiments, the die-casting has a corresponding reference point cloud, and the region selection range is a position range set for the reference point cloud for selecting a region to be measured. In this embodiment, step S2013 of selecting the region to be measured from the initial point cloud based on the region selection range includes: registering the initial point cloud with the reference point cloud, and selecting the region to be measured from the registered point cloud based on the region selection range.
[0105] It should be understood that in actual production, defect detection is generally performed on multiple die-castings generated, so each die-casting needs to be assembled on the clamping device 4 for fixation. In this way, some position errors (i.e., offset errors) are inevitable during assembly. If only a fixed area selection range is applied, the position errors caused by improper assembly will cause the selection of the test area of the die-casting to be inaccurate, thereby affecting the subsequent positioning of the defective area.
[0106] To address the above issues, in this embodiment, a reference point cloud is set for the die-casting, and a corresponding region selection range is set only for the reference point cloud. During the surface defect inspection process for each die-casting, if an initial point cloud of the die-casting is collected, the initial point cloud can be aligned with the reference point cloud. After alignment, the region to be tested of the die-casting can be screened from the aligned point cloud based on the region selection range set for the reference point cloud. This avoids the problem of inaccurate selection of the region to be tested due to improper placement, and thus, to a certain extent, improves the accuracy of subsequent defect region positioning, that is, improves the accuracy of defect identification.
[0107] It should be understood that the solution of the present application is applicable to any type of die-castings, and different types of die-castings may have different structures. Therefore, in some embodiments, corresponding reference point clouds can be set for different types of die-castings, and corresponding area selection ranges can be set for each reference point cloud. In other words, different types of die-castings have their own corresponding area selection ranges. After the die-casting is placed on the clamping device 4, the computer equipment can automatically identify the type of the placed die-casting, and then determine the reference point cloud that matches the type, and obtain the area selection range corresponding to the type. In this way, surface defect detection can be accurately and conveniently performed on any type of die-castings in an adaptive manner without the need for manual intervention, which greatly improves intelligence and convenience, thereby improving defect detection efficiency.
[0108] In some embodiments, before registering the initial point cloud with the reference point cloud, the method further includes: acquiring a two-dimensional image captured for the die-casting part, and analyzing the type of the die-casting part based on the two-dimensional image; and determining a reference point cloud that matches the type.
[0109] Specifically, the computer device can obtain a two-dimensional image collected for the die-casting part, and automatically identify the type of the die-casting part by analyzing the two-dimensional image.
[0110] In some embodiments, the scanning camera mounted on the rotating device is driven to rotate by the rotating device to collect an initial point cloud for the die-casting, including: controlling the scanning camera to maintain an initial posture and move along a first direction of a guide rail through the rotating device; performing a first point cloud scan on the die-casting during the movement until the scanning camera is moved to the end of the guide rail, and then rotating the scanning camera to a target angle; controlling the scanning camera after rotating to the target angle through the rotating device to move along a second direction of the guide rail, and performing a second point cloud scan on the die-casting during the movement; wherein the second direction is opposite to the first direction; and merging the results of the first scan and the second scan to obtain the initial point cloud.
[0111] Among them, the initial posture is a pre-set posture that can collect point clouds for the die-casting. Specifically, the scanning camera can be kept in its initial posture and moved along the first direction of the guide rail without being rotated first. It should be understood that if the scanning camera always maintains its initial state along the guide rail, it may not be able to collect point clouds for a part of the die-casting. Therefore, after the scanning camera is moved to the end of the guide rail, the computer device can rotate the scanning camera to the target angle through a rotating device. After rotating to the target angle, the scanning camera is controlled to move along the second direction of the guide rail, and the die-casting is scanned for the second point cloud during the movement (i.e., reverse scanning). In this way, point cloud collection can be achieved for areas that were not collected during the first point cloud scan. Then, after merging the results of the first scan and the second scan (equivalent to seamless fusion of multi-view scanning data), a relatively complete and comprehensive point cloud of the die-casting surface, i.e., the initial point cloud, can be obtained.
[0112] Combine Figure 4 Explain. Figure 4 As shown, the scanning camera can be kept moving horizontally along the first direction to the end, and then rotated 90 degrees and scanned in the opposite direction along the second direction. In this way, the problem of camera instability caused by multiple rotations is avoided. It should be noted that Figure 4 This is for illustration only, and there is no limitation on the initial posture of the scanning camera and the target rotation angle.
[0113] In some embodiments, the same target angle can be used for different types of die-castings. That is, when using the above solution to inspect defects on different types of die-castings, the scanning camera can be rotated to the same target angle and then controlled to perform a second point cloud scan. For example, the target angle can be 90 degrees.
[0114] In other embodiments, the target angle corresponds to the type of the die-casting part, and different types of die-casting parts have their own corresponding target angles.
[0115] In some embodiments, obtaining the area selection range includes: associating and displaying the initial point cloud and the three-dimensional image of the die-cast part; in response to an area selection operation on the three-dimensional image, mapping the area range selected by the area selection operation in the three-dimensional image to the initial point cloud to obtain the area selection range.
[0116] Specifically, the computer device can acquire a 3D image of the die-cast part and display the initial point cloud in relation to the 3D image. This allows the user to manipulate the 3D image to select the area they wish to inspect. Furthermore, the computer device can map the selected area in the 3D image to the initial point cloud, thereby obtaining a region selection for the initial point cloud.
[0117] In the above-described embodiment, users can interactively specify specific areas within a die-cast part for defect detection, improving the flexibility of defect detection and adapting more flexibly to user detection needs while avoiding unnecessary detection that wastes system computing resources. Furthermore, the initial point cloud is displayed in conjunction with the 3D image of the die-cast part, allowing users to more intuitively and accurately specify the desired area for inspection.
[0118] It should be understood that die-castings are generally composed of multiple local structures or local areas. From a production perspective, it is generally desirable to conduct targeted inspections on a specific local structure or local area within a die-casting, and the local area or local structure to be targeted is recorded as the target area. However, manual area selection by users is often not precise enough, resulting in discrepancies between the selected area and the target area. For example, the selected area may be larger than the target area and include other interfering areas, or the selected area may not include the entire target area.
[0119] Therefore, in some examples, the computer device can pre-record the ranges of various local parts or local areas of the die-casting, which can be recorded as preset local areas. For ease of description, the area range selected by the area selection operation in the three-dimensional image is recorded as the initial selection range. After obtaining the initial selection range, the computer device can identify the preset local area corresponding to the initial selection range in the die-casting, which is equivalent to automatically correcting the range selected by the user, and using the identified preset local area as the target area, thereby mapping the area range corresponding to the target area to the initial point cloud, thereby obtaining the final area selection range.
[0120] The above solution, through interface interaction and automatic correction, can more accurately detect defects in the specified remainder, which not only meets the requirements of flexibility but also improves accuracy.
[0121] like Figure 5 As shown, in some embodiments, a simplified flow chart of a method for detecting surface defects of a die casting is provided, and the specific steps are described below.
[0122] 1. Load the workpiece using a clamping device, and collect data using a guide rail module, a high-precision turntable (i.e., a rotating device), and a structured light camera (i.e., a scanning camera). This creates an initial point cloud.
[0123] 2. Extract the area to be measured based on the initial point cloud and perform point cloud denoising on the point cloud in the area to be measured.
[0124] 3. Calculate the curvature of each point in the denoised point cloud.
[0125] 4. Extraction of high curvature areas.
[0126] That is, high curvature points are extracted from the denoised point cloud.
[0127] 5. Perform point cloud clustering on high curvature points.
[0128] 6. Calculate the defect size based on the clustered defect point clusters.
[0129] That is, based on the defect point clusters, the size of the defect area of the die casting is determined.
[0130] It should be understood that, although the steps in the flowcharts of the above embodiments are shown in sequence as indicated by the arrows, these steps are not necessarily performed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be performed in other orders. Moreover, at least a portion of the steps in the flowcharts of the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily to be performed in sequence, but can be performed in turn or alternately with other steps or at least a portion of steps or stages in other steps.
[0131] Based on the same inventive concept, embodiments of the present application also provide a device for detecting surface defects of die-castings for implementing the aforementioned method. The solution provided by this device is similar to the solution described in the aforementioned method. Therefore, the specific limitations of the one or more embodiments of the device for detecting surface defects of die-castings provided below can be found in the aforementioned definitions of the method for detecting surface defects of die-castings, and will not be further elaborated here.
[0132] like Figure 6 As shown, in some embodiments, the present application also provides a surface defect detection device for a die casting, the device comprising:
[0133] The point cloud acquisition module 602 is configured to control a servo motor to drive a rotating device according to a planned scanning path, thereby driving a scanning camera mounted on the rotating device to rotate, thereby acquiring a three-dimensional point cloud of the die-casting part to obtain a target point cloud of the die-casting part; the target point cloud is a point cloud of all or part of the area to be measured of the die-casting part;
[0134] a curvature calculation module 604 for calculating the curvature of each point in the target point cloud and extracting points with curvature greater than or equal to a preset curvature threshold from the target point cloud to obtain a set of high curvature points;
[0135] A clustering module 606 is configured to cluster the set of high curvature points to obtain defect point clusters;
[0136] The defect area positioning module 608 is used to determine the size of the defect area of the die casting according to the maximum and minimum values corresponding to the three coordinate axes of the defect point cluster in the three-dimensional coordinate system.
[0137] like Figure 7 As shown, in some embodiments, the point cloud acquisition module 602 includes:
[0138] The acquisition module 6021 is configured to drive the scanning camera mounted on the rotating device to rotate via the rotating device to acquire an initial point cloud for the die casting;
[0139] The region selection module 6022 is used to obtain a region selection range and select a region to be measured of the die casting from the initial point cloud according to the region selection range;
[0140] The denoising module 6023 is used to denoise the point cloud in the area to be measured to obtain the target point cloud.
[0141] In some embodiments, the die-casting has a corresponding reference point cloud, and the area selection range is a position range set for the reference point cloud and used to select the area to be measured; the area selection module 6022 is also used to align the initial point cloud with the reference point cloud, and according to the area selection range, screen the area to be measured of the die-casting from the aligned point cloud.
[0142] In some embodiments, the region selection module 6022 is further configured to obtain a two-dimensional image collected for the die-casting, analyze the type of the die-casting based on the two-dimensional image, and determine a reference point cloud that matches the type.
[0143] In some embodiments, the acquisition module 6021 is further used to control the scanning camera to rotate a corresponding rotation angle at each position node of the scanning path through the rotation device, and then perform three-dimensional point cloud acquisition on the die-casting to obtain the initial point cloud.
[0144] In some embodiments, the acquisition module 6021 is also used to control the scanning camera to maintain an initial posture and move along the first direction of the guide rail through the rotating device; perform a first point cloud scan on the die-casting part during the movement until the scanning camera is moved to the end of the guide rail, and then rotate the scanning camera to a target angle; control the scanning camera after rotating to the target angle through the rotating device to move along the second direction of the guide rail, and perform a second point cloud scan on the die-casting part during the movement; wherein, the second direction is opposite to the first direction; merge the results of the first scan and the results of the second scan to obtain the initial point cloud.
[0145] In some embodiments, the target angle is 90 degrees; or, the target angle corresponds to the type of the die-casting part, and different types of die-casting parts have their own corresponding target angles.
[0146] In some embodiments, the region selection module 6022 is further used to associate and display the initial point cloud and the three-dimensional image of the die-cast part; in response to a region selection operation on the three-dimensional image, the region range selected by the region selection operation in the three-dimensional image is mapped to the initial point cloud to obtain the region selection range.
[0147] Each module in the aforementioned die-casting surface defect detection device can be implemented in whole or in part through software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a computer device memory in the form of software, so that the processor can call and execute the corresponding operations of each module.
[0148] In one embodiment, a computer device is provided, whose internal structure diagram can be as follows: Figure 8 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O) and a communication interface. The processor, memory and input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a surface defect detection method for a die-casting is implemented.
[0149] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0150] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the steps in each embodiment of the present application are implemented.
[0151] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in each embodiment of the present application are implemented.
[0152] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in each embodiment of the present application when executed by a processor.
[0153] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions.
[0154] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processor involved in the various embodiments provided herein may be, but are not limited to, a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, and the like.
[0155] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0156] The above embodiments merely illustrate several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art may make various modifications and improvements without departing from the spirit of the present invention, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
Claims
1. A method for detecting surface defects of die castings, characterized in that: The method comprises: Controlling a servo motor to drive a rotating device according to a planned scanning path, and driving a scanning camera mounted on the rotating device to rotate via the rotating device to collect a three-dimensional point cloud of the die-casting to obtain a target point cloud of the die-casting; the target point cloud is a point cloud of all or part of the area to be measured of the die-casting; Calculating the curvature of each point in the target point cloud, and extracting points whose curvature is greater than or equal to a preset curvature threshold from the target point cloud to obtain a set of high curvature points; Clustering the set of high curvature points to obtain defect point clusters; The size of the defect area of the die casting is determined according to the maximum value and the minimum value corresponding to the defect point cluster on the three coordinate axes in the three-dimensional coordinate system.
2. The method according to claim 1, characterized in that The scanning camera carried by the rotating device is driven to rotate by the rotating device to collect a three-dimensional point cloud of the die casting to obtain a target point cloud of the die casting, including: The scanning camera carried by the rotating device is driven to rotate by the rotating device to collect an initial point cloud for the die casting; Acquiring an area selection range, and screening a region to be measured of the die casting from the initial point cloud according to the area selection range; De-noising the point cloud in the area to be measured to obtain the target point cloud.
3. The method according to claim 2, characterized in that The die casting has a corresponding reference point cloud, and the region selection range is a position range set for the reference point cloud and used to select the region to be measured; The step of screening the area to be measured of the die casting from the initial point cloud according to the area selection range includes: The initial point cloud is registered with the reference point cloud, and according to the region selection range, the region to be measured of the die casting is screened from the registered point cloud.
4. The method according to claim 3, characterized in that Before registering the initial point cloud with the reference point cloud, the method further includes: Acquiring a two-dimensional image collected for the die-casting, and analyzing the type of the die-casting based on the two-dimensional image; A reference point cloud matching the type is determined.
5. The method according to claim 2, characterized in that The step of driving the scanning camera mounted on the rotating device to rotate by the rotating device to collect an initial point cloud for the die casting comprises: The scanning camera is controlled by the rotating device to rotate at corresponding rotation angles at each position node of the scanning path, and then three-dimensional point cloud collection is performed on the die casting to obtain the initial point cloud.
6. The method according to claim 2, characterized in that The step of driving the scanning camera mounted on the rotating device to rotate by the rotating device to collect an initial point cloud for the die casting comprises: By means of the rotating device, the scanning camera is controlled to maintain an initial posture and move along a first direction of the guide rail; Performing a first point cloud scan on the die casting during the movement process until the scanning camera is moved to the end of the guide rail, and then rotating the scanning camera to a target angle; The scanning camera is controlled by the rotating device to rotate to the target angle, and moves along the second direction of the guide rail, and performs a second point cloud scan on the die casting during the movement; wherein the second direction is opposite to the first direction; The result of the first scan and the result of the second scan are combined to obtain the initial point cloud.
7. The method according to claim 6, characterized in that The target angle is 90 degrees; or, the target angle corresponds to the type of the die casting, and different types of die castings have their own corresponding target angles.
8. The method according to claim 2, characterized in that The acquisition area selection range includes: displaying the initial point cloud and the three-dimensional image of the die-cast part in association with each other; In response to a region selection operation on the three-dimensional image, the region range selected by the region selection operation in the three-dimensional image is mapped to the initial point cloud to obtain the region selection range.
9. A surface defect detection device for die castings, characterized in that: The device comprises: a point cloud acquisition module, configured to control a servo motor to drive a rotating device according to a planned scanning path, thereby driving a scanning camera mounted on the rotating device to rotate, so as to acquire a three-dimensional point cloud of the die-casting part and obtain a target point cloud of the die-casting part; the target point cloud is a point cloud of all or part of the area to be measured of the die-casting part; a curvature calculation module, configured to calculate the curvature of each point in the target point cloud, and extract points whose curvature is greater than or equal to a preset curvature threshold from the target point cloud to obtain a set of high curvature points; A clustering module, configured to cluster the set of high curvature points to obtain defect point clusters; The defect area positioning module is used to determine the size of the defect area of the die casting according to the maximum value and the minimum value corresponding to the three coordinate axes of the defect point cluster in the three-dimensional coordinate system.
10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 8 are implemented.
Citation Information
Cited By
Lining internal defect detection method based on three-dimensional point cloud
CN121068607A
Battery cell shell detection equipment and detection method
CN121112907A
Intelligent pipe surface defect detection method based on image recognition
CN121504913A