A cast virtual radiographic image generation method, device and electronic equipment

By generating virtual flaw detection images of castings through a simulated X-ray imaging process, the problems of accuracy in detecting internal defects in castings and insufficient training of deep learning models are solved, thus achieving efficient identification and detection of casting defects.

CN116468850BActive Publication Date: 2026-06-09HUAZHONG UNIV OF SCI & TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HUAZHONG UNIV OF SCI & TECH
Filing Date
2023-03-28
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

In existing technologies, it is difficult to accurately and efficiently determine the internal defects of castings through non-destructive testing, resulting in poor quality, high cost, and long cycle time for precision castings. Furthermore, deep learning methods are limited by the insufficient number of real defect samples.

Method used

By establishing a method for generating virtual radiographic images of castings, the relative positions and angles of the X-ray source, imaging plate, and casting are used to simulate the X-ray imaging process, generate diverse virtual radiographic images, establish the transformation relationship between the three-dimensional coordinates of the casting world and the projected two-dimensional coordinates, extract the thickness information of the radiographic images, and generate high-quality virtual radiographic images.

Benefits of technology

It improves the accuracy of deep learning models, enabling precise classification of casting defects. The generated virtual flaw detection images are highly reliable, support deep learning model training, and achieve accurate detection of internal defects in castings.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116468850B_ABST
    Figure CN116468850B_ABST
Patent Text Reader

Abstract

The application provides a cast virtual radiographic image generation method and device and electronic equipment, the application simulates the X-ray photographing process according to the relative position and angle relationship among the X-ray source, the cast and the imaging plate, can obtain the virtual radiographic image of the key part of the cast, establishes the conversion relationship between the three-dimensional coordinates of the cast world and the two-dimensional coordinates of the projection, can determine the three-dimensional coordinates of the defect in the cast according to the two-dimensional coordinates of the defect in the radiographic image, and generates the virtual radiographic image according to the extracted radiographic thickness information and the radiographic distance. The virtual radiographic image generated by the application can be used for training the deep learning model for detecting the internal defects of the precision cast, the radiographic thickness information is extracted by using the point cloud on the basis of the radiographic point light source imaging, only the distance between the point clouds through which the X-ray passes needs to be calculated, and theoretically, as long as the point cloud is dense enough, the radiographic thickness information can be correctly extracted at any angle, and the precision of the virtual radiographic image generation is high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of casting flaw detection, and more specifically, relates to a method, apparatus and electronic device for generating virtual radiographic flaw detection images of castings. Background Technology

[0002] As the requirements for lightweight, integrated, high-quality, low-cost, and short-cycle manufacturing of components in advanced core equipment in the defense field continue to increase, components such as casings, bearing housings, diffusers, and vertical tail supports are developing towards more complex structures, such as large wall thickness differences, multiple intersecting structures, multiple rings, curved surfaces, blind holes, and complex internal cavities. Precision casting technology, due to its near-net-shape forming advantage for complex structures, has become one of the key forming technologies for manufacturing components of advanced and important weaponry. However, the increasing complexity of component structures not only increases the difficulty of precision casting forming and internal quality control, but also makes the non-destructive testing of internal defects in precision castings more challenging. The difficulty in accurately and efficiently identifying and removing internal defects in precision castings has become one of the main reasons for poor quality, high cost, and long cycle times in precision castings, and a major bottleneck severely restricting the improvement of equipment reliability and lifespan.

[0003] With the rapid development of digital image processing, machine learning, and deep learning, and the continuous improvement of hardware performance such as digital image acquisition equipment and graphics processors, computer vision has made automatic identification of internal defects in precision castings based on digital X-ray images highly feasible. The number of defect images directly affects the performance of data-driven automatic identification methods for internal defects in precision castings. However, the number of real defect samples from actual production is limited, which to some extent restricts the performance of data-driven deep learning methods. Defect image simulation generation is crucial for expanding the number of defect images. Although image augmentation techniques based on image processing (rotation, grayscale transformation, affine transformation) can increase the number of defect images to some extent, the new images are the result of image transformations in the dataset. Therefore, it is necessary to construct a model that can generate high-quality defect images to provide new usable samples for data-driven defect identification technology. Summary of the Invention

[0004] To address the shortcomings of existing technologies, the present invention aims to provide a method, apparatus, and electronic device for generating virtual radiographic flaw detection images of castings. This invention addresses the problem that the limited number of real defect samples from actual production castings restricts the performance of data-driven deep learning methods in the automatic identification of internal defects in castings.

[0005] To achieve the above objectives, in a first aspect, the present invention provides a method for generating virtual radiographic flaw detection images of castings, comprising the following steps:

[0006] A two-dimensional coordinate system, a first three-dimensional coordinate system, and a second three-dimensional coordinate system are defined. The two-dimensional coordinate system has its origin at the center of the imaging plate, with the x-axis along the horizontal direction of the imaging plate and the y-axis along the vertical direction. The first three-dimensional coordinate system has its origin at the center of the turntable, with its y-axis parallel to the x-axis of the two-dimensional coordinate system and its z-axis parallel to the y-axis of the two-dimensional coordinate system. The x-axis is determined according to the right-hand rule of the three-dimensional coordinate system. The second three-dimensional coordinate system has its origin at the center of the X-ray source, with its x-axis and y-axis parallel to the x-axis and y-axis of the two-dimensional coordinate system, respectively. The z-axis is determined according to the right-hand rule of the three-dimensional coordinate system. The X-ray source and the imaging plate are used for flaw detection imaging of the casting, and the turntable is placed between the X-ray source and the imaging plate to support the casting.

[0007] A three-dimensional point cloud model of the casting is determined. If the three-dimensional point cloud model of the casting is placed on a turntable, the coordinates of each point on the three-dimensional point cloud model in the first three-dimensional coordinate system are determined.

[0008] Based on the plane normal vector of the imaging plate in the first three-dimensional coordinate system, the coordinates of the center of the imaging plate, the coordinates of the center of the ray source, and the coordinates of each point on the three-dimensional point cloud model, the first distance from the center of the imaging plate to the ray source plane, the second distance from each point on the three-dimensional point cloud model to the ray source plane, and the coordinates of the first projection point obtained by perpendicularly projecting each point on the three-dimensional point cloud model onto the ray source plane are first calculated. Then, based on the pinhole imaging principle, the coordinates of the second projection point left on the imaging plate after the ray originating from the center of the ray source passes through each point on the three-dimensional point cloud model are calculated using the coordinates of the first projection point, the first distance, and the second distance. The ray source plane refers to the plane with z=0 in the second three-dimensional coordinate system.

[0009] Determine the coordinates of each point on the 3D model in the first 3D coordinate system and the coordinates of the second projection point in the 2D coordinate system. Iterate through all the obtained second projection point coordinates. If a second projection point is repeated more than once, sort the corresponding coordinates in the first 3D coordinate system in ascending order of z-coordinate value. If the z-coordinates are the same, sort them in ascending order of x-coordinate value. Then calculate the distance between adjacent coordinates after sorting to obtain multiple distance values.

[0010] The data smoothing method is used to discard the distances that were not passed through by the ray among the multiple distance values, and the remaining distance values ​​are summed to obtain the thickness value of the casting through which the ray passes at the second projection point.

[0011] A virtual flaw detection image corresponding to the three-dimensional point cloud model is generated based on the casting thickness value corresponding to the coordinates of each second projection point and the distance between the X-ray source and the imaging plate.

[0012] In one possible implementation, the method of discarding the distances that were not traversed by the ray from the plurality of distance values ​​using a data smoothing process specifically involves:

[0013] Calculate the average of the first and second distance values ​​among multiple distance values;

[0014] Starting from the third distance value, the ratio of the third distance value to the average value is calculated. If the ratio is within a preset range, the third distance value is retained, and the previous average value is adjusted to the average of all retained distance values. If the ratio is not within the preset range, the third distance value is discarded.

[0015] Then, each distance value is compared with the current average value. If the ratio is not within the preset range, it is discarded and the previous average value remains unchanged; otherwise, it is retained and the previous average value is updated. In the three-dimensional point cloud model, if there are no holes or gaps, the distance values ​​between points are relatively uniform. If there are holes or gaps, the distance between any two points in the hole or gap is relatively large compared to the distance between any two points in the non-hole or gap area of ​​the three-dimensional model.

[0016] In one possible implementation, let the normal vector of the imaging plate plane in the first three-dimensional coordinate system be... The center coordinate of the imaging plate is O i (x i ,y i ,z i The coordinates of the center of the radiation source are O. r (x r ,y r ,z r The coordinates of a point A on the casting are (x1, y1, z1).

[0017] The calculation of the second distance from each point on the 3D point cloud model to the ray source plane and the coordinates of the first projection point obtained by perpendicularly projecting each point on the 3D point cloud model onto the ray source plane are specifically as follows:

[0018] Determined to pass through the center of the radiation source O r and perpendicular to the imaging plate normal vector The expression for the ray source plane is: ax + by + cz - ax r -by r -cz r =0;

[0019] Calculate the second distance from point A to the plane of the ray source.

[0020] Calculate the coordinates of point A projected perpendicularly onto the first projection point A′ on the ray source plane in the first three-dimensional coordinate system:

[0021]

[0022]

[0023]

[0024] We obtain the coordinates (x2, y2, z2) of point A in the second three-dimensional coordinate system, where x2 = y′1 - y′2. r y2=z′1-z r .

[0025] In one possible implementation, the calculation of the first distance from the center of the imaging plate to the X-ray source plane, and the calculation of the coordinates of the second projection point left on the imaging plate after the ray originating from the center of the X-ray source passes through each point on the three-dimensional point cloud model, based on the coordinates of the first projection point, the first distance, and the second distance according to the pinhole imaging principle, specifically involves:

[0026] Computational imaging plate center O i First distance to the plane of the radiation source

[0027] The calculation yields the result passing through the center O of the imaging plate. i and perpendicular to the imaging plate normal vector The image plate plane expression is: ax + by + cz - ax i -by i -cz i =0;

[0028] Let the coordinates of the second projection point of point A in the second three-dimensional coordinate system be (x′2, y′2, f). By the similar triangle theorem in the pinhole imaging principle, we can obtain:

[0029] After simplification, we get:

[0030] Computational imaging plate center O i Point O′ projected vertically onto the plane of the ray source i coordinate:

[0031]

[0032]

[0033]

[0034] Obtain the coordinates (x3, y3) of the second projection point of point A in the two-dimensional coordinate system; where x3 = x′2 - (y′2) / 2. i -y r ), y3=y′2-(z′ i -z r ).

[0035] Secondly, the present invention provides a device for generating virtual radiographic images of castings, comprising:

[0036] A coordinate system determination unit is used to determine a two-dimensional coordinate system, a first three-dimensional coordinate system, and a second three-dimensional coordinate system. The two-dimensional coordinate system has its origin at the center of the imaging plate, with the x-axis along the horizontal direction of the imaging plate and the y-axis along the vertical direction. The first three-dimensional coordinate system has its origin at the center of the turntable, with its y-axis parallel to the x-axis of the two-dimensional coordinate system and its z-axis parallel to the y-axis of the two-dimensional coordinate system. The x-axis is determined according to the right-hand rule of the three-dimensional coordinate system. The second three-dimensional coordinate system has its origin at the center of the X-ray source, with its x-axis and y-axis parallel to the x-axis and y-axis of the two-dimensional coordinate system, respectively. The z-axis is determined according to the right-hand rule of the three-dimensional coordinate system. The X-ray source and the imaging plate are used for flaw detection imaging of the casting, and the turntable is placed between the X-ray source and the imaging plate to support the casting.

[0037] The casting model determination unit is used to determine the three-dimensional point cloud model of the casting. When the three-dimensional point cloud model of the casting is placed on a turntable, the coordinates of each point on the three-dimensional point cloud model in the first three-dimensional coordinate system are determined.

[0038] The X-ray flaw detection projection unit is used to calculate the first distance from the center of the imaging plate to the X-ray source plane, the second distance from each point on the three-dimensional point cloud model to the X-ray source plane, and the coordinates of the first projection point obtained by projecting each point on the three-dimensional point cloud model perpendicularly onto the X-ray source plane, based on the plane normal vector of the imaging plate in the first three-dimensional coordinate system, the coordinates of the center of the imaging plate, the coordinates of the X-ray source center, the coordinates of the first projection point obtained by projecting each point on the three-dimensional point cloud model perpendicularly onto the X-ray source plane, and then, based on the pinhole imaging principle, calculate the coordinates of the second projection point left on the imaging plate after the X-ray originates from the X-ray source center passes through each point on the three-dimensional point cloud model, based on the coordinates of the first projection point and the first and second distances; wherein, the X-ray source plane refers to the plane z=0 in the second three-dimensional coordinate system;

[0039] The flaw detection image generation unit is used to determine the coordinates of each point on the 3D model in the first 3D coordinate system and the coordinates of the second projection point in the 2D coordinate system. It iterates through all the obtained second projection point coordinates. If a second projection point is repeated more than once, the corresponding coordinates in the first 3D coordinate system are sorted in ascending order of z-coordinate value. If the z-coordinates are the same, they are sorted in ascending order of x-coordinate value. Then, the distance between adjacent coordinates after sorting is calculated in turn to obtain multiple distance values. The data smoothing method is used to discard the distances that are not penetrated by the ray in the multiple distance values. The remaining distance values ​​are summed to obtain the thickness value of the casting through which the ray passes for the second projection point. And a virtual flaw detection image corresponding to the 3D point cloud model is generated according to the casting thickness value corresponding to each second projection point coordinate and the distance between the ray source and the imaging plate.

[0040] In one possible implementation, the flaw detection image generation unit uses a data smoothing method to discard distances that were not penetrated by rays among the multiple distance values. Specifically, it calculates the average of the first and second distance values ​​among the multiple distance values; starting from the third distance value, it calculates the ratio of the third distance value to the average value. If the ratio is within a preset range, the third distance value is retained, and the previous average value is adjusted to the average of all retained distance values; if the ratio is not within the preset range, the third distance value is discarded; then, each distance value is compared with the current average value. If the ratio is not within the preset range, it is discarded, and the previous average value remains unchanged; otherwise, it is retained, and the previous average value is updated. Wherein, if there are no holes or gaps in the three-dimensional point cloud model, the distance values ​​between points are relatively uniform; if there are holes or gaps, the distance between any two points in the hole or gap is significantly different from the distance between any two points in the non-hole or gap region of the three-dimensional model.

[0041] In one possible implementation, let the normal vector of the imaging plate plane in the first three-dimensional coordinate system be... The center coordinate of the imaging plate is O i (x i ,y i ,z i The coordinates of the center of the radiation source are O. r (x r ,y r ,z r The coordinates of a point A on the casting are (x1, y1, z1).

[0042] The X-ray inspection projection unit calculates the second distance from each point on the 3D point cloud model to the X-ray source plane and the coordinates of the first projection point obtained by perpendicularly projecting each point on the 3D point cloud model onto the X-ray source plane. Specifically, it determines the coordinates of the first projection point obtained by perpendicularly projecting each point on the 3D point cloud model onto the X-ray source plane, passing through the X-ray source center O. r and perpendicular to the imaging plate normal vector The expression for the ray source plane is: ax + by + cz - ax r -by r -cz r =0; Calculate the second distance from point A to the plane of the ray source. Calculate the coordinates of point A projected perpendicularly onto the first projection point A′ on the ray source plane in the first three-dimensional coordinate system: We obtain the coordinates (x2, y2, z2) of point A in the second three-dimensional coordinate system, where x2 = y′1 - y′2. r y2=z′1-z r .

[0043] In one possible implementation, the X-ray flaw detection projection unit calculates a first distance from the center of the imaging plate to the X-ray source plane, and calculates the coordinates of a second projection point left on the imaging plate after the ray originating from the X-ray source center passes through each point on the three-dimensional point cloud model, based on the coordinates of the first projection point, the first distance, and the second distance, according to the pinhole imaging principle. Specifically, it calculates the coordinates of the second projection point left on the imaging plate after the ray passes through each point on the three-dimensional point cloud model, according to the coordinates of the first projection point, the first distance, and the second distance. i First distance to the plane of the radiation source The calculation yields the result passing through the center O of the imaging plate. i and perpendicular to the imaging plate normal vector The image plate plane expression is: ax + by + cz - ax i -by i -cz i =0; Let the coordinates of the second projection point of point A in the second three-dimensional coordinate system be (x′2, y′2, f). By the similar triangle theorem in the pinhole imaging principle, we can obtain: After simplification, we get: Computational imaging plate center O i Point O′ projected vertically onto the plane of the ray source i coordinate: Obtain the coordinates (x3, y3) of the second projection point of point A in the two-dimensional coordinate system; where x3 = x′2 - (y′2) / 2. i -y r ), y3=y′2-(z′ i -z r ).

[0044] Thirdly, this application provides an electronic device, comprising: at least one memory for storing a program; and at least one processor for executing the program stored in the memory, wherein when the program stored in the memory is executed, the processor is configured to execute the method described in the first aspect or any possible implementation thereof.

[0045] Fourthly, this application provides a computer-readable storage medium storing a computer program that, when run on a processor, causes the processor to perform the method described in the first aspect or any possible implementation thereof.

[0046] Fifthly, this application provides a computer program product that, when run on a processor, causes the processor to perform the method described in the first aspect or any possible implementation thereof.

[0047] In summary, the technical solutions conceived by this invention have the following beneficial effects compared with the prior art:

[0048] This invention provides a method, apparatus, and electronic device for generating virtual radiographic images of castings. Based on the relative positions and angles of the X-ray source, casting, and imaging plate, this invention simulates the X-ray imaging process, acquiring virtual radiographic images of all key parts of the casting. This facilitates the generation of diverse virtual radiographic images for use by deep learning models, improving their accuracy and enabling subsequent training of the deep learning model to accurately classify casting defects based on the radiographic images. This invention establishes a transformation relationship between the casting's three-dimensional world coordinates and projected two-dimensional coordinates, allowing the determination of the three-dimensional coordinates of defects in the casting based on the two-dimensional coordinates of the defects in the radiographic image. This invention generates virtual radiographic images based on extracted thickness information and set voltage, current, and distance of the radiographic tube, resulting in good imaging stability. The virtual radiographic images generated by this invention have high reliability. The virtual radiographic images generated by this invention can be used to train deep learning models for detecting internal defects in precision castings. This invention utilizes point clouds to extract flaw detection thickness information based on X-ray point source imaging. It only requires calculating the distance between point clouds through which the X-ray passes. Theoretically, as long as the point cloud is dense enough, flaw detection thickness information can be correctly extracted from any angle, and the virtual flaw detection image is generated with high accuracy. Attached Figure Description

[0049] Figure 1 This is a flowchart of the virtual radiographic flaw detection image generation method for castings provided in this embodiment of the invention;

[0050] Figure 2 This is a schematic diagram of coordinate system establishment and transformation provided in an embodiment of the present invention;

[0051] Figure 3 This is a schematic diagram of coordinate transformation provided in an embodiment of the present invention;

[0052] Figure 4 This is a flowchart of generating virtual X-ray flaw detection images provided in an embodiment of the present invention;

[0053] Figure 5 This is a schematic diagram of the virtual radiographic flaw detection image generation device for castings provided in an embodiment of the present invention. Detailed Implementation

[0054] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0055] The terms "first" and "second," etc., used in the specification and claims of this invention are used to distinguish different objects, not to describe a specific order of objects. For example, "first three-dimensional coordinate system" and "second three-dimensional coordinate system," etc., are used to distinguish different coordinate systems, not to describe a specific order of coordinate systems.

[0056] In the embodiments of this application, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design that is described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design. Specifically, the use of the terms "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.

[0057] In the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more, for example, multiple distances means two or more distance values, etc.

[0058] Next, the technical solutions provided in the embodiments of this application will be described.

[0059] Figure 1 This is a flowchart of the virtual radiographic flaw detection image generation method for castings provided in this embodiment of the invention; as shown... Figure 1 As shown, it includes the following steps:

[0060] S101, define a two-dimensional coordinate system, a first three-dimensional coordinate system, and a second three-dimensional coordinate system; wherein, the two-dimensional coordinate system has the center of the imaging plate as the origin, the x-axis is along the horizontal direction of the imaging plate, and the y-axis is along the vertical direction of the imaging plate; the first three-dimensional coordinate system has the center of the turntable as the origin, the y-axis is parallel to the x-axis of the two-dimensional coordinate system, the z-axis is parallel to the y-axis of the two-dimensional coordinate system, and the x-axis is determined according to the right-hand rule of the three-dimensional coordinate system; the second three-dimensional coordinate system has the center of the X-ray source as the origin, the x-axis and y-axis are parallel to the x-axis and y-axis of the two-dimensional coordinate system respectively, and the z-axis is determined according to the right-hand rule of the three-dimensional coordinate system; the X-ray source and the imaging plate are used to perform flaw detection imaging on the casting, and the turntable is placed between the X-ray source and the imaging plate to support the casting;

[0061] S102, determine the three-dimensional point cloud model of the casting. If the three-dimensional point cloud model of the casting is placed on the turntable, determine the coordinates of each point on the three-dimensional point cloud model in the first three-dimensional coordinate system.

[0062] S103, based on the plane normal vector of the imaging plate in the first three-dimensional coordinate system, the coordinates of the center of the imaging plate, the coordinates of the center of the ray source, and the coordinates of each point on the three-dimensional point cloud model, first calculate the first distance from the center of the imaging plate to the ray source plane, the second distance from each point on the three-dimensional point cloud model to the ray source plane, and the coordinates of the first projection point obtained by vertically projecting each point on the three-dimensional point cloud model onto the ray source plane. Then, based on the pinhole imaging principle, calculate the coordinates of the second projection point left on the imaging plate after the ray originating from the center of the ray source passes through each point on the three-dimensional point cloud model, using the coordinates of the first projection point, the first distance, and the second distance; wherein, the ray source plane refers to the plane z=0 in the second three-dimensional coordinate system.

[0063] S104, determine the coordinates of each point on the 3D model in the first 3D coordinate system and the coordinates of the second projection point in the 2D coordinate system. Iterate through all the obtained second projection point coordinates. If a second projection point is repeated more than 1 time, sort the corresponding coordinates in the first 3D coordinate system in ascending order of z coordinate value. If the z coordinates are the same, sort them in ascending order of x coordinate value. Then calculate the distance between adjacent coordinates after sorting to obtain multiple distance values.

[0064] S105, using a data smoothing process, discard the distances that were not passed through by the ray among the multiple distance values, and sum the remaining distance values ​​to obtain the thickness value of the casting through which the ray passes at the second projection point;

[0065] S106, generate a virtual flaw detection image corresponding to the three-dimensional point cloud model based on the casting thickness value corresponding to the coordinates of each second projection point and the distance between the X-ray source and the imaging plate.

[0066] In one specific embodiment, the present invention employs a virtual radiographic flaw detection image generation method for detecting internal defects in castings, comprising the following steps:

[0067] 1. Establish coordinate systems: Based on the relative positions and angles of the X-ray source, casting, and imaging plate, establish the image coordinate system, world coordinate system, and X-ray source coordinate system respectively.

[0068] 2. Coordinate system transformation: The coordinates of a point on the casting are transformed from the world three-dimensional coordinates to the three-dimensional coordinates in the ray source coordinate system, and then transformed into two-dimensional coordinates in the image coordinate system.

[0069] 3. Uniform sampling of the casting model: The 3D casting model in STL or PLY format is converted into PCD format using an algorithm, and the world 3D coordinates of all sampling points are exported.

[0070] 4. Project the sampling points. Using the coordinate system transformation mentioned in step 2, convert the world 3D coordinates obtained in step 3 into projected 2D coordinates.

[0071] 5. Extract the flaw detection thickness information: Traverse the two-dimensional coordinates obtained in step 4, calculate the distance between the corresponding three-dimensional coordinates in the world based on the overlap of the two-dimensional coordinates, and obtain the flaw detection thickness information on the image.

[0072] 6. Image grayscale value calculation: Based on the flaw detection thickness obtained in step 5 and the set flaw detection tube voltage, tube current and flaw detection distance, the image grayscale value is calculated using the formula to generate a virtual flaw detection image.

[0073] 1. For example Figure 2 As shown, the coordinate system is established, and the specific method is as follows:

[0074] a. Establish the image coordinate system: with the center of the imaging plate as the origin, the x-axis is horizontal with positive to the right, and the y-axis is vertical with positive upward;

[0075] b. Establish the world coordinate system: with the center of the turntable as the origin, the y-axis is parallel to the x-axis of the image coordinate system, and the z-axis is parallel to the y-axis of the image coordinate system. The x-axis can be determined according to the right-hand rule of the coordinate system.

[0076] c. Establish the X-ray source coordinate system: with the center of the X-ray source as the origin, the x and y axes are parallel to the x and y axes of the image coordinate system, respectively. The z axis can be determined according to the right-hand rule of the coordinate system.

[0077] d. Given the conditions in the world coordinate system: normal vector of the imaging board plane Imaging plate center coordinates O i (x i ,y i ,z i The coordinates of the center of the radiation source are O. r (x r ,y r ,z r The coordinates of a point A on the casting are (x1, y1, z1).

[0078] 2. For example Figure 3 As shown, the coordinate system transformation first involves converting the world coordinates (x1, y1, z1) to the ray source coordinates (x2, y2, z2):

[0079] a. Calculations show that the radiation source center O... r and perpendicular to the imaging plate normal vector The expression for the ray source plane is: ax + y + cz - x r -y r -z r =0.

[0080] b. Calculate the distance from point A to the plane of the ray source: Then one component of point A in the ray source coordinate system

[0081] c. Calculate the coordinates of point A′ projected perpendicularly from point A onto the ray source plane:

[0082]

[0083]

[0084] d. The component of point A in the ray source coordinate system can be obtained as x2 = y′1 - y r Component y2=z′1-z r .

[0085] Next, the transformation from the ray source coordinates (x2, y2, z2) to the image coordinates (x3, y3) is completed:

[0086] a. Calculate the center O of the imaging plate. i Distance to the plane of the radiation source:

[0087]

[0088] b. Calculate the path through the center O of the imaging plate i and perpendicular to the imaging plate normal vector The image plate plane expression is: ax + by + cz - ax i -by i -ca i =0.

[0089] c. From the similar triangle theorem in the pinhole imaging principle, we can obtain:

[0090]

[0091] After simplification, we get:

[0092] d. Calculate the center O of the imaging plate i Point O′ projected vertically onto the plane of the ray source i coordinate:

[0093]

[0094]

[0095] e. We can obtain the component of point A in the image coordinate system as x3 = x′2 - (y′ i -y r ), component y3=y′2-(z′ i -z r ).

[0096] 3. For example Figure 4As shown, the casting model is uniformly sampled. The 3D model file of the casting in Ply or STL format contains the 3D coordinates and vertex index combination information of each vertex of the 3D model. After the vertex data is preserved and passed to the PointCloud data structure, a point cloud and the world 3D coordinates of the sampled points can be generated. The world 3D coordinates of the sampled points are stored in a list.

[0097] 4. Projecting the sampling points: Using the coordinate system transformation mentioned in step 2, the world 3D coordinates obtained in step 3 are converted into projected 2D coordinates. After obtaining the 2D coordinates, two decimal places are controlled for precision, and the projected 2D coordinates are mapped one-to-one with the world 3D coordinates using the sequence number in the storage list.

[0098] 5. Extraction of flaw detection thickness information, the specific method is as follows:

[0099] a. Use a loop to traverse all projected 2D coordinates, count the number of times a 2D coordinate is repeated. If the number of repetitions of a certain 2D coordinate is greater than 1 and the value is not empty, query and store the list index of all repeated 2D coordinates, make the values ​​of these repeated 2D coordinates empty, find the corresponding world 3D coordinates according to the list index, and store them in a new temporary list.

[0100] b. Sort the 3D coordinates in the temporary list in ascending order of z and x coordinate values. Calculate the distances between adjacent 3D coordinates and store the distance values ​​in a new temporary list.

[0101] c. A data smoothing method is used to discard distance values ​​inside the casting that were not penetrated by the X-ray. First, the average of the first and second distance values ​​is calculated. Then, starting from the third distance value, the ratio of this distance value to the average is compared. If the ratio is within a reasonable range (0.8-1.2), this distance value is retained, and the previous average is adjusted to the average of all retained distance values. If the ratio exceeds a reasonable range, this distance value is discarded, while the previous average remains unchanged. After completion, the sum of the retained distance values ​​is calculated, and this value is the extracted flaw detection thickness information.

[0102] 6. Image grayscale value calculation, based on the image grayscale value calculation formula. Where K is a constant, A is the tube current, U is the tube voltage, u is the material attenuation coefficient, T is the flaw detection thickness obtained in step 5, and F is the flaw detection distance. After setting the tube current, tube voltage, and material attenuation coefficient, the image grayscale value of each projection point is calculated based on the flaw detection thickness and the corresponding flaw detection distance to generate a virtual flaw detection image.

[0103] It should be noted that the world coordinate system and ray source coordinate system established in this invention have geometric constraints with the image coordinate system. The ray source coordinate system is used as a transition coordinate system to establish the transformation law from the world coordinate system to the image coordinate system. The transformation law from the world coordinate system to the ray source coordinate system is established using the formulas for the perpendicular distance from a point to a surface and the projection coordinates from a point to a surface. The transformation law from the ray source coordinate system to the image coordinate system is established using the formulas for the perpendicular distance from a point to a surface, the projection coordinates from a point to a surface, and the similar triangle theorem of pinhole imaging. The projection of the 3D model is transformed into a point cloud projection using a uniform sampling method of the casting model. Based on the correspondence between the storage list subscripts of the world 3D coordinates and the projected 2D coordinates, all 3D points of the casting through which a ray passes are obtained. The distance inside the casting that was not penetrated by the ray is identified based on the uniformity of the distance between all 3D points through which a ray passes. Finally, the image grayscale value of each projection point is calculated based on the flaw detection thickness and the corresponding flaw detection distance, generating a virtual flaw detection image.

[0104] Figure 5 This is an architectural diagram of the virtual radiographic flaw detection image generation device for castings provided in an embodiment of the present invention, as shown below. Figure 5 As shown, it includes:

[0105] The coordinate system determination unit 510 is used to determine a two-dimensional coordinate system, a first three-dimensional coordinate system, and a second three-dimensional coordinate system. The two-dimensional coordinate system has its origin at the center of the imaging plate, with the x-axis along the horizontal direction of the imaging plate and the y-axis along the vertical direction of the imaging plate. The first three-dimensional coordinate system has its origin at the center of the turntable, with its y-axis parallel to the x-axis of the two-dimensional coordinate system and its z-axis parallel to the y-axis of the two-dimensional coordinate system. The x-axis is determined according to the right-hand rule of the three-dimensional coordinate system. The second three-dimensional coordinate system has its origin at the center of the X-ray source, with its x-axis and y-axis parallel to the x-axis and y-axis of the two-dimensional coordinate system, respectively. The z-axis is determined according to the right-hand rule of the three-dimensional coordinate system. The X-ray source and the imaging plate are used for flaw detection imaging of the casting, and the turntable is placed between the X-ray source and the imaging plate to support the casting.

[0106] The casting model determination unit 520 is used to determine the three-dimensional point cloud model of the casting. When the three-dimensional point cloud model of the casting is placed on the turntable, the coordinates of each point on the three-dimensional point cloud model in the first three-dimensional coordinate system are determined.

[0107] The X-ray flaw detection projection unit 530 is used to calculate, based on the plane normal vector of the imaging plate in the first three-dimensional coordinate system, the coordinates of the center of the imaging plate, the coordinates of the center of the X-ray source, and the coordinates of each point on the three-dimensional point cloud model, firstly, the first distance from the center of the imaging plate to the X-ray source plane, the second distance from each point on the three-dimensional point cloud model to the X-ray source plane, and the coordinates of the first projection point obtained by perpendicularly projecting each point on the three-dimensional point cloud model onto the X-ray source plane. Then, based on the pinhole imaging principle, it calculates the coordinates of the second projection point left on the imaging plate after the X-ray originates from the X-ray source center passes through each point on the three-dimensional point cloud model, using the coordinates of the first projection point, the first distance, and the second distance. The X-ray source plane refers to the plane with z=0 in the second three-dimensional coordinate system.

[0108] The flaw detection image generation unit 540 is used to determine the coordinates of each point on the 3D model in the first 3D coordinate system and the coordinates of the second projection point in the 2D coordinate system. It iterates through all the obtained second projection point coordinates. If a second projection point is repeated more than once, the corresponding coordinates in the first 3D coordinate system are sorted in ascending order of z-coordinate value. If the z-coordinates are the same, they are sorted in ascending order of x-coordinate value. Then, the distance between adjacent coordinates after sorting is calculated in turn to obtain multiple distance values. The data smoothing method is used to discard the distances that are not penetrated by the ray in the multiple distance values. The remaining distance values ​​are summed to obtain the thickness value of the casting through which the ray passes for the second projection point. And a virtual flaw detection image corresponding to the 3D point cloud model is generated according to the casting thickness value corresponding to each second projection point coordinate and the distance between the ray source and the imaging plate.

[0109] It should be understood that the above-described device is used to execute the methods in the above embodiments. The implementation principle and technical effect of the corresponding unit modules in the device are similar to those described in the above methods. The working process of the device can be referred to the corresponding process in the above methods, and will not be repeated here.

[0110] Based on the methods described in the above embodiments, this application provides an electronic device. The device may include at least one memory for storing a program and at least one processor for executing the program stored in the memory. When the program stored in the memory is executed, the processor performs the methods described in the above embodiments.

[0111] Based on the methods in the above embodiments, this application provides a computer-readable storage medium storing a computer program that, when run on a processor, causes the processor to execute the methods in the above embodiments.

[0112] Based on the methods in the above embodiments, this application provides a computer program product that, when run on a processor, causes the processor to execute the methods in the above embodiments.

[0113] It is understood that the processor in the embodiments of this application may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. A general-purpose processor may be a microprocessor or any conventional processor.

[0114] The method steps in the embodiments of this application can be implemented in hardware or by a processor executing software instructions. The software instructions can consist of corresponding software modules, which 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, portable hard disks, CD-ROMs, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor, enabling the processor to read information from 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 reside in an ASIC.

[0115] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially 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, all or part of the processes or functions described in the embodiments of this application are generated. 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 one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. 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 integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).

[0116] It is understood that the various numerical designations used in the embodiments of this application are merely for descriptive convenience and are not intended to limit the scope of the embodiments of this application.

[0117] Those skilled in the art will readily understand that the above description is merely 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 within the scope of protection of the present invention.

Claims

1. A method for generating virtual radiographic flaw detection images of castings, characterized in that, Includes the following steps: A two-dimensional coordinate system, a first three-dimensional coordinate system, and a second three-dimensional coordinate system are defined. The two-dimensional coordinate system has its origin at the center of the imaging plate, with the x-axis along the horizontal direction of the imaging plate and the y-axis along the vertical direction. The first three-dimensional coordinate system has its origin at the center of the turntable, with its y-axis parallel to the x-axis of the two-dimensional coordinate system and its z-axis parallel to the y-axis of the two-dimensional coordinate system. The x-axis is determined according to the right-hand rule of the three-dimensional coordinate system. The second three-dimensional coordinate system has its origin at the center of the X-ray source, with its x-axis and y-axis parallel to the x-axis and y-axis of the two-dimensional coordinate system, respectively. The z-axis is determined according to the right-hand rule of the three-dimensional coordinate system. The X-ray source and the imaging plate are used for flaw detection imaging of the casting, and the turntable is placed between the X-ray source and the imaging plate to support the casting. A three-dimensional point cloud model of the casting is determined. If the three-dimensional point cloud model of the casting is placed on a turntable, the coordinates of each point on the three-dimensional point cloud model in the first three-dimensional coordinate system are determined. Based on the plane normal vector of the imaging plate in the first three-dimensional coordinate system, the coordinates of the center of the imaging plate, the coordinates of the center of the ray source, and the coordinates of each point on the three-dimensional point cloud model, the first distance from the center of the imaging plate to the ray source plane, the second distance from each point on the three-dimensional point cloud model to the ray source plane, and the coordinates of the first projection point obtained by perpendicularly projecting each point on the three-dimensional point cloud model onto the ray source plane are first calculated. Then, based on the pinhole imaging principle, the coordinates of the second projection point left on the imaging plate after the ray originating from the center of the ray source passes through each point on the three-dimensional point cloud model are calculated using the coordinates of the first projection point, the first distance, and the second distance. The ray source plane refers to the plane with z=0 in the second three-dimensional coordinate system. Determine the coordinates of each point on the 3D model in the first 3D coordinate system and the coordinates of the second projection point in the 2D coordinate system. Iterate through all the obtained second projection point coordinates. If a second projection point is repeated more than once, sort the corresponding coordinates in the first 3D coordinate system in ascending order of z-coordinate value. If the z-coordinates are the same, sort them in ascending order of x-coordinate value. Then calculate the distance between adjacent coordinates after sorting to obtain multiple distance values. The data smoothing method is used to discard the distances that were not penetrated by the ray from the multiple distance values, and the remaining distance values ​​are summed to obtain the thickness value of the casting through which the ray passes at the second projection point; and a virtual flaw detection image corresponding to the three-dimensional point cloud model is generated based on the casting thickness value corresponding to the coordinates of each second projection point and the distance between the ray source and the imaging plate.

2. The method according to claim 1, characterized in that, The method of discarding the distances that were not traversed by the ray from the multiple distance values ​​using data smoothing is specifically as follows: Calculate the average of the first and second distance values ​​among multiple distance values; Starting from the third distance value, the ratio of the third distance value to the average value is calculated. If the ratio is within a preset range, the third distance value is retained, and the previous average value is adjusted to the average of all retained distance values. If the ratio is not within the preset range, the third distance value is discarded. Then, each distance value is compared with the current average value. If the ratio is not within the preset range, it is discarded and the previous average value remains unchanged; otherwise, it is retained and the previous average value is updated. In the three-dimensional point cloud model, if there are no holes or gaps, the distance values ​​between points are relatively uniform. If there are holes or gaps, the distance between any two points in the hole or gap is relatively large compared to the distance between any two points in the non-hole or gap area of ​​the three-dimensional model.

3. The method according to claim 1, characterized in that, Let the normal vector of the imaging plate plane in the first three-dimensional coordinate system be... The center coordinate of the imaging plate is O i (x i ,y i ,z i The coordinates of the center of the radiation source are O. r (x r ,y r ,z r The coordinates of a point A on the casting are (x1, y1, z1). The calculation of the second distance from each point on the 3D point cloud model to the ray source plane and the coordinates of the first projection point obtained by perpendicularly projecting each point on the 3D point cloud model onto the ray source plane are specifically as follows: Determined to pass through the center of the radiation source O r and perpendicular to the imaging plate normal vector The expression for the ray source plane is: ax + by + cz - ax r -by r -cz r =0; Calculate the second distance from point A to the plane of the ray source. Calculate the coordinates of point A projected perpendicularly onto the first projection point A′ on the ray source plane in the first three-dimensional coordinate system: We obtain the coordinates (x2, y2, z2) of point A in the second three-dimensional coordinate system, where x2 = y1. ′ -y r y2=z1 ′ -z r .

4. The method according to claim 3, characterized in that, The calculation of the first distance from the center of the imaging plate to the X-ray source plane, and the calculation of the coordinates of the second projection point left on the imaging plate after the ray originating from the center of the X-ray source passes through each point on the three-dimensional point cloud model, based on the coordinates of the first projection point, the first distance, and the second distance according to the pinhole imaging principle, are as follows: Computational imaging plate center O i First distance to the plane of the radiation source The calculation yields the result passing through the center O of the imaging plate. i and perpendicular to the imaging plate normal vector The image plate plane expression is: ax + by + cz - ax i -by i -cz i =0; Let the coordinates of the second projection point of point A in the second three-dimensional coordinate system be (x2). ′ ,y2 ′ f), by the similar triangle theorem in the pinhole imaging principle, we can obtain: After simplification, we get: Computational imaging plate center O i Point O projected vertically onto the plane of the ray source i ′ coordinate: Obtain the coordinates (x3, y3) of the second projection point of point A in the two-dimensional coordinate system; where x3 = x2. ′ -(y i ′ -y r ), y3=y2 ′ -(z i ′ -z r ).

5. A device for generating virtual radiographic images of castings, characterized in that, include: A coordinate system determination unit is used to determine a two-dimensional coordinate system, a first three-dimensional coordinate system, and a second three-dimensional coordinate system. The two-dimensional coordinate system has its origin at the center of the imaging plate, with the x-axis along the horizontal direction of the imaging plate and the y-axis along the vertical direction. The first three-dimensional coordinate system has its origin at the center of the turntable, with its y-axis parallel to the x-axis of the two-dimensional coordinate system and its z-axis parallel to the y-axis of the two-dimensional coordinate system. The x-axis is determined according to the right-hand rule of the three-dimensional coordinate system. The second three-dimensional coordinate system has its origin at the center of the X-ray source, with its x-axis and y-axis parallel to the x-axis and y-axis of the two-dimensional coordinate system, respectively. The z-axis is determined according to the right-hand rule of the three-dimensional coordinate system. The X-ray source and the imaging plate are used for flaw detection imaging of the casting, and the turntable is placed between the X-ray source and the imaging plate to support the casting. The casting model determination unit is used to determine the three-dimensional point cloud model of the casting. When the three-dimensional point cloud model of the casting is placed on a turntable, the coordinates of each point on the three-dimensional point cloud model in the first three-dimensional coordinate system are determined. The X-ray flaw detection projection unit is used to calculate the first distance from the center of the imaging plate to the X-ray source plane, the second distance from each point on the three-dimensional point cloud model to the X-ray source plane, and the coordinates of the first projection point obtained by projecting each point on the three-dimensional point cloud model perpendicularly onto the X-ray source plane, based on the plane normal vector of the imaging plate in the first three-dimensional coordinate system, the coordinates of the center of the imaging plate, the coordinates of the X-ray source center, the coordinates of the first projection point obtained by projecting each point on the three-dimensional point cloud model perpendicularly onto the X-ray source plane, and then, based on the pinhole imaging principle, calculate the coordinates of the second projection point left on the imaging plate after the X-ray originates from the X-ray source center passes through each point on the three-dimensional point cloud model, based on the coordinates of the first projection point and the first and second distances; wherein, the X-ray source plane refers to the plane z=0 in the second three-dimensional coordinate system; The flaw detection image generation unit is used to determine the coordinates of each point on the 3D model in the first 3D coordinate system and the coordinates of the second projection point in the 2D coordinate system. It iterates through all the obtained second projection point coordinates. If a second projection point is repeated more than once, the corresponding coordinates in the first 3D coordinate system are sorted in ascending order of z-coordinate value. If the z-coordinates are the same, they are sorted in ascending order of x-coordinate value. Then, the distance between adjacent coordinates after sorting is calculated in turn to obtain multiple distance values. The data smoothing method is used to discard the distances that are not penetrated by the ray in the multiple distance values. The remaining distance values ​​are summed to obtain the thickness value of the casting through which the ray passes for the second projection point. And a virtual flaw detection image corresponding to the 3D point cloud model is generated according to the casting thickness value corresponding to each second projection point coordinate and the distance between the ray source and the imaging plate.

6. The apparatus according to claim 5, characterized in that, The flaw detection image generation unit uses a data smoothing method to discard distances that were not penetrated by rays from the multiple distance values. Specifically, it calculates the average of the first and second distance values ​​among the multiple distance values; starting from the third distance value, it calculates the ratio of the third distance value to the average value. If the ratio is within a preset range, the third distance value is retained, and the previous average value is adjusted to the average of all retained distance values; if the ratio is not within the preset range, the third distance value is discarded; then, each distance value is compared with the current average value. If the ratio is not within the preset range, it is discarded, and the previous average value remains unchanged; otherwise, it is retained, and the previous average value is updated. In the three-dimensional point cloud model, if there are no holes or gaps, the distance values ​​between points are relatively uniform. If there are holes or gaps, the distance between any two points in the hole or gap is significantly different from the distance between any two points in the non-hole or gap region of the three-dimensional model.

7. The apparatus according to claim 5, characterized in that, Let the normal vector of the imaging plate plane in the first three-dimensional coordinate system be... The center coordinate of the imaging plate is O i (x i ,y i ,z i The coordinates of the center of the radiation source are O. r (x r ,y r ,z r The coordinates of a point A on the casting are (x1, y1, z1). The X-ray inspection projection unit calculates the second distance from each point on the 3D point cloud model to the X-ray source plane and the coordinates of the first projection point obtained by perpendicularly projecting each point on the 3D point cloud model onto the X-ray source plane. Specifically, it determines the coordinates of the first projection point obtained by perpendicularly projecting each point on the 3D point cloud model onto the X-ray source plane, passing through the X-ray source center O. r and perpendicular to the imaging plate normal vector The expression for the ray source plane is: ax + by + cz - ax r -by r -cz r =0; Calculate the second distance from point A to the plane of the ray source. Calculate the coordinates of point A projected perpendicularly onto the first projection point A′ on the ray source plane in the first three-dimensional coordinate system: We obtain the coordinates (x2, y2, z2) of point A in the second three-dimensional coordinate system, where x2 = y1. ′ -y r y2=z1 ′ -z r .

8. The apparatus according to claim 7, characterized in that, The X-ray flaw detection projection unit calculates the first distance from the center of the imaging plate to the X-ray source plane, and calculates the coordinates of the second projection point left on the imaging plate after the ray originating from the X-ray source center passes through each point on the three-dimensional point cloud model, based on the coordinates of the first projection point, the first distance, and the second distance, according to the pinhole imaging principle. Specifically, it calculates the coordinates of the second projection point left on the imaging plate after the ray passes through each point on the three-dimensional point cloud model, based on the coordinates of the first projection point, the first distance, and the second distance. i First distance to the plane of the radiation source The calculation yields the result passing through the center O of the imaging plate. i and perpendicular to the imaging plate normal vector The image plate plane expression is: ax + by + cz - ax i -by i -cz i =0; Let the coordinates of the second projection point of point A in the second three-dimensional coordinate system be (x2) ′ ,y2 ′ f), by the similar triangle theorem in the pinhole imaging principle, we can obtain: After simplification, we get: Computational imaging plate center O i Point O projected vertically onto the plane of the ray source i ′ coordinate: Obtain the coordinates (x3, y3) of the second projection point of point A in the two-dimensional coordinate system; where x3 = x2. ′ -(y i ′ -y r ), y3=y2 ′ -(z i ′ -z r ).

9. An electronic device, characterized in that, include: At least one memory for storing programs; At least one processor is configured to execute a program stored in the memory, wherein when the program stored in the memory is executed, the processor is configured to perform the method as described in any one of claims 1-4.

10. A computer-readable storage medium storing a computer program, characterized in that, When a computer program runs on a processor, it causes the processor to perform the method as described in any one of claims 1-4.