Three-dimensional intelligent positioning method and system for casting defects based on multi-angle flaw detection images
The three-dimensional intelligent positioning method of casting defects based on multi-angle flaw detection images solves the problem in the existing technology that the positioning of casting defects requires drilling holes, achieves efficient positioning and welding repair of hole-free damage, and improves the quality of castings and equipment performance.
Patent Information
- Application Number
- CN202310399158.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-13
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2043-04-13
AI Technical Summary
Existing X-ray flaw detection technology for light alloy castings requires manual drilling and positioning when locating defects, resulting in low efficiency of casting damage and defect welding repair, affecting casting quality and equipment performance.
A three-dimensional intelligent positioning method for casting defects based on multi-angle flaw detection images is adopted. By determining the three-dimensional model of the casting and the imaging images at different flaw detection angles, the intersection point of the ray and the three-dimensional model is obtained, the polyhedron is drawn, and the intersection is found to locate the defect position to avoid drilling operations.
It is possible to accurately locate casting defects without drilling holes, improve the quality and efficiency of defect welding repair, reduce casting damage, and improve the reliability and economic benefits of castings.
Smart Images

Figure CN116485739B
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of casting product quality inspection, and more specifically, relates to a three-dimensional intelligent positioning method and system for casting defects based on multi-angle flaw detection images. Background Art
[0002] The existing X-ray flaw detection technology for light alloy castings requires manual judgment of the defect position on the three-dimensional casting based on the defect information on the digital radiography (DR) image when locating defects. It may even be necessary to drill holes on the casting to locate the defect, mark it, and then re-shoot it for verification. Because the correspondence between the two-dimensional DR image and the three-dimensional casting is unclear, this method requires repeated drilling to locate the defect, which often damages the casting body and requires subsequent repair welding. Therefore, relying on manual multiple film explorations and multiple drillings to locate the defect site not only damages the casting body but also seriously restricts the quality and efficiency of welding repair of casting defects. The above problems have greatly reduced the quality and reliability of castings, resulting in the design department not daring to use castings, making it impossible to realize some complex structural design ideas, affecting the realization of advanced high-performance equipment design ideas, and even seriously affecting the performance, life and safety of major equipment such as aircraft. Summary of the invention
[0003] In view of the defects of the prior art, the purpose of the present invention is to provide a three-dimensional intelligent positioning method and system for casting defects based on multi-angle flaw detection images, aiming to solve the problem that the prior art requires drilling on the casting when judging the location of casting defects, and the drilling of defects affects the quality of the casting.
[0004] To achieve the above objectives, in a first aspect, the present invention provides a three-dimensional intelligent positioning method for casting defects based on multi-angle flaw detection images, comprising the following steps:
[0005] Determine a three-dimensional model of the casting, wherein the three-dimensional model is composed of a plurality of triangular facets;
[0006] Determine the flaw detection imaging images of the casting product at different flaw detection angles relative to the X-ray source, and extract the contours of the defective areas in the flaw detection imaging images at different angles;
[0007] Taking the ray source as the starting point and the point on the defect contour as the end point, obtain the intersection points of the ray and all the triangular facets on the casting 3D model at the corresponding flaw detection angle, and draw a polyhedron containing all the intersection points;
[0008] The polyhedrons corresponding to the defect contours under all detection angles are intersected to locate the polyhedron corresponding to the defect in the casting product.
[0009] In a possible implementation, the method further includes the following steps:
[0010] Determine a two-dimensional coordinate system; the two-dimensional coordinate system takes the imaging plate as a coordinate plane and the center of the imaging plate as an origin;
[0011] Determine a three-dimensional coordinate system; the three-dimensional coordinate system is used to describe the three-dimensional coordinates of the casting product, the three-dimensional model of the casting, the center of the radiation source, and the center of the imaging plate, with the center of the turntable as the origin, and two of its three coordinate axes are respectively parallel to the two coordinate axes of the above two-dimensional coordinate system; the turntable is used to carry the casting product and rotate the casting product to form different flaw detection angles;
[0012] After obtaining the flaw detection image of the casting product on the imaging plate, the contour point coordinates of the defect on the image in the two-dimensional coordinate system are first determined, and then the contour point coordinates are converted to the three-dimensional coordinate system based on the coordinate relationship between the two-dimensional coordinate system and the three-dimensional coordinate system, so as to determine the intersection of the ray and the three-dimensional model of the casting based on the center coordinates of the ray source, the contour point coordinates, and the three-dimensional model of the casting in the three-dimensional coordinate system.
[0013] In a possible implementation, assume that the three-dimensional coordinate system Axis and 2D coordinate system x Axis parallel, z Axis and 2D coordinate system Axis parallel;
[0014] Suppose the normal vector of the imaging plate plane in the three-dimensional coordinate system is =(a, b, c), coordinates of the center of the imaging plate ( , , ), the coordinates of the center of the ray source ( , , ), turntable center coordinates ;
[0015] Through the center of the imaging plate and perpendicular to the normal vector of the imaging plate The imaging plate plane expression is: ; Turntable center Distance to imaging plate plane: ;
[0016] Combine the coordinate relationship between the two-dimensional coordinate system and the three-dimensional coordinate system to transform the contour point coordinates into the three-dimensional coordinate system, specifically:
[0017] If the coordinates of the defect contour point in the two-dimensional coordinate system are ( , ), then its coordinates in the three-dimensional coordinate system are ( , , ),in: , , .
[0018] In a possible implementation, the contour of the defect area in the flaw detection imaging image is extracted as follows:
[0019] Grayscale the flaw detection image to obtain a grayscale image;
[0020] The grayscale image is processed with median filtering, binarization, opening and closing operations in sequence, and then a function is used to query the contour of the defect area and draw a series of contour points.
[0021] In a possible implementation, the intersection points of the ray and all triangular facets on the three-dimensional model of the casting are obtained, and a polyhedron containing all the intersection points is drawn, specifically:
[0022] Use the ray_trace function in the pyvista library to obtain a series of intersection points between the ray and the triangular facets of the stl format casting 3D model file;
[0023] The boundary points of the series of intersections are detected by the alpha shapes algorithm, and a polyhedron including all the intersection points of the triangles is drawn according to the boundary points.
[0024] In a second aspect, the present invention provides a three-dimensional intelligent positioning system for casting defects based on multi-angle flaw detection images, comprising:
[0025] A model determination unit, used to determine a three-dimensional model of a casting, wherein the three-dimensional model is composed of a plurality of triangular facets;
[0026] The flaw detection image determination unit is used to determine the flaw detection imaging image of the casting product at different flaw detection angles relative to the radiation source, and to extract the contour of the defect area in the flaw detection imaging image at different angles;
[0027] The polyhedron drawing unit is used to take the ray source as the starting point and the point on the defect contour as the end point, obtain the intersection points of the ray and all the triangular facets on the casting three-dimensional model at the corresponding flaw detection angle, and draw a polyhedron containing all the intersection points;
[0028] The defect location unit is used to intersect the polyhedrons corresponding to the defect contours under all detection angles, and locate the polyhedron corresponding to the defect in the casting product.
[0029] In a possible implementation, the system further includes:
[0030] A coordinate system determination unit is used to determine a two-dimensional coordinate system; the two-dimensional coordinate system uses the imaging plate as a coordinate plane and the center of the imaging plate as an origin; and to determine a three-dimensional coordinate system; the three-dimensional coordinate system is used to describe the three-dimensional coordinates of the casting product, the three-dimensional model of the casting, the center of the ray source, and the center of the imaging plate, and uses the center of the turntable as an origin, and two of its three coordinate axes are respectively parallel to the two coordinate axes of the two-dimensional coordinate system; the turntable is used to carry the casting product and rotate the casting product to form different flaw detection angles;
[0031] The coordinate processing unit is used to first determine the contour point coordinates of the defect on the image in the two-dimensional coordinate system after acquiring the flaw detection image of the casting product on the imaging plate, and then convert the contour point coordinates into the three-dimensional coordinate system based on the coordinate relationship between the two-dimensional coordinate system and the three-dimensional coordinate system, so as to determine the intersection of the ray and the three-dimensional model of the casting based on the center coordinates of the ray source, the contour point coordinates, and the three-dimensional model of the casting in the three-dimensional coordinate system.
[0032] In a possible implementation, assume that the three-dimensional coordinate system Axis and 2D coordinate system x Axis parallel, z Axis and 2D coordinate system Axis parallel;
[0033] Suppose the normal vector of the imaging plate plane in the three-dimensional coordinate system is =(a, b, c), coordinates of the center of the imaging plate ( , , ), the coordinates of the center of the ray source ( , , ), turntable center coordinates ;
[0034] Through the center of the imaging plate and perpendicular to the normal vector of the imaging plate The imaging plate plane expression is: ; Turntable center Distance to imaging plate plane: ;
[0035] The coordinate processing unit converts the coordinates of the contour point into the three-dimensional coordinate system by combining the coordinate relationship between the two-dimensional coordinate system and the three-dimensional coordinate system. Specifically, if the coordinates of the defect contour point in the two-dimensional coordinate system are ( , ), then its coordinates in the three-dimensional coordinate system are ( , , ),in: , , .
[0036] In a third aspect, the present invention provides an electronic device comprising: at least one memory for storing programs; and at least one processor for executing the programs stored in the memory, wherein when the programs stored in the memory are executed, the processor is used to execute the method described in the first aspect or any possible implementation manner of the first aspect.
[0037] In a fourth aspect, the present invention provides a computer-readable storage medium storing a computer program. When the computer program runs on a processor, the processor executes the method described in the first aspect or any possible implementation of the first aspect.
[0038] In a fifth aspect, the present invention provides a computer program product. When the computer program product runs on a processor, the processor executes the method described in the first aspect or any possible implementation manner of the first aspect.
[0039] In general, the above technical solution conceived by the present invention has the following beneficial effects compared with the prior art:
[0040] The present invention provides a three-dimensional intelligent positioning method and system for casting defects based on multi-angle flaw detection images, establishes a conversion relationship between projected two-dimensional coordinates and world three-dimensional coordinates, and can determine the three-dimensional coordinates of defects in castings according to the two-dimensional coordinates of defects in flaw detection images.
[0041] The present invention provides a three-dimensional intelligent positioning method and system for casting defects based on multi-angle flaw detection images. The three-dimensional positioning and characterization of casting defects can be achieved by simulating actual DR flaw detection. The defective area of the casting can be detected without drilling the casting, which greatly improves the economic benefits compared with the existing CT technology.
[0042] The present invention provides a three-dimensional intelligent positioning method and system for casting defects based on multi-angle flaw detection images. A large number of polyhedrons containing defects are obtained by multi-angle simulation of actual flaw detection. After the intersection of these polyhedrons is calculated, highly reliable three-dimensional positioning of casting defects is achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 It is a flow chart of a three-dimensional intelligent positioning method for casting defects based on multi-angle flaw detection images provided by an embodiment of the present invention;
[0044] Figure 2 is a schematic diagram of establishing and transforming a coordinate system provided by an embodiment of the present invention;
[0045] Figure 3 is a schematic diagram of defect contour extraction provided by an embodiment of the present invention;
[0046] Figure 4 is a schematic diagram of multi-angle flaw detection provided by an embodiment of the present invention;
[0047] Figure 5 This is an architecture diagram of a three-dimensional intelligent positioning system for casting defects based on multi-angle flaw detection images provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0049] In the embodiments of the present invention, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present invention should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0050] In the description of the embodiments of the present invention, unless otherwise specified, “plurality” means two or more than two. For example, a plurality of polyhedrons means two or more than two polyhedrons, and a plurality of intersections means two or more than two intersections.
[0051] Next, the technical solution provided in the embodiments of the present invention is introduced.
[0052] Figure 1 is a flow chart of a three-dimensional intelligent positioning method for casting defects based on multi-angle flaw detection images provided by an embodiment of the present invention; Figure 1 As shown, the following steps are included:
[0053] S101, determining a three-dimensional model of a casting, wherein the three-dimensional model is composed of a plurality of triangular facets;
[0054] S102, determining the flaw detection imaging images of the casting product at different flaw detection angles relative to the radiation source, and extracting the contours of the defective areas in the flaw detection imaging images at different angles;
[0055] S103, taking the ray source as the starting point and the point on the defect contour as the end point, obtaining the intersection points of the ray and all the triangular facets on the three-dimensional model of the casting at the corresponding flaw detection angle, and drawing a polyhedron containing all the intersection points;
[0056] S104, intersecting the polyhedrons corresponding to the defect contours at all flaw detection angles, and locating the polyhedron corresponding to the defect in the casting product.
[0057] In a specific example, the method provided by the embodiment of the present invention specifically includes the following steps:
[0058] 1. Acquisition of flaw detection parameters: After adjusting the radiation source, casting, and imaging plate on the actual X-ray flaw detection equipment, the relative position and angle relationship of the radiation source, casting, and imaging plate are output according to the real-time sensor on the flaw detection equipment.
[0059] 2. Coordinate system establishment, such as Figure 2 The specific method is as follows:
[0060] a. Establish the image coordinate system: take the center of the imaging plate as the origin, the x-axis is in the horizontal direction, and the right is positive. The axis is in the vertical direction, with upward being positive;
[0061] b. Establish the world coordinate system: take the center of the turntable as the origin, The axis is parallel to the x-axis of the image coordinate system, and the z-axis is parallel to the image coordinate system The axes are parallel, and the x-axis can be determined according to the right-hand rule of the coordinate system;
[0062] c. Given the conditions in the world coordinate system: the normal vector of the imaging plate plane =(a, b, c), coordinates of the center of the imaging plate ( , , ), the coordinates of the center of the ray source ( , , ), turntable center coordinates ;
[0063] d. Given the conditions in the image coordinate system: the coordinates of a defect contour point A ( , ).
[0064] 3. Defect contour extraction, such as Figure 3 As shown in the figure, the flaw detection image is first grayed out, and then the grayscale image is subjected to median filtering. Then, the defect area is further highlighted through the binarization operation, and then the small interference blocks in the binary image are deleted through the opening operation and the hole area in the binary image is filled through the closing operation. Finally, the defect contour of the binary image is retrieved and output in the form of a series of two-dimensional coordinates of the contour points.
[0065] 4. Coordinate system conversion to complete the two-dimensional coordinates of the defect contour point ( , ) to world 3D coordinates ( , , )
[0066] a. Calculate the value passing through the center of the imaging plate and perpendicular to the normal vector of the imaging plate The imaging plate plane expression is: .
[0067] b. Calculate the center of the turntable Distance to imaging plate plane: .
[0068] c. Available , , .
[0069] 5. Ray intersection, the coordinates of the center of the ray source ( , , ) as the starting point of the ray, the three-dimensional coordinates of the defect contour point ( , , ) as the end point of the ray, and obtain a series of intersection points between the ray and the triangular facets of the defect-free stl format model file.
[0070] 6. Defect location selection: First, the boundary points of a series of intersections are detected through the algorithm, and a polyhedron containing all intersections is drawn based on the boundary points to obtain the preliminary defect location range.
[0071] 7. Multi-angle imaging: rotate the turntable to a certain angle, and perform steps 1 to 6 for each angle until the turntable rotates a full circle. This step can obtain a series of polyhedrons. Figure 4 As shown, the flaw detection images obtained at different flaw detection angles may be different, and the corresponding polyhedrons are placed at different positions, and each polyhedron contains a defect area.
[0072] 8. Polyhedron intersection: take the intersection of a series of obtained polyhedrons to obtain a new polyhedron, which represents the three-dimensional position of the defect in the model.
[0073] It can be understood that, in theory, the more polyhedrons there are, the more accurately the defect area reflected by their intersection.
[0074] Figure 5 is an architecture diagram of a casting defect three-dimensional intelligent positioning system based on multi-angle flaw detection images provided by an embodiment of the present invention, such as Figure 5 As shown, including:
[0075] A model determination unit 510 is used to determine a three-dimensional model of a casting, wherein the three-dimensional model is composed of a plurality of triangular facets;
[0076] The flaw detection image determination unit 520 is used to determine the flaw detection imaging image of the casting product at different flaw detection angles relative to the radiation source, and extract the contour of the defect area in the flaw detection imaging image at different angles;
[0077] The polyhedron drawing unit 530 is used to obtain the intersection points of the ray and all the triangular facets on the casting three-dimensional model at the corresponding flaw detection angle, with the ray source as the starting point and the point on the defect contour as the end point, and draw a polyhedron containing all the intersection points;
[0078] The defect location unit 540 is used to intersect the polyhedrons corresponding to the defect contours under all the flaw detection angles, and locate the polyhedron corresponding to the defect in the casting product;
[0079] A coordinate system determination unit 550 is used to determine a two-dimensional coordinate system; the two-dimensional coordinate system uses the imaging plate as a coordinate plane and the center of the imaging plate as an origin; and to determine a three-dimensional coordinate system; the three-dimensional coordinate system is used to describe the three-dimensional coordinates of the casting product, the three-dimensional model of the casting, the center of the ray source, and the center of the imaging plate, and uses the center of the turntable as an origin, and two of its three coordinate axes are parallel to the two coordinate axes of the two-dimensional coordinate system; the turntable is used to carry the casting product and rotate the casting product to form different flaw detection angles;
[0080] The coordinate processing unit 560 is used to first determine the contour point coordinates of the defect on the image in the two-dimensional coordinate system after acquiring the flaw detection image of the casting product on the imaging plate, and then convert the contour point coordinates into the three-dimensional coordinate system based on the coordinate relationship between the two-dimensional coordinate system and the three-dimensional coordinate system, so as to determine the intersection of the ray and the three-dimensional model of the casting based on the center coordinates of the ray source, the contour point coordinates, and the three-dimensional model of the casting in the three-dimensional coordinate system.
[0081] It should be understood that the above-mentioned device is used to execute the method in the above-mentioned embodiment. The implementation principle and technical effect of the corresponding program module in the device are similar to those described in the above-mentioned method. The working process of the device can refer to the corresponding process in the above-mentioned method, which will not be repeated here.
[0082] Based on the method in the above embodiment, an embodiment of the present invention provides an electronic device. The device may include: at least one memory for storing programs and at least one processor for executing the programs stored in the memory. When the program stored in the memory is executed, the processor is used to execute the method described in the above embodiment.
[0083] Based on the method in the above embodiment, an embodiment of the present invention provides a computer-readable storage medium, which stores a computer program. When the computer program runs on a processor, the processor executes the method in the above embodiment.
[0084] Based on the method in the above embodiment, an embodiment of the present invention provides a computer program product. When the computer program product runs on a processor, the processor executes the method in the above embodiment.
[0085] It is understandable that the processor in the embodiments of the present invention may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. The general-purpose processor may be a microprocessor or any conventional processor.
[0086] The method steps in the embodiments of the present invention can be implemented by hardware or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, and the software modules can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, mobile hard disks, CD-ROMs, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC.
[0087] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. 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 invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium. The computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can 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 disk (SSD)), etc.
[0088] It should be understood that the various numerical numbers involved in the embodiments of the present invention are only used for the convenience of description and are not used to limit the scope of the embodiments of the present invention.
[0089] It will be easily understood by those skilled in the art that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A three-dimensional intelligent positioning method for casting defects based on multi-angle flaw detection images, characterized in that: The following steps are involved: Determine a three-dimensional model of the casting, wherein the three-dimensional model is composed of a plurality of triangular facets; Determine the flaw detection imaging images of the casting product at different flaw detection angles relative to the X-ray source, and extract the contours of the defective areas in the flaw detection imaging images at different angles; Taking the ray source as the starting point and the point on the defect contour as the end point, obtain the intersection points of the ray and all the triangular facets on the casting 3D model at the corresponding flaw detection angle, and draw a polyhedron containing all the intersection points; The polyhedrons corresponding to the defect contours under all detection angles are intersected to locate the polyhedron corresponding to the defect in the casting product; Determine a two-dimensional coordinate system; the two-dimensional coordinate system takes the imaging plate as a coordinate plane and the center of the imaging plate as an origin; Determine a three-dimensional coordinate system; the three-dimensional coordinate system is used to describe the three-dimensional coordinates of the casting product, the three-dimensional model of the casting, the center of the radiation source, and the center of the imaging plate, with the center of the turntable as the origin, and two of its three coordinate axes are respectively parallel to the two coordinate axes of the above two-dimensional coordinate system; the turntable is used to carry the casting product and rotate the casting product to form different flaw detection angles; After obtaining the flaw detection image of the casting product on the imaging plate, first determine the contour point coordinates of the defect on the image in the two-dimensional coordinate system, and then convert the contour point coordinates into the three-dimensional coordinate system in combination with the coordinate relationship between the two-dimensional coordinate system and the three-dimensional coordinate system, so as to determine the intersection of the ray and the three-dimensional model of the casting based on the center coordinates of the ray source, the contour point coordinates, and the three-dimensional model of the casting in the three-dimensional coordinate system; Assume a three-dimensional coordinate system Axis and 2D coordinate system x Axis parallel, z Axis and 2D coordinate system Axis parallel; Suppose the normal vector of the imaging plate plane in the three-dimensional coordinate system is =(a, b, c), coordinates of the center of the imaging plate ( , , ), the coordinates of the center of the ray source ( , , ), turntable center coordinates ; Through the center of the imaging plate and perpendicular to the normal vector of the imaging plate The imaging plate plane expression is: ; Turntable center Distance to imaging plate plane: ; Combine the coordinate relationship between the two-dimensional coordinate system and the three-dimensional coordinate system to transform the contour point coordinates into the three-dimensional coordinate system, specifically: If the coordinates of the defect contour point in the two-dimensional coordinate system are ( , ), then its coordinates in the three-dimensional coordinate system are ( , , ),in: , , .
2. The method according to claim 1, characterized in that Extract the contour of the defect area in the flaw detection imaging image, specifically: Grayscale the flaw detection image to obtain a grayscale image; The grayscale image is processed with median filtering, binarization, opening and closing operations in sequence, and then a function is used to query the contour of the defect area and draw a series of contour points.
3. The method according to claim 1, characterized in that Get the intersection points of the ray and all triangular facets on the casting 3D model, and draw a polyhedron containing all the intersection points, specifically: Use the ray_trace function in the pyvista library to obtain a series of intersection points between the ray and the triangular facets of the stl format casting 3D model file; The boundary points of the series of intersections are detected by the alpha shapes algorithm, and a polyhedron including all the intersection points of the triangles is drawn according to the boundary points.
4. A three-dimensional intelligent positioning system for casting defects based on multi-angle flaw detection images, characterized in that: include: A model determination unit, used to determine a three-dimensional model of a casting, wherein the three-dimensional model is composed of a plurality of triangular facets; The flaw detection image determination unit is used to determine the flaw detection imaging image of the casting product at different flaw detection angles relative to the radiation source, and to extract the contour of the defect area in the flaw detection imaging image at different angles; The polyhedron drawing unit is used to take the ray source as the starting point and the point on the defect contour as the end point, obtain the intersection points of the ray and all the triangular facets on the casting three-dimensional model at the corresponding flaw detection angle, and draw a polyhedron containing all the intersection points; The defect location unit is used to intersect the polyhedrons corresponding to the defect contours under all detection angles, and locate the polyhedron corresponding to the defect in the casting product; A coordinate system determination unit, used to determine a two-dimensional coordinate system; the two-dimensional coordinate system takes the imaging plate as a coordinate plane and the center of the imaging plate as an origin; and determining a three-dimensional coordinate system; the three-dimensional coordinate system is used to describe the three-dimensional coordinates of the casting product, the three-dimensional model of the casting, the center of the radiation source, and the center of the imaging plate, with the center of the turntable as the origin, and two of its three coordinate axes are respectively parallel to the two coordinate axes of the above two-dimensional coordinate system; the turntable is used to carry the casting product and rotate the casting product to form different flaw detection angles; A coordinate processing unit is used to determine the contour point coordinates of the defect on the image in the two-dimensional coordinate system after acquiring the flaw detection image of the casting product on the imaging plate, and then convert the contour point coordinates into the three-dimensional coordinate system based on the coordinate relationship between the two-dimensional coordinate system and the three-dimensional coordinate system, so as to determine the intersection point between the ray and the three-dimensional model of the casting based on the center coordinates of the ray source, the contour point coordinates, and the three-dimensional model of the casting in the three-dimensional coordinate system; Assume a three-dimensional coordinate system Axis and 2D coordinate system x Axis parallel, z Axis and 2D coordinate system Axis parallel; Suppose the normal vector of the imaging plate plane in the three-dimensional coordinate system is =(a, b, c), coordinates of the center of the imaging plate ( , , ), the coordinates of the center of the ray source ( , , ), turntable center coordinates ; Through the center of the imaging plate and perpendicular to the normal vector of the imaging plate The imaging plate plane expression is: ; Turntable center Distance to imaging plate plane: ; The coordinate processing unit converts the coordinates of the contour point into the three-dimensional coordinate system by combining the coordinate relationship between the two-dimensional coordinate system and the three-dimensional coordinate system. Specifically, if the coordinates of the defect contour point in the two-dimensional coordinate system are ( , ), then its coordinates in the three-dimensional coordinate system are ( , , ),in: , , .
5. An electronic device, characterized in that: include: at least one memory for storing a program; At least one processor is used to execute the program stored in the memory. When the program stored in the memory is executed, the processor is used to execute the method according to any one of claims 1 to 3.
6. A computer-readable storage medium storing a computer program, characterized in that: When the computer program runs on a processor, the processor is caused to execute the method according to any one of claims 1 to 3.
