A virtual imaging-based actual ray flaw detection parameter determination method and system
By generating an image template database using virtual imaging technology and performing normalized cross-correlation analysis, combined with global coarse registration and local fine registration, efficient and accurate integrated inverse calculation of the position and angle parameters of the X-ray source, detector, and stage is achieved, solving the problems of time-consuming, labor-intensive, and low-accuracy parameter inverse calculation in existing technologies.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HUAZHONG UNIV OF SCI & TECH
- Filing Date
- 2026-05-11
- Publication Date
- 2026-06-26
AI Technical Summary
Existing technologies cannot achieve integrated and high-precision reverse calculation of the position and angle parameters of the X-ray source, detector, and stage, resulting in deviations in the three-dimensional positioning of defects and affecting the accuracy of defect identification and removal.
By using a virtual imaging-based method, virtual flaw detection is performed using a 3D model of a metal component, generating multiple virtual flaw detection images. An image template database is constructed, and normalized cross-correlation analysis is performed. Combined with global coarse registration and local fine registration, parameters are iteratively adjusted to determine the position and angle of the X-ray source, detector, and stage.
It achieves efficient and accurate integrated reverse engineering of the position and angle parameters of the X-ray source, detector, and stage, overcoming the time-consuming and labor-intensive defects of the traditional manual trial and error method, and ensuring the efficiency and high precision of the flaw detection parameters.
Smart Images

Figure CN122282818A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of quality inspection technology, and more specifically, relates to a method and system for determining actual radiographic flaw detection parameters based on virtual imaging. Background Technology
[0002] In recent years, industrial digital radiography (DR) has become a key means of quality control for metal components in high-end equipment manufacturing fields such as aerospace. The relative positions and angles of the X-ray source, detector, and stage during the flaw detection process have become the core basis for three-dimensional localization of internal defects and weld repair of metal components. However, for some long-serving DR flaw detection equipment, the generated flaw images only retain visual information and lack parameter binding capabilities. If the flaw detection parameters are not recorded in time, technicians must manually reconstruct the equipment parameters through trial and error, which is not only time-consuming and labor-intensive but also difficult to accurately match the original detection conditions, leading to deviations in the three-dimensional location of defects and affecting the accuracy of defect identification and removal. Existing research mostly focuses on the estimation and reconstruction of single parameters, failing to achieve integrated, high-precision reverse engineering of the position and angle parameters of the X-ray source, detector, and stage, thus failing to meet the actual needs of high-end equipment inspection.
[0003] How to accurately and comprehensively reverse the position and angle parameters of the X-ray source, detector, and stage is a technical problem that urgently needs to be solved in this field. Summary of the Invention
[0004] In view of the shortcomings of the prior art, the purpose of this application is to achieve accurate and integrated reverse calculation of the position and angle parameters of the X-ray source, detector, and stage.
[0005] To achieve the above objectives, in a first aspect, this application provides a method for determining actual X-ray flaw detection parameters based on virtual imaging, the method comprising: Based on a 3D model of a metal component, multiple virtual flaw detection images with initial resolution and corresponding initial magnification are obtained through virtual flaw detection. ); Based on multiple virtual flaw detection images with initial resolution and corresponding initial magnification, within the magnification range of the actual flaw detection process, the magnification is adjusted by step size to generate corresponding virtual flaw detection images, which are then placed into the image template database. Based on actual flaw detection images and an image template database, normalized cross-correlation analysis is performed to obtain the normalized cross-correlation value corresponding to each virtual flaw detection image in the image template database. The parameter combinations corresponding to the top N virtual flaw detection images are used as coarse registration parameters in descending order of normalized cross-correlation values. The coarse registration parameters include N parameter combinations, where N is a positive integer. The parameter combinations are composed of polar angle, azimuth angle, and magnification. Starting with the combination of parameters in the coarse registration parameters, the parameters are iteratively adjusted and registered. The parameter combination corresponding to the largest normalized cross-correlation value during the iteration process is selected as the fine registration parameters. The fine registration parameters are used to determine the final position and angle parameters of the X-ray source, detector and stage.
[0006] The normalized cross-correlation analysis described above is explained here. Normalized cross-correlation analysis is used to analyze the cross-correlation between the actual flaw detection image and the virtual flaw detection image in order to obtain the normalized cross-correlation value corresponding to the virtual flaw detection image.
[0007] Here, we will provide an example of using the parameter combinations corresponding to the top N virtual flaw detection images as coarse registration parameters. For example, if N is 3, then the parameter combinations corresponding to the first, second, and third virtual flaw detection images are used as coarse registration parameters.
[0008] Understandably, by utilizing virtual flaw detection, a multi-scale image template database is constructed within the actual possible magnification range, transforming three-dimensional spatial parameters into two-dimensional image features. Then, global coarse registration is performed through normalized cross-correlation analysis to quickly select the candidate parameter combinations that best match the actual flaw detection image, effectively narrowing the search space and avoiding getting trapped in local optima. Subsequently, starting from the coarse registration result, local fine optimization is performed through iterative parameter adjustment and registration, gradually approximating the true parameters. This integrated reverse-engineering mechanism overcomes the shortcomings of traditional manual trial-and-error methods, which are time-consuming, labor-intensive, and lack accuracy, ensuring the high efficiency and high accuracy of flaw detection parameter restoration.
[0009] As can be seen, the method for determining actual X-ray flaw detection parameters based on virtual imaging provided in this application achieves accurate and integrated reverse determination of the position and angle parameters of the X-ray source, detector, and stage through a strategy of global coarse registration combined with local fine registration.
[0010] In one possible implementation, the above-mentioned method, based on a three-dimensional model of a metal component, acquires multiple virtual flaw detection images with initial resolution and corresponding initial magnification through virtual flaw detection, including: A spherical coordinate system is established based on a 3D model of the metal component, and multiple virtual flaw detection directions are determined by sampling polar angle and azimuth angle. Based on multiple virtual flaw detection directions, virtual flaw detection is performed on the three-dimensional model of the metal component to obtain multiple virtual flaw detection images with initial resolution. Among them, the initial magnification of the virtual flaw detection process ( ) is based on the distance from the X-ray source to the center of the detector ( ) and the distance from the X-ray source to the center of the three-dimensional model of the metal component ( (Originated from)
[0011] In one possible implementation, based on multiple virtual flaw detection images with initial resolution and corresponding initial magnification, within the magnification range of the actual flaw detection process, the magnification is adjusted by step size to generate corresponding virtual flaw detection images. The generated virtual flaw detection images are placed into an image template database, including: Based on the lateral movement distance limitation in the actual flaw detection process, the theoretical minimum and maximum values of magnification are determined to obtain the magnification range; Based on the magnification range, multiple target magnifications are determined by sampling with a step size. Based on the initial magnification and the target magnification, the resolution of multiple virtual flaw detection images with initial resolution is adjusted to obtain a set of virtual flaw detection images corresponding to each target magnification. A set of virtual flaw detection images corresponding to each target magnification is placed into the image template database.
[0012] In one possible implementation, the above normalized cross-correlation analysis includes: Based on actual flaw detection images, a two-dimensional Hanning window matrix is constructed and weighted to obtain the actual flaw detection image without zero padding. ); The unpadded actual flaw detection image is placed in the upper left corner of the canvas, and the pixels on the canvas are assigned values: the pixel values of the unpadded actual flaw detection image are used as the pixel values of the corresponding pixels on the canvas, and the pixel values of the areas on the canvas other than the unpadded actual flaw detection image are zero; the canvas after the assignment process is used as the zero-padded actual flaw detection image; the resolution of the canvas is the resolution of the currently registered virtual flaw detection image, which is either a virtual flaw detection image in the image template database or a virtual flaw detection image during the iterative execution parameter adjustment and registration process; Based on the zero-padding actual flaw detection image and the currently registered virtual flaw detection image, a normalized cross-power spectrum is calculated after performing a Fast Fourier Transform (FFT) on each image. Based on the normalized cross-power spectrum, an Inverse Fast Fourier Transform (IFFT) is performed to determine the coordinates of the pixel with the largest pixel value in the IFFT result. Based on the coordinates of the pixel with the largest pixel value, determine the displacement between the currently registered virtual flaw detection image and the zero-padded actual flaw detection image. ); Based on displacement, the unpadded actual flaw detection image is overlaid on the currently registered virtual flaw detection image, and the unoverlaid areas on the currently registered virtual flaw detection image are cropped to obtain the cropped virtual flaw detection image. Based on the cropped virtual flaw detection image and the actual flaw detection image, the normalized cross-correlation value is calculated and used as the normalized cross-correlation value corresponding to the currently registered virtual flaw detection image.
[0013] Understandably, applying a two-dimensional Hanning window matrix to the actual flaw detection image for weighting can effectively smooth image edges and suppress spectral leakage during the subsequent Fast Fourier Transform (FFT). Next, by placing the windowed image in the upper left corner of a blank canvas with the same resolution as the virtual flaw detection image and padding it with zeros, the image size is standardized to meet the computational requirements of the FFT. Then, the two images are converted to the frequency domain using the Fast Fourier Transform, their normalized cross-power spectra are calculated, and an inverse Fast Fourier Transform is performed. According to the translation theorem of the Fourier Transform, a translation in the spatial domain is equivalent to a phase difference in the frequency domain; therefore, the peak coordinates of the largest pixel value in the inverse transform result directly correspond to the precise translation displacement between the two images. Subsequently, the virtual flaw detection image is cropped based on the obtained displacement, eliminating non-overlapping invalid regions, and the normalized cross-correlation value (NCC) is calculated within the fully aligned overlapping regions. As a similarity metric that is insensitive to changes in global image brightness, NCC can accurately reflect the matching accuracy between the image generated under the current virtual flaw detection parameters and the actual flaw detection image, providing a reliable evaluation basis for subsequent parameter optimization.
[0014] As can be seen, the specific implementation method of performing normalized cross-correlation analysis described above, based on the effective combination of frequency domain phase correlation technology and spatial domain similarity measurement, can quickly and accurately calculate the spatial displacement and matching degree between the actual flaw detection image and the virtual flaw detection image.
[0015] In one possible implementation, the displacement between the currently registered virtual flaw detection image and the zero-padded actual flaw detection image is determined based on the coordinates of the pixel with the largest pixel value, including determining the displacement using the following formula: ; ; This indicates the lateral displacement between the currently registered virtual flaw detection image and the zero-padded actual flaw detection image; This indicates the longitudinal displacement between the currently registered virtual flaw detection image and the zero-padded actual flaw detection image; The x-coordinate represents the pixel with the largest pixel value in the inverse fast Fourier transform result; The ordinate represents the pixel with the largest pixel value in the inverse fast Fourier transform result; Indicates the magnification of the currently registered virtual flaw detection image; The width represents the resolution of the original virtual flaw detection image; This indicates the height of the original virtual flaw detection image resolution; Indicates the height of the metal component; Indicates the initial magnification of the virtual flaw detection process; This indicates the pixel size of the detector.
[0016] In one possible implementation, the above iterative execution of parameter adjustment and registration includes performing the following steps for each starting point (the starting point determined based on the combination of parameters in the coarse registration parameters): For each adjustment object, perform the following parameter adjustment registration process for the traversed adjustment objects. The traversed adjustment objects include polar angle, azimuth angle and magnification. The parameter adjustment and registration process includes the following operations (parameter adjustment and registration operation a to parameter adjustment and registration operation e): Parameter adjustment and registration operation a: Based on the parameter combination represented by the starting point, adjust the parameter combination according to the initial step size to obtain the parameter combination for the first iteration of registration; Parameter adjustment registration b operation (single iteration registration): Based on the parameter combination of the current iteration registration, generate the corresponding virtual flaw detection image as the newly generated virtual flaw detection image; based on the actual flaw detection image and the newly generated virtual flaw detection image, perform normalized cross-correlation analysis to obtain the normalized cross-correlation value corresponding to the newly generated virtual flaw detection image, which is used as the normalized cross-correlation value corresponding to the parameter combination of the current iteration registration. Parameter adjustment registration operation c: If the normalized cross-correlation value of the parameter combination in the current iteration registration increases compared to the normalized cross-correlation value of the parameter combination in the previous iteration registration, then the step size remains unchanged; if the normalized cross-correlation value of the parameter combination in the current iteration registration decreases compared to the normalized cross-correlation value of the parameter combination in the previous iteration registration, then the parameter combination is restored to the parameter combination of the previous iteration registration, and the step size is updated by decreasing the absolute value of the step size; it is determined whether the absolute value of the currently used step size is less than the preset parameter precision. If so, the parameter adjustment registration operation d is executed; otherwise, the corresponding parameters in the parameter combination are adjusted according to the step size to obtain the parameter combination for the next iteration registration, and the parameter adjustment registration operation b is executed to perform the next iteration registration. Parameter adjustment registration d operation: If the parameter combination of the most recent iteration registration has not changed compared to the starting point, the initial step size is inverted, and the corresponding parameters in the parameter combination are adjusted according to the inverted step size, and the parameter adjustment registration b operation is executed again; If the parameter combination of the most recent iteration registration has changed compared to the starting point, the parameter adjustment registration e operation is executed. The parameter adjustment and registration operation e: determines whether the currently traversed adjustment object is the last traversed adjustment object. If so, the parameter combination with the maximum normalized cross-correlation value during the parameter adjustment process is taken as the endpoint. Otherwise, the parameter combination with the maximum normalized cross-correlation value during the parameter adjustment process is taken as the new starting point. The new starting point is the starting point used for the parameter adjustment and registration process for the next traversed adjustment object.
[0017] Understandably, this algorithm—the specific implementation of the aforementioned iterative execution parameter adjustment and registration—decomposes the complex three-dimensional space multi-parameter (polar angle, azimuth angle, magnification) joint optimization problem into an alternating one-dimensional search process targeting a single parameter.
[0018] In each iteration, the algorithm keeps other parameters fixed and only adjusts the currently traversed parameters. By comparing the changes in the normalized cross-correlation (NCC) values of the virtual flaw detection images and the actual flaw detection images before and after parameter adjustment, the algorithm can intelligently determine whether the current search direction and step size are reasonable: if the NCC value increases, it indicates that the current adjustment direction is approaching a better solution, so the current step size is maintained to continue exploring; if the NCC value decreases, it means that the search has crossed a local extreme point, and the algorithm immediately triggers a backtracking mechanism, withdrawing the most recent adjustment and reducing the absolute value of the step size, thereby performing more refined detection near the extreme point; if the parameters have not changed substantially, it indicates that the initial search direction may have deviated from the optimal solution, and the algorithm reverses the search direction by inverting the step size.
[0019] When the absolute value of the step size shrinks below the preset parameter accuracy threshold, the single parameter is considered to have reached a local optimum in the current dimension. Subsequently, the algorithm uses this locally optimal parameter combination as the starting point for the next parameter optimization, iterating through all adjustment objects in turn. Through multiple rounds of alternating iterations and adaptive approximation, the algorithm ultimately selects the parameter combination with the globally maximum NCC value from multiple coarse registration starting points, thereby achieving high-precision, automated inverse calculation of the position and angle parameters of the X-ray source, detector, and stage.
[0020] Secondly, this application provides a system for determining actual X-ray flaw detection parameters based on virtual imaging, including: The virtual flaw detection module is used to acquire multiple virtual flaw detection images with initial resolution and corresponding initial magnification based on the three-dimensional model of the metal component through virtual flaw detection. The image template generation module is used to generate corresponding virtual flaw detection images based on multiple virtual flaw detection images with initial resolution and corresponding initial magnification, within the magnification range of the actual flaw detection process, by adjusting the magnification by step size. The generated virtual flaw detection images are placed into the image template database. The coarse registration module is used to perform normalized cross-correlation analysis based on actual flaw detection images and image template databases. It obtains the normalized cross-correlation value corresponding to each virtual flaw detection image in the image template database. According to the normalized cross-correlation value in descending order, the parameter combinations corresponding to the top N virtual flaw detection images are used as coarse registration parameters. The coarse registration parameters include N parameter combinations, where N is a positive integer. The parameter combinations are composed of polar angle, azimuth angle and magnification. The fine registration module is used to iteratively adjust and register parameters, starting from the combination of parameters in the coarse registration parameters. It selects the parameter combination corresponding to the largest normalized cross-correlation value during the iteration process as the fine registration parameters. The fine registration parameters are used to determine the final position and angle parameters of the X-ray source, detector and stage.
[0021] It is understandable that the beneficial effects of the second aspect mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here.
[0022] Overall, the technical solutions conceived in this application have the following beneficial effects compared with the prior art: By utilizing virtual flaw detection, a multi-scale image template database is constructed within the actual possible magnification range, transforming three-dimensional spatial parameters into two-dimensional image features. Then, global coarse registration is performed through normalized cross-correlation analysis to quickly select the candidate parameter combinations that best match the actual flaw detection images, effectively narrowing the search space and avoiding getting trapped in local optima. Following this, starting from the coarse registration results, local fine optimization is performed through iterative parameter adjustment and registration, gradually approximating the true parameters. This integrated reverse-engineering mechanism overcomes the shortcomings of traditional manual trial-and-error methods, which are time-consuming, labor-intensive, and lack accuracy, ensuring high efficiency and high accuracy in flaw detection parameter restoration. Attached Figure Description
[0023] Figure 1 This is a flowchart illustrating the method for determining actual radiographic testing parameters based on virtual imaging provided in this application embodiment; Figure 2 This is a schematic diagram of the fine registration process provided in the embodiments of this application; Figure 3 This is a schematic diagram showing the positions of the three-dimensional model of the metal component, the X-ray source, the detector, and the stage provided in the embodiments of this application; Figure 4 This is a schematic diagram of polar angle changes provided in an embodiment of this application; Figure 5 This is a schematic diagram of azimuth angle changes provided in the embodiments of this application; Figure 6 This is a schematic diagram of magnification variation provided in the embodiments of this application; Figure 7 This is a schematic diagram of the structure of the actual X-ray flaw detection parameter determination system based on virtual imaging provided in the embodiments of this application; Figure 8 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0024] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0025] 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.
[0026] In the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more, for example, multiple processing units means two or more processing units, multiple elements means two or more elements, etc.
[0027] First, the formulas and parameters involved in the embodiments of this application will be introduced.
[0028] (1) Formula for calculating virtual flaw detection magnification; ; Formula and parameter explanation: This formula is used to calculate the magnification during virtual flaw detection; Indicates the initial magnification of the virtual flaw detection process; This indicates the distance from the X-ray source to the center of the detector during virtual flaw detection; This represents the distance from the X-ray source to the center of the three-dimensional model of the metal component during virtual flaw detection.
[0029] (2) Formula for adjusting the resolution of the virtual flaw detection image to the reference size; ; Formula and parameter explanation: This formula is used to adjust the resolution of the virtual flaw detection image to a reference size that matches the actual flaw detection conditions; The width (or number of horizontal pixels) represents the resolution of the original virtual flaw detection image. The height (or vertical pixel count) of the original virtual flaw detection image resolution. This indicates the height of the metal component during the actual flaw detection process; This indicates the pixel size of the detector.
[0030] (3) Formula for adjusting the resolution of the virtual flaw detection image to a specified size; ; Formula and parameter explanation: This formula is used to adjust the resolution of virtual flaw detection images according to different magnification ratios when establishing an image template database; This represents the template magnification determined by coarse sampling, which lies between the theoretical minimum and the theoretical maximum. The width represents the resolution of the original virtual flaw detection image; This indicates the height of the original virtual flaw detection image resolution; This indicates the height of the metal component during the actual flaw detection process; Indicates the initial magnification of the virtual flaw detection process; This indicates the pixel size of the detector.
[0031] (4) Formula for adjusting the resolution of actual flaw detection images; ; Formula and parameter explanation: This formula is used to calculate the adjusted resolution of an actual flaw detection image; Indicates the physical width of the detector; Indicates the physical dimensions of the detector, specifically its height. This indicates the pixel size of the detector.
[0032] (5) Formula for constructing a two-dimensional Hanning window matrix; ; Formula and parameter explanation: This formula is used to construct a two-dimensional Hanning window matrix to reduce image edge artifacts; Represents the two-dimensional Hanning window matrix in coordinates The weight value at the location; Represents the x-coordinate (horizontal index) of a pixel; Represents the vertical coordinate (vertical index) of a pixel; Pi is a constant. Indicates the physical width of the detector; Indicates the physical dimensions of the detector, specifically its height. This indicates the pixel size of the detector.
[0033] (6) Formula for windowing processing of actual flaw detection images; ; Formula and parameter explanation: This formula is used to apply the Hanning window to actual flaw detection images; This indicates the actual flaw detection image after windowing processing in coordinates. Pixel value at; This indicates the coordinates in the actual flaw detection image. The original pixel value at that location; This represents the two-dimensional Hanning window matrix in the corresponding coordinates. The weight value at that location.
[0034] (7) Formula for calculating normalized cross-power spectrum; ; Formula and parameter explanation: This formula is used to calculate the normalized cross power spectrum of two images in the frequency domain for template matching; This represents the calculated normalized cross-power spectrum; This represents the result obtained after the currently registered virtual flaw detection image has undergone a Fast Fourier Transform (FFT). This represents the result obtained by fast Fourier transforming the actual flaw detection image after zero padding. .
[0035] (8) Formula for calculating image registration displacement; ; ; Formula and parameter explanation: This set of formulas is used to calculate the displacement between the currently registered virtual flaw detection image and the zero-padded actual flaw detection image based on the peak coordinates in the inverse fast Fourier transform results. This indicates the lateral displacement between the currently registered virtual flaw detection image and the zero-padded actual flaw detection image; This indicates the longitudinal displacement between the currently registered virtual flaw detection image and the zero-padded actual flaw detection image; The x-coordinate represents the pixel with the largest pixel value in the inverse fast Fourier transform result; The ordinate represents the pixel with the largest pixel value in the inverse fast Fourier transform result; Indicates the magnification of the current template (the currently registered virtual flaw detection image); The width represents the resolution of the original virtual flaw detection image; This indicates the height of the original virtual flaw detection image resolution; Indicates the height of the metal component; Indicates the initial magnification of the virtual flaw detection process; This indicates the pixel size of the detector.
[0036] The embodiments of this application are described below with reference to the accompanying drawings.
[0037] like Figure 1 As shown, this application provides a method for reverse calculation of actual X-ray flaw detection parameters based on virtual imaging, including the following steps: virtual flaw detection, template establishment, template matching, and fine registration.
[0038] 1. Virtual Flaw Detection. Based on spherical coordinate system sampling, the sampling angle and the 3D model of the metal component are input into the virtual imaging system to generate a virtual flaw detection image of the metal component, which serves as a virtual flaw detection image with initial resolution.
[0039] 2. Template creation. Starting from the minimum magnification during the flaw detection process, the magnification is gradually increased to the maximum value according to the step size. Each magnification corresponds to a unique virtual flaw detection image scaling ratio, thus creating a database of progressively magnified image templates.
[0040] 3. Template Matching (Coarse Registration). Perform a Fast Fourier Transform on each image in the actual flaw detection image and the image template database. Record the coordinates of the point with the largest pixel value in the inverse Fourier transform result image. Calculate the normalized cross-correlation value (or normalized cross-correlation coefficient) when the upper left corner of the actual flaw detection image is superimposed on the coordinates of that point in the virtual flaw detection image. Record the polar angle, azimuth angle, and magnification of the virtual flaw detection image when the normalized cross-correlation value is the highest.
[0041] 4. Fine registration. The parameters of the image selected from the coarse registration are set as the starting point. A new set of parameters is guessed near the starting point. A new virtual flaw detection image is generated based on these parameters. The normalized cross-correlation value between this image and the actual flaw detection image is calculated. The direction of parameter adjustment is determined based on feedback until the maximum normalized cross-correlation value is found, thereby determining the final position and angle parameters of the X-ray source, detector, and stage.
[0042] The method for determining actual X-ray flaw detection parameters based on virtual imaging provided in this application employs a strategy of global coarse registration combined with local fine registration to inversely determine the position and angle parameters of the X-ray source, detector, and stage. Specifically, using virtual flaw detection, a multi-scale image template database is constructed within the actual possible magnification range, transforming three-dimensional spatial parameters into two-dimensional image features. Then, global coarse registration is performed through normalized cross-correlation analysis to quickly select the candidate parameter combinations that best match the actual flaw detection image, effectively narrowing the search space and avoiding getting trapped in local optima. Subsequently, starting from the coarse registration result, local fine optimization is performed through iterative parameter adjustment and registration, gradually approximating the true parameters. This integrated inverse mechanism overcomes the shortcomings of traditional manual trial-and-error methods, which are time-consuming, labor-intensive, and lack accuracy, ensuring high efficiency and high accuracy in flaw detection parameter restoration.
[0043] The following examples illustrate the method for determining actual radiographic flaw detection parameters based on virtual imaging provided in this application.
[0044] 1. Virtual flaw detection, including the following steps 1a to 1e.
[0045] Step 1a: Establish a spherical coordinate system with the geometric center point of the three-dimensional model of the metal component as the origin. Its polar angle range is 0°~180° and its azimuth angle range is 0°~360°. A virtual ray inspection direction can be determined by a set of polar angle and azimuth angle parameters.
[0046] Step 1b: Determine several sets of polar angle and azimuth angle parameters through coarse sampling (sampling according to a preset step size), and input the parameters and the three-dimensional model of the metal component into the virtual imaging system.
[0047] Step 1c: In the virtual imaging system, the 3D model of the metal component remains stationary. The X-ray source and detector determine the virtual flaw detection direction based on parameters. Then, virtual rays are emitted, starting from the X-ray source and ending at each pixel on the detector. After the rays penetrate the 3D model (STL format file), the thickness values entering and exiting the 3D model are recorded and mapped to pixel values, which are then displayed on the detector. After traversing every pixel on the detector, a complete virtual flaw detection image of the 3D model of the metal component is generated.
[0048] Step 1d: Record the distance from the X-ray source to the center of the detector during the virtual flaw detection process. and the distance from the X-ray source to the center of the three-dimensional model of the metal component ,remember Let be the magnification of the virtual flaw detection process. Each set of polar angle and azimuth angle parameters corresponds to one virtual flaw detection image (serving as the original virtual flaw detection image), with a resolution of . .
[0049] Step 1e: Obtain the height of the metal component during the actual flaw detection process. Detector pixel size Detector physical size Adjust the resolution of the original virtual flaw detection image to... This serves as a virtual flaw detection image with an initial resolution.
[0050] 2. Template creation, including the following steps 2a to 2b.
[0051] Step 2a: In actual flaw detection, the magnification is limited by the lateral movement distance of the X-ray source and the detector, therefore there is a theoretical minimum value. and theoretical maximum value .
[0052] Step 2b: Determine several locations through coarse sampling (sampling according to a preset step size). and Magnification between For each magnification The resolution of the multiple virtual flaw detection images with initial resolution obtained during the above virtual flaw detection process is adjusted to... To obtain the magnification A corresponding set of virtual flaw detection images. Based on each magnification. A corresponding set of virtual flaw detection images is used to construct an image template database.
[0053] 3. Template matching (coarse registration), including the following steps 3a to 3g.
[0054] Step 3a: Adjust the resolution of the actual flaw detection image to... And construct a two-dimensional Hanning window matrix: .
[0055] Step 3b: Calculate the pixel value of each pixel in the actual flaw detection image. Multiply by the weights corresponding to the window matrix, i.e. , As an actual flaw detection image without zero padding.
[0056] Step 3c: Create a new blank canvas with the resolution of the currently registered virtual flaw detection image. .Will Place it in the upper left corner of the blank canvas— Align the top left corner with the top left corner of the blank canvas and use The pixel value is used as the pixel value of the corresponding pixel on the canvas, and the rest of the area (excluding the area on the canvas) is used as the pixel value of the corresponding pixel. The pixel values of areas other than the zeros are zeroed, and the actual flaw detection image is generated after zero padding.
[0057] Step 3d: Perform Fast Fourier Transform on the currently registered virtual flaw detection image and the zero-padding actual flaw detection image respectively, and record the results as follows: and ;Will After taking the conjugate, we get The normalized cross-power spectrum of the virtual flaw detection image and the zero-padded actual flaw detection image was calculated. .
[0058] Step 3e: Perform an inverse fast Fourier transform on the currently calculated normalized cross-power spectrum, find the pixel with the largest pixel value in the transform result, and record the coordinates of this pixel. The displacement between the registered virtual flaw detection image and the zero-padded actual flaw detection image is calculated based on these coordinates: ; .
[0059] Step 3f: Overlay the unpadding actual flaw detection image onto the currently registered virtual flaw detection image. The coordinates of the overlay points are... —Align the top left corner of the unpainted actual flaw detection image with the overlay point on the currently registered virtual flaw detection image, and crop the currently registered virtual flaw detection image, retaining only the overlay area. Calculate the normalized cross-correlation value between the unpainted actual flaw detection image and the cropped virtual flaw detection image, and use this as the normalized cross-correlation value corresponding to the currently registered virtual flaw detection image.
[0060] Step 3g: Perform steps 3c to 3f above on each virtual flaw detection image in the image template database, and record the polar angle, azimuth angle, and magnification of the top three virtual flaw detection images with the highest normalized cross-correlation values.
[0061] 4. Fine registration, such as Figure 2 As shown, it includes the following steps 4a to 4g.
[0062] Step 4a: Using the three optimal polar angles, azimuth angles, and magnifications from the coarse registration as three starting points, and with a smaller step size than that used in coarse sampling (the absolute value of the initial step size for fine registration is less than the absolute value of the preset step size for coarse sampling), adjust the polar angle value in starting point 1—using the parameter combination starting from starting point 1 as the adjustment object, adjust the azimuth angle value in starting point 2—using the parameter combination starting from starting point 2 as the adjustment object, adjust the magnification value in starting point 3—using the parameter combination starting from starting point 3 as the adjustment object, generating three sets of parameters for the first iteration of registration (one set of parameters is considered as one parameter combination).
[0063] Step 4b: For each set of parameters in the current iteration of registration, perform an iterative registration: Based on the parameter combination of the current iteration of registration, refer to the process of "1. Virtual Flaw Detection" and the resolution adjustment process in "2. Template Establishment" above, generate a virtual flaw detection image corresponding to the parameter combination (as the newly generated virtual flaw detection image), and determine the normalized cross-correlation value (NCC) corresponding to the newly generated virtual flaw detection image through the process of "3. Template Matching" above, so as to obtain the normalized cross-correlation value corresponding to the parameter combination of the current iteration of registration.
[0064] Step 4c: Perform the following operations on each set of parameters for the current iteration registration: If the normalized cross-correlation value of the parameter combination for the current iteration registration increases compared to the parameter combination for the previous iteration registration (when the current iteration is the first iteration, the parameter combination for the previous iteration registration represents the parameter combination represented by the starting point), then keep the step size unchanged; if the normalized cross-correlation value of the parameter combination for the current iteration registration decreases compared to the parameter combination for the previous iteration registration, then retract the most recent adjustment (restore the parameter combination to the parameter combination for the previous iteration registration), and update the step size by decreasing the absolute value of the step size; determine whether the absolute value of the step size currently used by the parameter combination is less than the required parameter precision. If so, proceed to step 4d; otherwise, continue to adjust the corresponding parameters in the parameter combination according to the step size to obtain the parameter combination for the next iteration registration, and continue to execute step 4b above (execute the next iteration registration).
[0065] Step 4d: Perform the following judgment on the parameter combination: If the parameter combination of the most recent iteration registration has not changed compared to the starting point, then invert the initial step size of the fine registration, continue to adjust the corresponding parameters in the parameter combination according to the inverted step size, and continue to execute the above step 4b; If the parameter combination of the most recent iteration registration has changed compared to the starting point, then execute step 4e.
[0066] Step 4e: Record the parameter combination with the maximum normalized cross-correlation value during the adjustment process of the parameter combination starting from point 1, the parameter combination starting from point 2, and the parameter combination starting from point 3, and use this as the new starting point, denoted as point 1. Starting point 2 Starting point 3 .
[0067] Step 4f: Adjust the starting point 1 according to the initial step size of fine registration. The value of the Chinese azimuth angle – starting from point 1 The parameter combination used as the starting point takes the azimuth angle as the adjustment target, and adjusts the starting point 2. The value of medium magnification - starting from 2 The parameter combination used as the starting point will adjust the magnification as the target, adjusting starting point 3. The value of the polar angle—starting from 3 Using the starting parameter combination as the adjustment target, the polar angle is used to generate three sets of parameters for the next iteration of registration. Steps 4b to 4d are then executed again, and the starting point 1 is recorded. The parameter combination starting from point 2, with point 2 as the starting point The parameter combination starting from point 3 The parameter combination that maximizes the normalized cross-correlation value during its respective adjustment process is taken as the starting point and denoted as starting point 1. Starting point 2 Starting point 3 .
[0068] Step 4g: Adjust the starting point 1 according to the initial step size of fine registration. The value of medium magnification - starting from 1 The parameter combination starting from point 2 will use the magnification as the adjustment target, and the starting point will be adjusted. The value of the polar angle – starting from 2 The parameter combination starting from point 3 uses the polar angle as the adjustment target, and the starting point is adjusted. The value of the Chinese azimuth angle – starting from point 3 Using the parameter combination starting from point 1 as the adjustment object, the azimuth angle is used to generate three sets of parameters for the next iteration of registration. Steps 4b to 4d are executed again, and then the parameters starting from point 1 are recorded. The parameter combination starting from point 2, with point 2 as the starting point The parameter combination starting from point 3 The parameter combinations that maximize the normalized cross-correlation value during their respective adjustment processes, starting from the parameter combination, are used as endpoint 1, endpoint 2, and endpoint 3. The normalized cross-correlation values corresponding to the three endpoints are compared, and the set of parameters with the largest value is used as the final polar angle, azimuth angle, and magnification.
[0069] Figure 3 This diagram illustrates the positions of the 3D model of the metal component, the X-ray source, the detector, and the stage. Figure 4 This is a diagram illustrating the change in polar angle. Figure 4 The left side of the middle section shows a polar angle of -20°. Figure 4 The right side of the middle section shows a polar angle of 20°. Figure 5 This is a diagram illustrating the change in azimuth. Figure 5 The left side of the middle section indicates an azimuth angle of 0°. Figure 5 The right side of the middle section shows a diagram with an azimuth angle of 180°. Figure 6 This is a diagram illustrating the change in magnification. Figure 6 The left side shows a magnification of 1.53. Figure 6 The image on the right shows a magnification of 1.33.
[0070] like Figures 3-6 As shown, the polar angle reflects the tilt angle of the X-ray source and detector relative to the stage in the vertical direction, the azimuth angle reflects the rotation angle of the X-ray source and detector relative to the stage in the horizontal direction, and the magnification reflects the positional relationship of the X-ray source and detector relative to the stage on the X-axis. The positional relationship of the X-ray source and detector relative to the stage on the Y-axis and Z-axis can be obtained from "3. Template Matching" above. With detector pixel size The product reflects this.
[0071] The actual radiographic testing parameter determination system based on virtual imaging provided in this application is described below. The actual radiographic testing parameter determination system based on virtual imaging described below can be referred to in correspondence with the actual radiographic testing parameter determination method based on virtual imaging described above.
[0072] Figure 7 This is a schematic diagram of the actual X-ray flaw detection parameter determination system based on virtual imaging provided in the embodiments of this application, as shown below. Figure 7 As shown, the system includes: a virtual flaw detection module 10, an image template generation module 20, a coarse registration module 30, and a fine registration module 40. Among them: The virtual flaw detection module 10 is used to acquire multiple virtual flaw detection images with initial resolution and corresponding initial magnification based on the three-dimensional model of the metal component through virtual flaw detection. The image template generation module 20 is used to generate a corresponding virtual flaw detection image by adjusting the magnification by step size within the magnification range of the actual flaw detection process, based on multiple virtual flaw detection images with initial resolution and corresponding initial magnification. The generated virtual flaw detection image is placed into the image template database. The coarse registration module 30 is used to perform normalized cross-correlation analysis based on the actual flaw detection images and the image template database, obtain the normalized cross-correlation value corresponding to each virtual flaw detection image in the image template database, and take the parameter combinations corresponding to the top N virtual flaw detection images in descending order of normalized cross-correlation values as coarse registration parameters. The coarse registration parameters include N parameter combinations, where N is a positive integer, and the parameter combinations are composed of polar angle, azimuth angle and magnification. The fine registration module 40 is used to iteratively perform parameter adjustment and registration, starting from the combination of parameters in the coarse registration parameters. The parameter combination corresponding to the largest normalized cross-correlation value during the iteration process is selected as the fine registration parameter. The fine registration parameter is used to determine the final position and angle parameters of the X-ray source, detector and stage.
[0073] It is understood that the detailed functional implementation of each of the above units / modules can be found in the description in the aforementioned method embodiments, and will not be repeated here.
[0074] It should be understood that the above system is used to execute the methods in the above embodiments. The corresponding program modules in the system are similar in implementation principle and technical effect to those described in the above methods. The working process of the system can be referred to the corresponding process in the above methods, and will not be repeated here.
[0075] Based on the methods in the above embodiments, this application provides an electronic device, such as... Figure 8 As shown, the electronic device may include a processor 810, a communications interface 820, a memory 830, and a communication bus 840, wherein the processor 810, the communications interface 820, and the memory 830 communicate with each other through the communication bus 840. The processor 810 can call logical instructions in the memory 830 to execute the methods in the above embodiments.
[0076] Furthermore, the logical instructions in the aforementioned memory 830 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application.
[0077] 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.
[0078] 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.
[0079] It is understood that the processor in the embodiments of this application can 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 can be a microprocessor or any conventional processor.
[0080] The method steps in this application embodiment 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.
[0081] 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 as 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)).
[0082] It is understood that the various numerical designations used in the embodiments of this application are merely for the convenience of description and are not intended to limit the scope of the embodiments of this application.
[0083] Those skilled in the art will readily understand that the above description is merely a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A method for determining actual X-ray flaw detection parameters based on virtual imaging, characterized in that, include: Based on the three-dimensional model of the metal component, multiple virtual flaw detection images with initial resolution and corresponding initial magnification are obtained through virtual flaw detection. Based on multiple virtual flaw detection images with initial resolution and corresponding initial magnification, within the magnification range of the actual flaw detection process, the magnification is adjusted by step size to generate corresponding virtual flaw detection images, which are then placed into the image template database. Based on actual flaw detection images and an image template database, normalized cross-correlation analysis is performed to obtain the normalized cross-correlation value corresponding to each virtual flaw detection image in the image template database. The parameter combinations corresponding to the top N virtual flaw detection images are used as coarse registration parameters in descending order of normalized cross-correlation values. The coarse registration parameters include N parameter combinations, where N is a positive integer. The parameter combinations are composed of polar angle, azimuth angle, and magnification. Starting with the combination of parameters in the coarse registration parameters, the parameters are iteratively adjusted and registered. The parameter combination corresponding to the largest normalized cross-correlation value during the iteration process is selected as the fine registration parameters. The fine registration parameters are used to determine the final position and angle parameters of the X-ray source, detector and stage.
2. The method for determining actual X-ray flaw detection parameters based on virtual imaging according to claim 1, characterized in that, The process, based on a 3D model of a metal component, involves virtual flaw detection to acquire multiple virtual flaw detection images with initial resolution and corresponding initial magnification, including: A spherical coordinate system is established based on a 3D model of the metal component, and multiple virtual flaw detection directions are determined by sampling polar angle and azimuth angle. Based on multiple virtual flaw detection directions, virtual flaw detection is performed on the three-dimensional model of the metal component to obtain multiple virtual flaw detection images with initial resolution; The initial magnification of the virtual flaw detection process is obtained based on the distance from the X-ray source to the center of the detector and the distance from the X-ray source to the center of the three-dimensional model of the metal component.
3. The method for determining actual X-ray flaw detection parameters based on virtual imaging according to claim 1, characterized in that, The process involves generating virtual flaw detection images based on multiple virtual images with initial resolutions and corresponding initial magnifications. Within the magnification range of the actual flaw detection process, the magnification is adjusted by step size to generate corresponding virtual flaw detection images. These generated virtual flaw detection images are then placed into an image template database, including: Based on the lateral movement distance limitation in the actual flaw detection process, the theoretical minimum and maximum values of magnification are determined to obtain the magnification range; Based on the magnification range, multiple target magnifications are determined by sampling at step size. Based on the initial magnification and target magnification, the resolution of multiple virtual flaw detection images with initial resolution is adjusted to obtain a set of virtual flaw detection images corresponding to each target magnification. A set of virtual flaw detection images corresponding to each target magnification is placed into the image template database.
4. The method for determining actual X-ray flaw detection parameters based on virtual imaging according to claim 1, characterized in that, The normalized cross-correlation analysis includes: Based on actual flaw detection images, a two-dimensional Hanning window matrix is constructed and weighted to obtain actual flaw detection images without zero padding. The unpadded actual flaw detection image is placed in the upper left corner of the canvas, and the pixels on the canvas are assigned values: the pixel values of the unpadded actual flaw detection image are used as the pixel values of the corresponding pixels on the canvas, and the pixel values of the areas on the canvas other than the unpadded actual flaw detection image are zero; the canvas after the assignment process is used as the zero-padded actual flaw detection image; the resolution of the canvas is the resolution of the currently registered virtual flaw detection image, which is either a virtual flaw detection image in the image template database or a virtual flaw detection image during the iterative execution parameter adjustment and registration process; Based on the zero-padding actual flaw detection image and the currently registered virtual flaw detection image, a normalized cross-power spectrum is calculated after performing a Fast Fourier Transform (FFT) on each image. Based on the normalized cross-power spectrum, an Inverse Fast Fourier Transform (IFFT) is performed to determine the coordinates of the pixel with the largest pixel value in the IFFT result. Based on the coordinates of the pixel with the largest pixel value, determine the displacement between the currently registered virtual flaw detection image and the zero-padded actual flaw detection image; Based on displacement, the unpadded actual flaw detection image is overlaid on the currently registered virtual flaw detection image, and the unoverlaid areas on the currently registered virtual flaw detection image are cropped to obtain the cropped virtual flaw detection image. Based on the cropped virtual flaw detection image and the actual flaw detection image, the normalized cross-correlation value is calculated and used as the normalized cross-correlation value corresponding to the currently registered virtual flaw detection image.
5. The method for determining actual X-ray flaw detection parameters based on virtual imaging according to claim 4, characterized in that, The displacement between the currently registered virtual flaw detection image and the zero-padded actual flaw detection image is determined based on the coordinates of the pixel with the largest pixel value, including determining the displacement using the following formula: ; ; This indicates the lateral displacement between the currently registered virtual flaw detection image and the zero-padded actual flaw detection image; This indicates the longitudinal displacement between the currently registered virtual flaw detection image and the zero-padded actual flaw detection image; The x-coordinate represents the pixel with the largest pixel value in the inverse fast Fourier transform result; The ordinate represents the pixel with the largest pixel value in the inverse fast Fourier transform result; Indicates the magnification of the currently registered virtual flaw detection image; The width represents the resolution of the original virtual flaw detection image; This indicates the height of the original virtual flaw detection image resolution; Indicates the height of the metal component; Indicates the initial magnification of the virtual flaw detection process; This indicates the pixel size of the detector.
6. The method for determining actual X-ray flaw detection parameters based on virtual imaging according to claim 1, characterized in that, The iterative execution parameter adjustment and registration includes performing the following steps for each starting point: For each adjustment object, perform the following parameter adjustment registration process for the traversed adjustment objects. The traversed adjustment objects include polar angle, azimuth angle and magnification. The parameter adjustment and registration process includes the following operations: Parameter adjustment and registration operation a: Based on the parameter combination represented by the starting point, adjust the parameter combination according to the initial step size to obtain the parameter combination for the first iteration of registration; Parameter adjustment and registration operation b: Based on the parameter combination of the current registration iteration, generate the corresponding virtual flaw detection image as the newly generated virtual flaw detection image; Based on the actual flaw detection image and the newly generated virtual flaw detection image, perform normalized cross-correlation analysis to obtain the normalized cross-correlation value corresponding to the newly generated virtual flaw detection image, which is used as the normalized cross-correlation value corresponding to the parameter combination of the current iteration registration. Parameter adjustment registration c operation: If the normalized cross-correlation value of the parameter combination in the current iteration registration increases compared to the normalized cross-correlation value of the parameter combination in the previous iteration registration, then the step size remains unchanged. If the normalized cross-correlation value of the parameter combination in the current iteration of registration decreases compared to the normalized cross-correlation value of the parameter combination in the previous iteration, then the parameter combination is restored to the parameter combination of the previous iteration of registration, and the step size is updated by reducing the absolute value of the step size; it is determined whether the absolute value of the current step size is less than the preset parameter precision. If so, the parameter adjustment registration d operation is executed; otherwise, the corresponding parameters in the parameter combination are adjusted according to the step size to obtain the parameter combination for the next iteration of registration, and the parameter adjustment registration b operation is executed to perform the next iteration of registration. Parameter adjustment registration d operation: If the parameter combination of the most recent iteration registration has not changed compared to the starting point, the initial step size is inverted, and the corresponding parameters in the parameter combination are adjusted according to the inverted step size, and the parameter adjustment registration b operation is executed again; If the parameter combination of the most recent iteration registration has changed compared to the starting point, the parameter adjustment registration e operation is executed. The parameter adjustment and registration operation e: determines whether the currently traversed adjustment object is the last traversed adjustment object. If so, the parameter combination with the maximum normalized cross-correlation value during the parameter adjustment process is taken as the endpoint. Otherwise, the parameter combination with the maximum normalized cross-correlation value during the parameter adjustment process is taken as the new starting point. The new starting point is the starting point used for the parameter adjustment and registration process for the next traversed adjustment object.
7. A system for determining actual X-ray flaw detection parameters based on virtual imaging, characterized in that, include: The virtual flaw detection module is used to acquire multiple virtual flaw detection images with initial resolution and corresponding initial magnification based on the three-dimensional model of the metal component through virtual flaw detection. The image template generation module is used to generate corresponding virtual flaw detection images based on multiple virtual flaw detection images with initial resolution and corresponding initial magnification, within the magnification range of the actual flaw detection process, by adjusting the magnification by step size. The generated virtual flaw detection images are placed into the image template database. The coarse registration module is used to perform normalized cross-correlation analysis based on actual flaw detection images and image template databases. It obtains the normalized cross-correlation value corresponding to each virtual flaw detection image in the image template database. According to the normalized cross-correlation value in descending order, the parameter combinations corresponding to the top N virtual flaw detection images are used as coarse registration parameters. The coarse registration parameters include N parameter combinations, where N is a positive integer. The parameter combinations are composed of polar angle, azimuth angle and magnification. The fine registration module is used to iteratively adjust and register parameters, starting from the combination of parameters in the coarse registration parameters. It selects the parameter combination corresponding to the largest normalized cross-correlation value during the iteration process as the fine registration parameters. The fine registration parameters are used to determine the final position and angle parameters of the X-ray source, detector and stage.