Workpiece defect mapping method and system, electronic equipment and computer storage medium
By in the X -ray image of high -voltage die -casting workers, the label defect point is converted to the actual shooting point to a virtual shooting point. The virtual shooting point is used to build the mapping position of the defect point to solve the problem of low efficiency of the defective construction of the workpiece. The three -dimensional model construction.
Patent Information
- Application Number
- CN202411509011.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-28
- Publication Date
- 2025-01-28
AI Technical Summary
During the high-pressure die-casting process, the workpiece is prone to defects, such as incomplete filling of air holes, acute angles, burr flicks, etc., which leads to potential safety hazards during use of the workpiece, and it is difficult for the prior art to quickly and efficiently build a three-dimensional model with defects.
By shooting multiple X -ray images of the workpiece obtained from multiple perspectives at the actual shooting point, the defective point is marked, and the actual shooting point is converted into a virtual shooting point of the three -dimensional model, so that the virtual shooting point shooting three -dimensional model is equivalent to the actual shooting point with the actual shooting point. Take the workpiece, use the defective point marked in the X -ray image, find out the mapping position of the defect point in the virtual image taken at the virtual shooting point, and build the straight line of the defect mapping position through the virtual shooting point to obtain the defects at the three dimensions of the three dimensions. The mapping position on the model.
Through this method, the defect data can be quickly found, the mapping of the defect in the three -dimensional model is automatically completed, the impact of the human -oriented factors is reduced, and the construction efficiency of the three -dimensional model with defects is improved.
Smart Images

Figure CN119380127A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a workpiece defect mapping method, system, electronic device and computer storage medium. Background Art
[0002] High-pressure die casting is a precision casting method, but in the process of high-pressure die casting, it is inevitable that some workpieces produced by high-pressure die casting will have defects due to problems such as pores, incomplete filling of sharp corners, burrs and flash. Different defects have different degrees of influence on the workpiece during use. For example, the use environment of some workpieces is a high-pressure environment. The inclusion defects in the workpiece make the risk of the workpiece breaking during use smaller, while the crack defects in the workpiece make the risk of the workpiece breaking during use higher.
[0003] In order to evaluate the impact of defects on the performance of workpieces, it is necessary to establish a three-dimensional model of the workpiece with defects, and use digital simulation technology to simulate the deformation and stress distribution of the three-dimensional model of the workpiece with defects under different loads and different environmental conditions, so as to timely discover the potential safety hazards caused by the defects of the workpiece. Among them, the shape and surface of the three-dimensional model are composed of straight lines, curves and shapes (points, lines, rectangles and circles, etc.) represented by mathematical formulas.
[0004] Currently, when building a three-dimensional model of a workpiece with defects, the workpiece is mainly scanned using industrial CT (Computed Tomography) technology to obtain a large amount of industrial CT data. The three-dimensional model of the workpiece is manually constructed based on the large amount of industrial CT data, and the defects are constructed in the three-dimensional model.
[0005] Since the amount of industrial CT data is huge but the defect size is small, the amount of defect data accounts for a low proportion in the large amount of CT data, it is difficult to quickly find defect data and the artificial construction process of defects is complicated and cumbersome, which makes the construction efficiency of three-dimensional models with defects low. Summary of the invention
[0006] In view of the above problems, the present application provides a workpiece defect mapping method, system, electronic device and computer storage medium to achieve the purpose of improving the efficiency of building a three-dimensional model with defects. The specific scheme is as follows:
[0007] A first aspect of the present application provides a workpiece defect mapping method, the workpiece defect mapping method comprising:
[0008] Marking defect points on multiple X-ray images of the workpiece obtained by shooting at multiple viewing angles at the actual shooting point;
[0009] Determine the position of a virtual shooting point for shooting the three-dimensional model of the workpiece according to the position of the actual shooting point, wherein the center points of each virtual image obtained by shooting the three-dimensional model at the virtual shooting point with the multiple viewing angles coincide with the center points of each mapping of the multiple X-ray images onto the three-dimensional model;
[0010] Based on the one-to-one coincidence of the mapping center point and the center point of the virtual image, mapping the marked defect point to a mapping position on the virtual image;
[0011] According to the position of the virtual shooting point and the mapping position of the defect point, the virtual defect point position where the defect point is mapped to the three-dimensional model of the workpiece is determined.
[0012] In a possible implementation, determining the position of a virtual shooting point for shooting the three-dimensional model of the workpiece according to the position of the actual shooting point includes:
[0013] Directly determining the position of the actual shooting point as the position of the virtual shooting point;
[0014] The three-dimensional model is moved so that the center points of each virtual image obtained by shooting the three-dimensional model at the virtual shooting point with the multiple viewing angles coincide with the center points of the mappings of the center points of the multiple X-ray images onto the three-dimensional model.
[0015] In a possible implementation, the moving the three-dimensional model so that the center points of each virtual image obtained by photographing the three-dimensional model at the virtual photographing point with the multiple viewing angles coincide with each mapping center point of the multiple X-ray images mapped onto the three-dimensional model, respectively, includes:
[0016] Acquire each mapping center point of the X-ray image and each center point of the virtual image, and compare the mapping center points with the center points one by one under multiple same viewing angles to obtain multiple center point differences;
[0017] Constructing an objective function according to the multiple center point gaps, and inputting the movement variables of the three-dimensional model as parameters and the objective function into an optimization algorithm for iterative optimization, wherein the movement variables of the three-dimensional model correspond to the coordinates of each mapping center point of the X-ray image after the movement;
[0018] When the objective function takes a minimum value, obtaining a target movement variable of the three-dimensional model output by the optimization algorithm;
[0019] The three-dimensional model is moved according to the target movement variable so that at the virtual shooting point, each mapping center point of the X-ray image coincides with each center point of the virtual image one by one.
[0020] In a possible implementation, mapping the marked defect point to a mapping position on the virtual image based on the one-to-one coincidence of the mapping center point and the center point of the virtual image includes:
[0021] If the defect point is marked in the X-ray image, obtaining a positional relationship between the defect point and a center point of the X-ray image;
[0022] According to the positional relationship and the center point of the virtual image, the mapping position of the defect point is determined on the virtual image, and the center point of the virtual image and the mapping center of the X-ray image with the defect point coincide with each other on the three-dimensional model.
[0023] In a possible implementation, determining the virtual defect point position mapped from the defect point to the three-dimensional model of the workpiece according to the position of the virtual shooting point and the mapping position of the defect point includes:
[0024] Constructing a first straight line passing through the virtual shooting point, wherein the first straight line is perpendicular to the plane where the virtual image is located;
[0025] Translating the first straight line so that it passes through the mapping position of the defect point to obtain a second straight line at the mapping position;
[0026] The intersection position of the second straight line and the three-dimensional model is calculated, and the intersection position is used as a virtual defect point position mapped onto the three-dimensional model by the defect point in the X-ray image.
[0027] In a possible implementation, the method further includes:
[0028] A point matrix of the three-dimensional model is constructed, in which the point values corresponding to the virtual defect point positions are set to 1, and the point values corresponding to the non-virtual defect point positions are set to 0.
[0029] A second aspect of the present application provides a workpiece defect mapping system, the workpiece defect mapping system comprising:
[0030] A marking unit, used for marking defect points on a plurality of X-ray images of a workpiece obtained by shooting at a plurality of viewing angles at an actual shooting point;
[0031] a position unit, used to determine the position of a virtual shooting point for shooting the three-dimensional model of the workpiece according to the position of the actual shooting point, wherein the center points of each virtual image obtained by shooting the three-dimensional model at the virtual shooting point with the multiple viewing angles coincide with each mapping center point of the multiple X-ray images mapped onto the three-dimensional model;
[0032] A mapping unit, configured to map the marked defect point to a mapping position on the virtual image based on the one-to-one coincidence of the mapping center point and the center point of the virtual image;
[0033] A construction unit is used to determine the virtual defect point position mapped to the three-dimensional model of the workpiece according to the position of the virtual shooting point and the mapping position of the defect point.
[0034] In a possible implementation, the location unit includes:
[0035] A position determination subunit, used to directly determine the position of the actual shooting point as the position of the virtual shooting point;
[0036] The model moving subunit is used to move the three-dimensional model so that the center points of each virtual image obtained by shooting the three-dimensional model at the virtual shooting point with the multiple viewing angles coincide with the mapping center points of the multiple X-ray images mapped onto the three-dimensional model.
[0037] A third aspect of the present application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:
[0038] The memory is used to store computer programs;
[0039] The processor is used to execute the computer program so that the electronic device can implement the workpiece defect mapping method of the first aspect or any implementation manner of the first aspect.
[0040] A fourth aspect of the present application provides a computer storage medium, which carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement the workpiece defect mapping method of the above-mentioned first aspect or any implementation of the first aspect.
[0041] By means of the above technical scheme, the present application provides a method, system, electronic device and computer storage medium for mapping workpiece defects. The present method does not use industrial CT data, but uses X-ray data instead. Compared with industrial CT data, the amount of X-ray data is greatly reduced. In addition, the present method converts the actual shooting point into a virtual shooting point of the three-dimensional model, so that shooting the three-dimensional model with the virtual shooting point is equivalent to shooting the workpiece with the actual shooting point. After the virtual shooting point is determined, the defect point marked in the X-ray image can be used to find the mapping position of the defect point in the virtual image shot by the virtual shooting point, and a straight line passing through the mapping position of the defect point is constructed through the virtual shooting point to obtain the intersection of the straight line and the three-dimensional model, thereby completing the mapping of the defect point. Therefore, the present method can use X-ray data with a greatly reduced amount of data to quickly find the defect data, and the mapping of defects in the three-dimensional model can be automatically completed through the present solution, reducing the influence of human factors, so as to improve the construction efficiency of the three-dimensional model with defects. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0043] Figure 1 A schematic diagram of a workpiece defect mapping method provided in an embodiment of the present application;
[0044] Figure 2 A schematic diagram of multi-view correction provided in an embodiment of the present application;
[0045] Figure 3 A schematic diagram of a first straight line and a second straight line provided in an embodiment of the present application;
[0046] Figure 4 A schematic diagram of the structure of a workpiece defect mapping system provided in an embodiment of the present application;
[0047] Figure 5 A hardware structure block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0048] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.
[0049] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0050] The terms "first", "second" etc. in the specification of the application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable in appropriate circumstances, and this is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0051] In the process of high-pressure die casting, it is difficult for workpieces to have defects due to problems such as pores and incomplete filling at sharp corners. In order to evaluate the impact of defects on the performance of workpieces, it is necessary to build a three-dimensional model of the workpiece with defects and perform digital simulation on the three-dimensional model with defects to obtain the deformation and stress distribution of the three-dimensional model with defects under different loads and different environmental conditions, thereby obtaining the impact of defects on the performance of workpieces.
[0052] In the construction of a three-dimensional model with defects, the data used for construction is the industrial CT data of the workpiece, and the amount of industrial CT data is huge. The defect itself does not occupy a large volume in the workpiece. In the huge industrial CT data, the proportion of defect data is too low and the defect has no obvious geometric features, which is equivalent to the defect occupying only a few pixels in thousands or tens of thousands of image data. Therefore, it is difficult to find defect data or it is easy to miss defect data, and the professional capabilities of personnel are different, which makes the construction efficiency of the three-dimensional model with defects too low and it is difficult to ensure the accuracy of the model. Furthermore, there are a lot of manual operations in the process of manually constructing a three-dimensional model with defects, making the process complicated and cumbersome.
[0053] In order to solve the above problems, an embodiment of the present application provides a method for workpiece defect mapping, which uses X-ray data as model construction data. Compared with industrial CT data, the amount of X-ray data is greatly reduced. In addition, the method converts the actual shooting point and the virtual shooting point, so that shooting the three-dimensional model of the workpiece at the virtual shooting point is equivalent to shooting the workpiece at the actual shooting point, and using this correspondence, the defect points marked in the X-ray image shot at the actual shooting point are mapped on the virtual image shot by the virtual shooting image, and the defect points are mapped on the three-dimensional model of the workpiece using the mapping position of the defect points on the virtual image, thereby automatically completing the defect construction of the three-dimensional model of the workpiece.
[0054] The workpiece defect mapping method of the embodiment of the present application is described in detail below with reference to the accompanying drawings.
[0055] Reference Figure 1 , Figure 1 A schematic diagram of a workpiece defect mapping method provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, a workpiece defect mapping method provided in an embodiment of the present application may include steps S10 to S13, and these steps are described in detail below.
[0056] S10, marking defect points on a plurality of X-ray images of the workpiece obtained by photographing at a plurality of viewing angles at an actual photographing point.
[0057] Among them, the actual shooting point can be the position where the shooting device is placed. In this embodiment, the shooting device is placed on the mechanical arm, and the actual shooting point of this embodiment is the three-dimensional center coordinates of the mechanical arm and the angles of the three attitude angles, and each viewing angle corresponds to a set of three attitude angles. Among them, the three-dimensional center coordinates of the mechanical arm are the coordinate origin of the three-dimensional coordinate system of the mechanical arm, and are also the rotation center of the mechanical arm. The three-dimensional coordinate system can be set manually. The attitude angle of the mechanical arm is the angle rotated relative to the three-dimensional coordinate system of the mechanical arm, which can be divided into the attitude angle rotating around the X-axis, the attitude angle rotating around the Y-axis, and the attitude angle rotating around the Z-axis. The angle of its attitude angle can be the angle rotating around the X, Y and Z axes respectively, and the positive and negative of its angle can be determined according to artificial rules. For example, the attitude angle rotating around the Z axis, when the mechanical arm rotates to the right, the angle of its attitude angle is positive, and when the mechanical arm rotates to the left, the angle of its attitude angle is negative. This is only an example to illustrate the setting of the attitude angle.
[0058] Since workpieces are generally large in size and have small defects, in order to achieve ideal resolution, the robot can be moved to capture X-ray images at multiple viewing angles, and each X-ray image at each viewing angle can include a portion of the workpiece. During the workpiece capture process, the robot's 3D center coordinates and the three attitude angles must be recorded at each viewing angle.
[0059] After obtaining X-ray images of the workpiece from multiple viewing angles at the actual shooting point, this embodiment can segment the X-ray image through a neural network model to mark the defect points in the X-ray image. The specific form of marking is to mark the defect as an area of a specific color. The neural network model is trained with an X-ray image data set with marked defect points, and a better marking effect can be achieved. Of course, since the data of X-ray images is greatly reduced compared to the data of industrial CT, generally more than ten pictures, this embodiment can also manually mark the defect points in the X-ray image.
[0060] S11. Determine the position of a virtual shooting point of the three-dimensional model of the workpiece by using the position of the actual shooting point, wherein the center points of each virtual image obtained by shooting the three-dimensional model at multiple viewing angles at the virtual shooting point coincide with each mapping center point of the multiple X-ray images mapped onto the three-dimensional model.
[0061] The virtual shooting point is the shooting position in the three-dimensional space where the three-dimensional model of the workpiece is located, corresponding to the actual shooting point in the real space. In this embodiment, the device shooting can be simulated by computer technology. At this time, the virtual shooting point can be equivalent to a three-dimensional display window, simulating the device shooting in the form of a screenshot. Therefore, the screenshots of the three-dimensional model of the workpiece obtained by intercepting at the virtual shooting point under multiple viewing angles are equivalent to multiple X-ray images of the workpiece obtained by photographing at multiple viewing angles at the actual shooting point. Each virtual image obtained by shooting at the virtual shooting point can contain a partial area of the three-dimensional model of the workpiece.
[0062] The mapping center point of the X-ray image on the three-dimensional model is: the image center point of the X-ray image is marked on the three-dimensional model of the workpiece. Due to the small amount of X-ray image data, the center point marking process can be manually marked on the three-dimensional model of the workpiece.
[0063] In order to make the image center point of the virtual image coincide with the mapping center point of the X-ray image mapped on the three-dimensional model at the same viewing angle, the virtual shooting point needs to be corrected. Specifically, the correction process of the virtual shooting point may include the following steps 1 and 2:
[0064] Step 1: directly determine the position of the actual shooting point as the position of the virtual shooting point;
[0065] Step 2: Move the 3D model so that the center points of each virtual image obtained by photographing the 3D model at multiple viewing angles at the virtual shooting point coincide with the center points of the multiple X-ray images mapped onto the 3D model.
[0066] Among them, the position of the virtual shooting point is the shooting three-dimensional coordinates of the virtual shooting point in the three-dimensional space, and the viewing angle of the virtual shooting point is the angle of the virtual shooting point when shooting. Since the virtual shooting point is a three-dimensional display window in this embodiment, the three-dimensional center coordinates of the actual shooting point and the angles of the three posture angles can be set as parameters of the three-dimensional display window in this embodiment. The three-dimensional center coordinates of the actual shooting point correspond to the position of the virtual shooting point, and the angles of the three posture angles of the actual shooting point correspond to the viewing angle of the virtual shooting point. After determining the position of the virtual shooting point in this embodiment, virtual images under multiple viewing angles can be obtained, and by moving the three-dimensional model of the workpiece, the image center point of the virtual image coincides with the mapping center point of the X-ray image mapped on the three-dimensional model under multiple viewing angles. Of course, this embodiment can also fix the position of the three-dimensional model, take the position of the actual shooting point as the initial position, adjust the position of the virtual shooting point, and obtain virtual images under multiple viewing angles each time the position of the virtual shooting point is adjusted, and observe whether the image center point of the virtual image coincides with the mapping center point of the X-ray image mapped on the three-dimensional model under multiple viewing angles. If not, continue to adjust the position of the virtual shooting point until the image center point of the virtual image coincides with the mapping center point of the X-ray image mapped on the three-dimensional model under multiple viewing angles.
[0067] Specifically, when the position of the virtual shooting point is corrected by moving the three-dimensional model of the workpiece, the process may be specifically as shown in the following steps 3 to 6:
[0068] Step 3: Obtain each mapping center point of the X-ray image and each center point of the virtual image, and compare the mapping center points with the center points under the same viewing angle one by one to obtain the difference between multiple center points;
[0069] Step 4: construct an objective function based on the multiple center point gaps, and input the movement variables of the three-dimensional model as parameters and the objective function into the optimization algorithm for iterative optimization, wherein the movement variables of the three-dimensional model correspond to the coordinates of each mapping center point of the X-ray image after movement;
[0070] Step 5: When the objective function takes the minimum value, the target movement variable of the three-dimensional model output by the optimization algorithm is obtained;
[0071] Step 6: Move the three-dimensional model according to the target movement variable so that at the virtual shooting point, each mapping center point of the X-ray image coincides with each center point of the virtual image.
[0072] In order to make the shooting of the virtual shooting point completely equal to the shooting of the actual shooting point, this embodiment not only corrects the mapping center point of the X-ray image and the center point of the virtual image at one viewing angle, but also corrects multiple viewing angles at the same time, so that the mapping center points of each X-ray image at multiple viewing angles coincide with the center points of each virtual image at the same time. Figure 2As shown in the figure, a three-dimensional model of a cubic workpiece has two solid points marked on the three-dimensional model, which are the image center points of the X-ray images marked on the three-dimensional model at two different viewing angles, that is, the mapping center points of the X-ray images. The dotted area is a virtual image taken at the same two different viewing angles, and the hollow point is the image center point of the virtual image. In A, the solid points and hollow points at the two viewing angles do not overlap, but after the two viewing angles are corrected at the same time, in B, the solid points and hollow points are overlapped at the same time. Figure 2 This is only an example to illustrate the simultaneous correction of two perspectives. In actual situations, simultaneous correction of two or more perspectives is often involved, and the area of the virtual image is not necessarily marked on the three-dimensional model.
[0073] Therefore, since it involves the simultaneous coincidence of multiple mapping center points and multiple virtual image center points, which is difficult to achieve by observing the movement, the present embodiment constructs an objective function, and optimizes the value of the objective function to obtain the optimal three-dimensional model movement variable, so that after the three-dimensional model is moved according to the optimal three-dimensional model movement variable, each mapping center point marked on the three-dimensional model can coincide with each virtual image center point one by one.
[0074] Specifically, this embodiment uses the sum of the squares of the differences between each mapping center point and the center point of each virtual image center as the objective function, and the movement variable of the three-dimensional model affects the mapping center point of the X-ray image on the three-dimensional model. Therefore, there is a set of movement variables of the three-dimensional model, which makes the difference between each center point of each mapping center point on the three-dimensional model after movement and each center point of each virtual image center the smallest. At this time, the sum of the center point differences is taken as the function value of the objective function to take the minimum value. Based on the above principles, this embodiment inputs the movement variables of the three-dimensional model as parameters and the objective function into the optimization algorithm for iterative optimization until the objective function takes the minimum value, and obtains the target movement variables of the three-dimensional model output by the optimization algorithm. Among them, the optimization algorithm used in this embodiment is the CMA-ES (Covariance Matrix Adaptation Evolution Strategy) algorithm.
[0075] Specifically, the objective function can be expressed as follows:
[0076]
[0077] in, It can represent the mapping center point of a set of X-ray images and the center point of the virtual image at the same viewing angle; Can represent a set of center point gaps.
[0078] S12, mapping the marked defect point to a mapping position on the virtual image based on the one-to-one coincidence of the mapping center point and the center point of the virtual image.
[0079] When the three-dimensional model has completed the movement according to the target movement variable, the mapping center points marked on the three-dimensional model by the X-ray image have overlapped with the center points of the virtual image. At this time, this embodiment can map the defect points marked on the X-ray image by the neural network model to the virtual image. The specific steps can be shown in steps 7 and 8:
[0080] Step 7: If a defect point is marked in the X-ray image, the positional relationship between the defect point and the center point of the X-ray image is obtained;
[0081] Step 8: According to the positional relationship and the center point of the virtual image, the mapping position of the defect point is determined on the virtual image, and the center point of the virtual image and the mapping center of the X-ray image with the defect point coincide on the three-dimensional model.
[0082] Among them, the position relationship can refer to the coordinate relationship between two points, which can be represented by a vector. For example, if the coordinate point A is (0, 0) and the coordinate point B is (2, 2), then the position relationship between A and B can be expressed as: vector AB=(2-0, 2-0)=(2, 2), which means starting from A, first move 2 unit distances along the positive direction of the X axis, and then move 2 unit distances along the positive direction of the Y axis to reach point B.
[0083] After the correction of the virtual shooting point, at each viewing angle, the shooting at the virtual shooting point is equivalent to the shooting at the actual shooting point, and the center point of the virtual image coincides with each mapping center point of the X-ray image on the three-dimensional model, which is equivalent to the coincidence with the image center point of the X-ray image shot at the actual shooting point. Therefore, since both the X-ray image and the virtual image are two-dimensional images and the center point of the X-ray image coincides with the center point of the virtual image at the same viewing angle, when the defect point is mapped on the virtual image in this embodiment, it is most accurate to map according to the position of the image center point of the X-ray image. Therefore, after the positional relationship between the defect point and the image center point of the X-ray image is obtained in the X-ray image, since the center point of the X-ray image coincides with the center point of the virtual image, the positional relationship between the defect point and the center point of the virtual image can be obtained. In this embodiment, the center point of the virtual image is used as a reference point, and according to the positional relationship between the defect point and the center point of the virtual image, the mapping position of the defect point can be marked on the virtual image. For example, the center point C of the X-ray image is (1, 1), the image center point D of the virtual image is (3, 3), and the mapping center point of the X-ray image on the three-dimensional model of the workpiece coincides with the image center point D of the virtual image. At the same time, there is a defect point E (2, 2) marked in the X-ray image, and the positional relationship between the defect point E and the center point C of the X-ray image can be expressed by a vector: vector CE = (2-1, 2-1) = (1, 1), which means that starting from the center point C of the X-ray image, first move 1 unit distance along the positive direction of the X axis, and then move 1 unit distance along the positive direction of the Y axis, then you can reach the defect point E. Therefore, in the virtual image, you can take the image center point D (3, 3) of the virtual image as the starting point, first move 1 unit distance along the positive direction of the X axis, and then move 1 unit distance along the positive direction of the Y axis, and get the coordinate point F (4, 4), then the coordinate point F (4, 4) is the mapping position of the defect point E in the virtual image.
[0084] S13. Determine the virtual defect point position where the defect point is mapped to the three-dimensional model of the workpiece according to the position of the virtual shooting point and the mapping position of the defect point.
[0085] Similar to camera shooting, the virtual shooting point can be assumed to be a light source that can emit light in all directions. Along the direction of the light emitted by the virtual shooting point, each pixel in the virtual image can be considered to have a light ray passing through it, and at the same time passing through the three-dimensional model of the workpiece. The intersection of the light ray and the three-dimensional model of the workpiece has a pixel on the virtual image that is located on the same light ray as the intersection.
[0086] When mapping the mapping position of the defect point on the virtual image to the three-dimensional model, the light passing through each pixel of the virtual image can be abstracted as a straight line equation. After determining the straight line equation of the pixel point passing through the defect point, the intersection of the straight line equation and the three-dimensional model can be calculated, and the intersection can be used as the mapping point of the defect point on the three-dimensional model. Among them, the three-dimensional model of the workpiece is a vector model, and the points, lines, and surfaces that constitute the model can all be expressed using mathematical formulas. Therefore, this embodiment can directly calculate the intersection of the straight line equation and the mathematical formula that constitutes the model. Of course, this embodiment can convert the three-dimensional model of the workpiece into a two-dimensional virtual image according to the conversion relationship of the virtual shooting point, and convert the mapping position of the defect point on the two-dimensional virtual image into a point on the three-dimensional model.
[0087] Specifically, the process of mapping the defect points on the three-dimensional model can be shown in steps nine to eleven:
[0088] Step nine: construct a first straight line passing through the virtual shooting point, where the first straight line is perpendicular to the plane where the virtual image is located;
[0089] Step 10: Translate the first straight line so that it passes through the mapping position of the defect point to obtain a second straight line at the mapping position;
[0090] Step 11: Calculate the intersection position of the second straight line and the three-dimensional model, and use the intersection position as the virtual defect point position mapped on the three-dimensional model by the defect point in the X-ray image.
[0091] The first straight line is a straight line constructed in this embodiment that is perpendicular to the two-dimensional plane where the virtual image is located and passes through the center point of the virtual image. The second straight line is a straight line that passes through the mapping position of the defect point after the first straight line is moved parallel to the first straight line in this embodiment. The second straight line is perpendicular to the two-dimensional plane where the virtual image is located.
[0092] When constructing the first straight line passing through the virtual shooting point, the virtual shooting point can be moved along the light direction or the shooting direction to obtain the symmetrical point of the virtual shooting point with the two-dimensional plane where the virtual image is located as the symmetrical plane. A straight line can be determined through the virtual shooting point and the symmetrical point of the virtual shooting point, and the straight line can be used as the first straight line of this embodiment. Among them, if the position of the virtual shooting point and the position of the symmetrical point of the virtual shooting point are known, the straight line equation of the first straight line can be determined. Of course, this embodiment can also construct the first straight line with the virtual shooting point and the center point of the virtual image. After the first straight line is constructed, the first straight line is moved in parallel, so that the moved first straight line passes through the mapping position of the defect point in the virtual image to obtain the second straight line. Among them, when the first straight line is moved in parallel, the positional relationship between the defect point and the center point of the virtual image can be used again. At this time, according to the positional relationship, the position of the virtual shooting point and the symmetrical point of the virtual shooting point after moving can be obtained, and the straight line equation of the second straight line can be determined. For example, Figure 3 As shown, the thick solid line area is the image area of the virtual image. The two-dimensional virtual image is located in plane α, P is the virtual shooting point, G is the image center point of the virtual image, and H is the mapping position of the defect point on the virtual image. The symmetric point P1 of P is determined through plane α. P and P1 are symmetrical about plane α. According to P and P1, a straight line L1 passing through G and its straight line equation are determined. Straight line L1 is perpendicular to plane α. Straight line L1 is moved parallel to H to obtain straight line L2. The straight line equation of straight line L2 can be determined through P2 and P3. P2 can be obtained by calculation through P, and P3 can be obtained by calculation through P1. Figure 3 This is only an example to illustrate how to obtain the first straight line and the second straight line.
[0093] After calculating the intersection of the second straight line passing through the defect point and the three-dimensional model of the workpiece, the intersection can be used as a virtual defect point on the three-dimensional model of the workpiece mapped with the defect point in the X-ray image, and the position of the virtual defect point is the virtual defect point position. When the virtual defect point positions of all defect points on the three-dimensional model of the workpiece are obtained, this embodiment can construct a point matrix of the three-dimensional model. In the point matrix, the point values corresponding to the virtual defect point positions are set to 1, and the point values corresponding to the non-virtual defect point positions are set to 0. Among them, the point matrix is a data structure containing multiple points, each point representing a three-dimensional coordinate in a three-dimensional space. In this embodiment, multiple points are selected according to a fixed rule or algorithm to form a point matrix, ensuring that the point matrix can depict the surface of the three-dimensional model of the workpiece, and the point value of each point indicates whether the three-dimensional coordinate corresponding to the point has a defect on the surface of the three-dimensional model. Specifically, in this embodiment, according to the virtual defect point positions of all defect points on the three-dimensional model of the workpiece, in the point matrix, the point value corresponding to the virtual defect point position is 1, indicating that on the surface of the three-dimensional model, the three-dimensional coordinates corresponding to the point have defects; the point value corresponding to the non-virtual defect point position is set to 0, indicating that on the surface of the three-dimensional model, the three-dimensional coordinates corresponding to the point do not have defects.
[0094] The embodiment of the present application provides a defect mapping method, which does not use industrial CT data, but uses X-ray data instead. Compared with industrial CT data, the amount of X-ray data is greatly reduced. In addition, the method converts the actual shooting point into a virtual shooting point of the three-dimensional model, so that the virtual shooting point shooting the three-dimensional model is equivalent to the actual shooting point shooting the workpiece. After the virtual shooting point is determined, the defect point marked in the X-ray image can be used to find the mapping position of the defect point in the virtual image shot by the virtual shooting point, and a straight line passing through the mapping position of the defect point is constructed through the virtual shooting point to obtain the defect point mapped on the three-dimensional model, thereby completing the mapping of the defect point. Therefore, the method can use X-ray data with a greatly reduced data volume to quickly find the defect data, and the method can automatically complete the mapping of defects in the three-dimensional model, reduce the influence of human factors, and improve the construction efficiency of the three-dimensional model with defects.
[0095] A workpiece defect mapping method provided by an embodiment of the present application is introduced above, and a system for executing the above workpiece defect mapping method will be introduced below.
[0096] See also Figure 4 , Figure 4 This is a schematic diagram of the structure of a workpiece defect mapping system provided in an embodiment of the present application. Figure 4 As shown, the workpiece defect mapping system includes:
[0097] The marking unit 100 is used to mark defect points on a plurality of X-ray images of the workpiece obtained by shooting at a plurality of viewing angles at an actual shooting point;
[0098] The position unit 110 is used to determine the position of the virtual shooting point of the three-dimensional model of the workpiece through the position of the actual shooting point, wherein the center points of each virtual image obtained by shooting the three-dimensional model at multiple viewing angles at the virtual shooting point coincide with each mapping center point of the multiple X-ray images mapped onto the three-dimensional model;
[0099] A mapping unit 120, configured to map the marked defect point to a mapping position on the virtual image based on the one-to-one coincidence of the mapping center point and the center point of the virtual image;
[0100] The construction unit 130 is used to determine the virtual defect point position mapped to the three-dimensional model of the workpiece according to the position of the virtual shooting point and the mapping position of the defect point.
[0101] In a possible implementation, the location unit 110 includes:
[0102] A position determination subunit, used to directly determine the position of the actual shooting point as the position of the virtual shooting point;
[0103] The model moving subunit is used to move the three-dimensional model so that the center points of each virtual image obtained by shooting the three-dimensional model at multiple viewing angles at the virtual shooting point coincide with the center points of each mapping mapped to the three-dimensional model by the center points of multiple X-ray images.
[0104] In a possible implementation, the above model mobile subunit is specifically configured as follows:
[0105] Obtain each mapping center point of the X-ray image and each center point of the virtual image, and compare the mapping center points with the center points under the same viewing angle one by one to obtain the difference between multiple center points;
[0106] An objective function is constructed according to the multiple center point gaps, and the movement variables of the three-dimensional model are input into the optimization algorithm as parameters and the objective function for iterative optimization, wherein the movement variables of the three-dimensional model correspond to the coordinates of each mapping center point of the X-ray image after the movement;
[0107] When the objective function takes a minimum value, the target movement variable of the three-dimensional model output by the optimization algorithm is obtained;
[0108] The three-dimensional model is moved according to the target movement variable so that at the virtual shooting point, each mapping center point of the X-ray image coincides with each center point of the virtual image.
[0109] In a possible implementation, the mapping unit 120 is specifically configured as follows:
[0110] If a defect point is marked in the X-ray image, the positional relationship between the defect point and the center point of the X-ray image is obtained;
[0111] According to the positional relationship and the center point of the virtual image, the mapping position of the defect point is determined on the virtual image, and the center point of the virtual image and the mapping center of the X-ray image with the defect point coincide on the three-dimensional model.
[0112] In a possible implementation, the construction unit 130 is specifically configured as follows:
[0113] Constructing a first straight line passing through the virtual shooting point, wherein the first straight line is perpendicular to the plane where the virtual image is located;
[0114] The first straight line is translated so as to pass through the mapping position of the defect point, and a second straight line of the mapping position is obtained;
[0115] The intersection position of the second straight line and the three-dimensional model is calculated, and the intersection position is used as a virtual defect point position mapped on the three-dimensional model by the defect point in the X-ray image.
[0116] In a possible implementation, the workpiece defect mapping system further includes a matrix unit:
[0117] The matrix unit is used to construct a point matrix of a three-dimensional model. In the point matrix, the point values corresponding to the virtual defect point positions are set to 1, and the point values corresponding to the non-virtual defect point positions are set to 0.
[0118] The present application also provides an electronic device in an embodiment. Figure 5 As shown, it shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiment of the present application. The electronic device in the embodiment of the present application may include but is not limited to fixed terminals such as mobile phones, laptops, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, etc. Figure 5 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0119] like Figure 5 As shown, the electronic device may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 to a random access memory (RAM) 503. When the electronic device is powered on, various programs and data required for the operation of the electronic device are also stored in the RAM 503. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0120] Typically, the following devices may be connected to the I / O interface 505: an input device 506 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 508 including, for example, a memory card, a hard disk, etc.; and a communication device 509. The communication device 509 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although Figure 5 An electronic device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0121] An embodiment of the present application also provides a computer program product including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements any one of the workpiece defect mapping methods provided in the embodiments of the present application.
[0122] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any workpiece defect mapping method provided in an embodiment of the present application.
[0123] It should also be noted that the system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the system embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
[0124] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0125] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0126] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.
[0127] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0128] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application.
Claims
1. A workpiece defect mapping method, characterized in that: The workpiece defect mapping method comprises: Marking defect points on multiple X-ray images of the workpiece obtained by shooting at multiple viewing angles at the actual shooting point; Determine the position of a virtual shooting point for shooting the three-dimensional model of the workpiece according to the position of the actual shooting point, wherein the center points of each virtual image obtained by shooting the three-dimensional model at the virtual shooting point with the multiple viewing angles coincide with the center points of each mapping of the multiple X-ray images onto the three-dimensional model; Based on the one-to-one coincidence of the mapping center point and the center point of the virtual image, mapping the marked defect point to a mapping position on the virtual image; According to the position of the virtual shooting point and the mapping position of the defect point, the virtual defect point position where the defect point is mapped to the three-dimensional model of the workpiece is determined.
2. The workpiece defect mapping method according to claim 1, characterized in that: Determining the position of a virtual shooting point for shooting the three-dimensional model of the workpiece by using the position of the actual shooting point includes: Directly determining the position of the actual shooting point as the position of the virtual shooting point; The three-dimensional model is moved so that the center points of each virtual image obtained by shooting the three-dimensional model at the virtual shooting point with the multiple viewing angles coincide with the center points of the mappings of the center points of the multiple X-ray images onto the three-dimensional model.
3. The workpiece defect mapping method according to claim 2, characterized in that: The moving of the three-dimensional model so that the center points of each virtual image obtained by shooting the three-dimensional model at the virtual shooting point with the multiple viewing angles coincide with the center points of each mapping of the center points of the multiple X-ray images onto the three-dimensional model, respectively, comprises: Acquire each mapping center point of the X-ray image and each center point of the virtual image, and compare the mapping center points with the center points one by one under multiple same viewing angles to obtain multiple center point differences; Constructing an objective function according to the multiple center point gaps, and inputting the movement variables of the three-dimensional model as parameters and the objective function into an optimization algorithm for iterative optimization, wherein the movement variables of the three-dimensional model correspond to the coordinates of each mapping center point of the X-ray image after the movement; When the objective function takes a minimum value, obtaining a target movement variable of the three-dimensional model output by the optimization algorithm; The three-dimensional model is moved according to the target movement variable so that at the virtual shooting point, each mapping center point of the X-ray image coincides with each center point of the virtual image one by one.
4. The workpiece defect mapping method according to claim 1, characterized in that: The step of mapping the marked defect point to a mapping position on the virtual image based on the one-to-one coincidence of the mapping center point and the center point of the virtual image comprises: If the defect point is marked in the X-ray image, obtaining a positional relationship between the defect point and a center point of the X-ray image; According to the positional relationship and the center point of the virtual image, the mapping position of the defect point is determined on the virtual image, and the center point of the virtual image and the mapping center of the X-ray image with the defect point coincide with each other on the three-dimensional model.
5. The workpiece defect mapping method according to claim 1, characterized in that: The step of determining the virtual defect point position mapped from the defect point to the three-dimensional model of the workpiece according to the position of the virtual shooting point and the mapping position of the defect point comprises: Constructing a first straight line passing through the virtual shooting point, wherein the first straight line is perpendicular to the plane where the virtual image is located; Translating the first straight line so that it passes through the mapping position of the defect point to obtain a second straight line at the mapping position; The intersection position of the second straight line and the three-dimensional model is calculated, and the intersection position is used as a virtual defect point position mapped onto the three-dimensional model by the defect point in the X-ray image.
6. The workpiece defect mapping method according to claim 1, characterized in that: Also includes: A point matrix of the three-dimensional model is constructed, in which the point values corresponding to the virtual defect point positions are set to 1, and the point values corresponding to the non-virtual defect point positions are set to 0.
7. A workpiece defect mapping system, characterized in that: The workpiece defect mapping system comprises: A marking unit, used for marking defect points on a plurality of X-ray images of a workpiece obtained by shooting at a plurality of viewing angles at an actual shooting point; a position unit, used to determine the position of a virtual shooting point for shooting the three-dimensional model of the workpiece according to the position of the actual shooting point, wherein the center points of each virtual image obtained by shooting the three-dimensional model at the virtual shooting point with the multiple viewing angles coincide with each mapping center point of the multiple X-ray images mapped onto the three-dimensional model; A mapping unit, configured to map the marked defect point to a mapping position on the virtual image based on the one-to-one coincidence of the mapping center point and the center point of the virtual image; A construction unit is used to determine the virtual defect point position mapped to the three-dimensional model of the workpiece according to the position of the virtual shooting point and the mapping position of the defect point.
8. The workpiece defect mapping system according to claim 7, characterized in that: The location unit comprises: A position determination subunit, used to directly determine the position of the actual shooting point as the position of the virtual shooting point; The model moving subunit is used to move the three-dimensional model so that the center points of each virtual image obtained by shooting the three-dimensional model at the virtual shooting point with the multiple viewing angles coincide with the mapping center points of the multiple X-ray images mapped onto the three-dimensional model.
9. An electronic device, characterized in that: The method comprises at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program so that the electronic device can implement the workpiece defect mapping method as described in any one of claims 1 to 6.
10. A computer storage medium, characterized in that: The storage medium carries one or more computer programs, and when the one or more computer programs are executed by an electronic device, the electronic device can implement the workpiece defect mapping method as described in any one of claims 1 to 6.