Geometric deformation correction method for X-ray image

By determining the adjacent pixel values ​​and coefficients of each pixel point in the X-ray image and calculating the corrected pixel values, the problem of poor real-time performance of X-ray image correction in the prior art is solved, and efficient image correction is achieved.

CN119648589AActive Publication Date: 2025-03-18BEIJING TELESOUND ELECTRONICS
View PDF 10 Cites 0 Cited by

Patent Information

Application Number
CN202411532514.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-30
Publication Date
2025-03-18
Estimated Expiration
2044-10-30

AI Technical Summary

Technical Problem

In the prior art, the real-time correction of X-ray images is poor, and complex pre-processing and post-processing are required, resulting in large amounts of calculations.

Method used

By determining the pixel values ​​of adjacent pixel points in the target direction of each pixel point in the X-ray image, and calculating the corrected pixel values ​​of the pixel points based on these pixel values ​​and corresponding coefficients, the corrected X-ray image is obtained.

Benefits of technology

The calculation amount of image processing is reduced, the real-time correction of X-ray images is improved, and complex pre-processing and post-processing steps are avoided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119648589A_ABST
    Figure CN119648589A_ABST
Patent Text Reader

Abstract

The invention provides a geometric deformation correction method for an X-ray image, and the method comprises the steps: determining the pixel value of a first pixel point and the pixel value of a second pixel point, which are adjacent to a pixel point in a target direction, for each pixel point in the X-ray image under the condition that the geometric deformation of the X-ray image is determined; determining a corrected pixel value of the pixel point based on the pixel value of the first pixel point, a first coefficient corresponding to the first pixel point, the pixel value of the second pixel point and a second coefficient corresponding to the second pixel point; the first coefficient and the second coefficient are determined on the basis of pixel point coordinates obtained after pixel points in the original X-ray image are mapped into an ideal X-ray image, the original X-ray image is an image which comprises a calibration object and is subjected to geometric deformation, and the ideal X-ray image is an image which comprises the calibration object and is not subjected to geometric deformation; and determining a corrected X-ray image corresponding to the X-ray image based on the corrected pixel value of each pixel point. According to the invention, the correction real-time performance of the X-ray image can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a method for correcting geometric deformation of an X-ray image. Background Art

[0002] X-ray imaging technology is widely used in medical diagnosis, industrial inspection, security inspection and other fields because it can penetrate objects and provide clear images of internal structures. However, due to the limitations of the equipment itself or the influence of the external environment, X-ray images often undergo geometric deformation, such as distortion or stretching, which seriously affects the image quality and the accuracy of subsequent image analysis.

[0003] In the prior art, when correcting a deformed X-ray image, it is usually necessary to rely on a complex mathematical model or train a deep learning model through a large amount of training data, and then use the trained model to perform geometric correction on the X-ray image.

[0004] However, the above methods all require complex preprocessing of the image, which results in a large amount of calculation and poor real-time performance of the X-ray image correction. Summary of the invention

[0005] The present invention provides a method for correcting geometric deformation of an X-ray image, which is used to solve the defect of poor real-time correction of X-ray images in the prior art and achieve the purpose of improving the real-time correction of X-ray images.

[0006] The present invention provides a method for correcting geometric deformation of an X-ray image, comprising: When it is determined that the X-ray image has undergone geometric deformation, for each pixel point in the X-ray image, determining a pixel value of a first pixel point and a second pixel point adjacent to the pixel point in a target direction; Determine a corrected pixel value of the pixel based on a pixel value of the first pixel, a first coefficient corresponding to the first pixel, a pixel value of the second pixel, and a second coefficient corresponding to the second pixel; the first coefficient and the second coefficient are determined based on pixel coordinates obtained by mapping pixels in an original X-ray image to an ideal X-ray image, the original X-ray image is an image including a calibration object and undergoing geometric deformation, and the ideal X-ray image is an image including a calibration object and undergoing no geometric deformation; Based on the corrected pixel value of each of the pixel points, a corrected X-ray image corresponding to the X-ray image is determined.

[0007] According to a method for correcting geometric deformation of an X-ray image provided by the present invention, determining the corrected pixel value of the pixel based on the pixel value of the first pixel, the first coefficient corresponding to the first pixel, the pixel value of the second pixel, and the second coefficient corresponding to the second pixel, comprises: Multiplying the pixel value of the first pixel point by a first coefficient corresponding to the first pixel point to obtain a first product, and multiplying the pixel value of the second pixel point by a second coefficient corresponding to the second pixel point to obtain a second product; The sum of the first product and the second product is determined as the corrected pixel value of the pixel point.

[0008] According to a method for correcting geometric deformation of an X-ray image provided by the present invention, the method further comprises: Acquiring the original X-ray image; Stretching the original X-ray image to obtain the ideal X-ray image; Determining a scaling ratio based on a first size of the original X-ray image in the target direction and a second size of the ideal X-ray image in the target direction; Based on the scaling ratio, mapping the pixel points in the original X-ray image to the ideal X-ray image to obtain the coordinates of the mapped pixel points; Based on the coordinates of the mapped pixel points, determining the floating point coordinates of the corresponding pixel points in the original X-ray image; The first coefficient and the second coefficient are determined based on the floating point coordinates of the pixel point.

[0009] According to a geometric deformation correction method for an X-ray image provided by the present invention, the calibration object includes a plurality of feature points arranged at equal intervals; The step of determining the floating point coordinates of the corresponding pixel points in the original X-ray image based on the coordinates of the mapped pixel points includes: Determine the first deformed target feature point in the original X-ray image; In a case where the coordinates of the mapped pixel point are less than or equal to the coordinates of the pixel point corresponding to the target feature point, the coordinates of the mapped pixel point are determined as floating-point coordinates of the corresponding pixel point.

[0010] According to a geometric deformation correction method for an X-ray image provided by the present invention, the step of determining the first deformed target feature point in the original X-ray image comprises: Obtaining the actual coordinates of each feature point in the original X-ray image; Obtaining the ideal coordinates of each of the feature points in the ideal X-ray image; Based on the actual coordinates of each of the feature points and the ideal coordinates of each of the feature points, a first target feature point that undergoes deformation is determined.

[0011] According to a method for correcting geometric deformation of an X-ray image provided by the present invention, the method further comprises: When the coordinates of the mapped pixel points are greater than the coordinates of the pixel points corresponding to the target feature points, obtaining polynomial fitting coefficients; Based on the polynomial fitting coefficients and the coordinates of the mapped pixel points, the floating point coordinates of the corresponding pixel points are determined using the fitting polynomial.

[0012] According to a geometric deformation correction method for an X-ray image provided by the present invention, the step of obtaining polynomial fitting coefficients includes: Based on the actual coordinates of each of the feature points and the ideal coordinates of each of the feature points, the fitting polynomial is used to perform data fitting to obtain the polynomial fitting coefficients.

[0013] According to a geometric deformation correction method for an X-ray image provided by the present invention, the first coefficient and the second coefficient are determined based on the floating point coordinates of the pixel points, including: Rounding up the floating point coordinates of the pixel to obtain a first integer; Determine the difference between the first integer and the floating-point coordinates of the pixel point as the first coefficient, where the first coefficient corresponds to the first pixel point, and the first pixel point is a pixel point previous to the pixel point in the target direction; Rounding down the floating point coordinates of the pixel to obtain a second integer; The difference between the floating point coordinates of the pixel point and the second integer is determined as the second coefficient, the second coefficient corresponds to the second pixel point, and the second pixel point is the next pixel point of the pixel point in the target direction.

[0014] According to a geometric deformation correction method for an X-ray image provided by the present invention, when the target direction is a horizontal direction, the first coefficients of the pixels in the same column are the same, and the second coefficients of the pixels in the same column are the same; In the case where the target direction is a vertical direction, the first coefficients of the pixel points in the same row are the same, and the second coefficients of the pixel points in the same row are the same.

[0015] According to a method for correcting geometric deformation of an X-ray image provided by the present invention, the step of determining that the X-ray image has geometric deformation comprises: determining a location of a package in the X-ray image; In the case where the position does not match a preset position, it is determined that the X-ray image undergoes geometric deformation, and the preset position is a position where no geometric deformation occurs when the X-ray image is taken.

[0016] The present invention also provides a geometric deformation correction device for X-ray images, comprising: A first determination module is used to determine, for each pixel point in the X-ray image, a pixel value of a first pixel point and a second pixel point adjacent to the pixel point in a target direction when it is determined that the X-ray image has undergone geometric deformation; a second determination module, configured to determine a corrected pixel value of the pixel point based on a pixel value of the first pixel point, a first coefficient corresponding to the first pixel point, a pixel value of the second pixel point, and a second coefficient corresponding to the second pixel point; the first coefficient and the second coefficient are determined based on pixel coordinates obtained by mapping pixels in an original X-ray image to an ideal X-ray image, the original X-ray image is an image including a calibration object and undergoing geometric deformation, and the ideal X-ray image is an image including a calibration object and undergoing no geometric deformation; The third determination module is used to determine the corrected X-ray image corresponding to the X-ray image based on the corrected pixel value of each of the pixel points.

[0017] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for correcting geometric deformation of an X-ray image as described above is implemented.

[0018] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the above-described methods for correcting geometric deformation of X-ray images.

[0019] The present invention also provides a computer program product, comprising a computer program, which, when executed by a processor, implements any of the above-mentioned methods for correcting geometric deformation of X-ray images.

[0020] The geometric deformation correction method of an X-ray image provided by the present invention determines, for each pixel point in the X-ray image, the pixel value of a first pixel point and the pixel value of a second pixel point adjacent to the pixel point in a target direction, when it is determined that the X-ray image has undergone geometric deformation, and determines the corrected pixel value of the pixel point based on the pixel value of the first pixel point, the first coefficient corresponding to the first pixel point, the pixel value of the second pixel point, and the second coefficient corresponding to the second pixel point, and determines the corrected X-ray image corresponding to the X-ray image based on the corrected pixel value of each pixel point, wherein the first coefficient and the second coefficient are determined based on the pixel coordinates obtained by mapping the pixel points in the original X-ray image to the ideal X-ray image, the original X-ray image is an image that includes a calibration object and has undergone geometric deformation, and the ideal X-ray image is an image that includes a calibration object and has not undergone geometric deformation. Since the first coefficient and the second coefficient for pixel value correction of each pixel adjacent to each other can be determined in advance based on the original X-ray image with geometric deformation including the calibration object and the ideal X-ray image without geometric deformation, in the actual correction process, the predetermined first coefficient and the second coefficient can be directly used for correction without a large amount of pre-processing and post-processing of the image, which greatly reduces the amount of calculation and improves the real-time performance of X-ray image correction. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0022] Figure 1 A system architecture diagram of a method for correcting geometric deformation of X-ray images provided in an embodiment of the present invention.

[0023] Figure 2 A schematic flow chart of a method for correcting geometric deformation of an X-ray image provided by an embodiment of the present invention.

[0024] Figure 3 A schematic diagram of an X-ray image before correction provided by an embodiment of the present invention.

[0025] Figure 4 A schematic diagram of a corrected X-ray image provided by an embodiment of the present invention.

[0026] Figure 5 A schematic diagram of a calibration object provided in an embodiment of the present invention.

[0027] Figure 6 A schematic diagram of collecting X-ray images of a calibration object provided in an embodiment of the present invention.

[0028] Figure 7 A schematic diagram of an original X-ray image provided by an embodiment of the present invention.

[0029] Figure 8 A schematic diagram of a pseudo-colored original X-ray image provided by an embodiment of the present invention.

[0030] Fig. 9 A schematic structural diagram of a geometric deformation correction device for X-ray images provided in an embodiment of the present invention.

[0031] Fig.10 A schematic diagram of the physical structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0032] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0033] In order to solve the problem in the prior art that when geometric deformation correction is performed on an X-ray image, complex pre-processing and post-processing are required for the image, which results in a large amount of calculation in the correction process and affects the real-time correction of the X-ray image, an embodiment of the present invention provides a method for geometric deformation correction of an X-ray image. In the method, when it is determined that the X-ray image is geometrically deformed, for each pixel in the X-ray image, the pixel values ​​of two pixels adjacent to the pixel in the target direction where the geometric deformation occurs can be obtained, so that the corrected pixel value of the pixel is determined based on the pixel values ​​of the two adjacent pixels and the corresponding correction coefficients. After the corrected pixel value of each pixel is determined in the above manner, the corrected X-ray image corresponding to the X-ray image can be obtained. Since the correction coefficient of the adjacent pixels of each pixel can be determined in advance based on the original X-ray image with geometric deformation including the calibration object and the ideal X-ray image without geometric deformation, in the actual correction process, the correction coefficient can be directly used for correction, without the need for a large amount of pre-processing and post-processing of the image, which greatly reduces the amount of calculation and improves the real-time correction of the X-ray image.

[0034] Combine the following Figures 1 to 8The geometric deformation correction method of X-ray images provided by an embodiment of the present invention is described. The embodiment of the present invention can be applicable to any scenario that requires the collection of X-ray images, such as medical treatment, security inspection, and industrial inspection. The executor of the method can be an electronic device such as an X-ray security inspection machine, a computer, a server, a server cluster, or a specially designed X-ray image geometric deformation correction device, or it can be an X-ray image geometric deformation correction device set in the electronic device, and the X-ray image geometric deformation correction device can be implemented by software, hardware, or a combination of the two.

[0035] Figure 1 The system architecture diagram of the geometric deformation correction method of X-ray images provided by the embodiment of the present invention is as follows: Figure 1 As shown, the system includes an image acquisition module, a calibration object processing module, a linear interpolation coefficient calculation and storage module, and an image real-time correction module. Among them, the image acquisition module is used to use a high-precision detector for data acquisition to ensure that the collected X-ray image is clear and low-noise, providing a reliable data basis for subsequent image processing.

[0036] The calibration object processing module is used to obtain the position of each feature point of the calibration object in the original X-ray image through the interface of the development software and the visualization technology, and determine the ideal position of each feature point of the calibration object in the ideal X-ray image.

[0037] The linear interpolation coefficient calculation and storage module is used to perform polynomial fitting based on the positions of each feature point of the calibration object in the original X-ray image and the ideal positions of each feature point of the calibration object in the ideal X-ray image, obtain linear difference coefficients, and save these linear difference coefficients for subsequent quick access.

[0038] The real-time image correction module is used to quickly load the pre-calculated and saved linear interpolation coefficients during the real-time image correction stage, and use the loaded linear interpolation coefficients to interpolate and correct the X-ray image collected in real time. By finding the linear interpolation coefficients, each pixel in the X-ray image is accurately corrected to restore its true spatial position. The corrected X-ray image is clear and has no geometric deformation, and meets the requirements of security inspection, medical diagnosis or other applications. At the same time, the real-time image correction module is also used to optimize the output format and speed of the corrected X-ray image to improve the user experience.

[0039] Figure 2 A schematic diagram of a flow chart of a geometric deformation correction method for an X-ray image provided by an embodiment of the present invention, such as Figure 2 As shown, the method includes the following: Step 201: When it is determined that the X-ray image has undergone geometric deformation, for each pixel point in the X-ray image, determine the pixel value of a first pixel point and the pixel value of a second pixel point adjacent to the pixel point in a target direction.

[0040] In this step, taking the security inspection scene as an example, an X-ray image can be obtained after scanning the package that needs to be inspected by an X-ray security inspection machine. When it is determined that the X-ray image has undergone geometric deformation, such as stretching or deformation, for each pixel in the X-ray image, it is necessary to determine its adjacent first pixel and second pixel in the target direction. Among them, the target direction can be understood as the direction in which the X-ray image is deformed, such as the horizontal direction, vertical direction or diagonal direction. For example, if the target direction is horizontal, the first pixel and the second pixel are the pixel points on the left and right sides, and if the target direction is vertical, the first pixel and the second pixel are the pixel points on the upper and lower sides.

[0041] Furthermore, it is also necessary to determine the pixel value of the first pixel and the pixel value of the second pixel, wherein the pixel value generally refers to the grayscale value or brightness value of the pixel, which can reflect the brightness of the pixel in the X-ray image.

[0042] Step 202: Determine a corrected pixel value of a pixel based on a pixel value of a first pixel, a first coefficient corresponding to the first pixel, a pixel value of a second pixel, and a second coefficient corresponding to the second pixel.

[0043] Among them, the first coefficient and the second coefficient are determined based on the pixel coordinates obtained after mapping the pixel points in the original X-ray image to the ideal X-ray image. The original X-ray image is an image that includes the calibration object and undergoes geometric deformation, and the ideal X-ray image is an image that includes the calibration object and does not undergo geometric deformation.

[0044] In this step, the original X-ray image is an image collected after the calibration object is placed on the conveyor belt of the X-ray security inspection machine channel. The image contains the calibration object and has undergone geometric deformation. The ideal X-ray image can be understood as an image that contains the calibration object and has not undergone geometric deformation. It is an image obtained after a certain processing of the original X-ray image, or it can be a fictitious theoretical image.

[0045] For each pixel in the original X-ray image, after mapping the pixel to the ideal X-ray image, the pixel coordinates of the pixel can be obtained, so as to determine the first coefficient and the second coefficient based on the pixel coordinates after each pixel is mapped. The first coefficient and the second coefficient can reflect the relationship between the pixel in the original X-ray image and the corresponding pixel in the ideal X-ray image.

[0046] It should be understood that for a certain X-ray security inspection machine, since its installation position is fixed, when the X-ray image is taken by the X-ray security inspection machine, the size of the X-ray image taken each time is the same. The first coefficient and the second coefficient corresponding to the adjacent pixel points of a certain pixel point calculated in the above manner are applicable to each pixel point in the subsequent X-ray image of the same size. Therefore, in the actual correction process, the correction pixel value of the pixel point can be determined based on the pixel value of the first pixel point, the predetermined first coefficient corresponding to the first pixel point, the pixel value of the second pixel point, and the second coefficient corresponding to the second pixel point.

[0047] Step 203: Determine a corrected X-ray image corresponding to the X-ray image based on the corrected pixel value of each pixel point.

[0048] In this step, for each pixel point in the X-ray image, its corresponding corrected pixel value can be determined in the manner of step 201 and step 202. According to the corrected pixel value corresponding to each pixel point, a corrected X-ray image can be reconstructed.

[0049] Figure 3 A schematic diagram of an X-ray image before correction provided by an embodiment of the present invention, such as Figure 3 As shown, a test object, such as a straight aluminum bar, is placed at an arbitrary angle in a security inspection machine. After passing through the security inspection machine channel, an X-ray security inspection machine is used to collect images, and the collected X-ray images have geometric deformations. Figure 4 A schematic diagram of a corrected X-ray image provided by an embodiment of the present invention, such as Figure 4 As shown, in the geometric deformation correction method of X-ray images provided by the embodiment of the present invention, Figure 3 After correcting the pixel value of each pixel in the image, the deformed aluminum bar image can be corrected into a straight line shape, meeting the expected goal.

[0050] The geometric deformation correction method of an X-ray image provided by an embodiment of the present invention determines, for each pixel point in the X-ray image, the pixel value of a first pixel point and the pixel value of a second pixel point adjacent to the pixel point in a target direction, when it is determined that the X-ray image has undergone geometric deformation, and determines the corrected pixel value of the pixel point based on the pixel value of the first pixel point, the first coefficient corresponding to the first pixel point, the pixel value of the second pixel point, and the second coefficient corresponding to the second pixel point, and determines the corrected X-ray image corresponding to the X-ray image based on the corrected pixel value of each pixel point, wherein the first coefficient and the second coefficient are determined based on the pixel coordinates obtained by mapping the pixel points in the original X-ray image to the ideal X-ray image, the original X-ray image is an image that includes a calibration object and has undergone geometric deformation, and the ideal X-ray image is an image that includes a calibration object and has not undergone geometric deformation. Since the first coefficient and the second coefficient for pixel value correction of each pixel adjacent to each other can be determined in advance based on the original X-ray image with geometric deformation including the calibration object and the ideal X-ray image without geometric deformation, in the actual correction process, the predetermined first coefficient and the second coefficient can be directly used for correction without a large amount of pre-processing and post-processing of the image, which greatly reduces the amount of calculation and improves the real-time performance of X-ray image correction.

[0051] Exemplarily, on the basis of the above-mentioned embodiments, when determining the corrected pixel value of a pixel based on the pixel value of a first pixel, a first coefficient corresponding to the first pixel, a pixel value of a second pixel, and a second coefficient corresponding to the second pixel, the pixel value of the first pixel and the first coefficient corresponding to the first pixel can be multiplied to obtain a first product, and the pixel value of the second pixel and the second coefficient corresponding to the second pixel can be multiplied to obtain a second product, and the sum of the first product and the second product is determined as the corrected pixel value of the pixel.

[0052] Specifically, taking the target direction as the horizontal direction as an example, the specific correction process for the target direction as the vertical direction is similar to that for the target direction as the horizontal direction, and will not be repeated here. Since the X-ray image is deformed in the horizontal direction, for a certain pixel point in the X-ray image, the horizontal coordinate of the pixel point may be a floating point number due to the image deformation. Assume that the coordinates of a certain pixel point in the X-ray image are ,like For floating point numbers, let ,in, for The integer part of for The decimal part of , then i and i+1 are The two surrounding integer abscissa points, that is, the i-th pixel point is the first pixel point adjacent to the pixel point, and the i+1-th pixel point is the second pixel point adjacent to the pixel point.

[0053] For the first pixel and the second pixel , whose pixel values ​​in the X-ray image are and According to the definition of one-dimensional linear interpolation, the pixel point can be determined according to the following formula (1): Corrected pixel value : (1)

[0054] in, represents the first coefficient, Indicates the second coefficient. The sum of the first coefficient and the second coefficient is 1. The first coefficient and the second coefficient Corresponding to The ratio of the distance to i and i+1.

[0055] In this embodiment, the weighted sum of the pixel value of the first pixel and the pixel value of the second pixel can be determined based on the first coefficient and the second coefficient, and the obtained weighted sum is determined as the corrected pixel value of the pixel. This method can use the information of the local neighborhood of the pixel and can reduce the correction error by weighting, thereby improving the accuracy of the correction. In addition, the first coefficient and the second coefficient are determined by linear difference. The calculation process of this method is relatively simple, does not introduce too much calculation burden, and can meet the requirements of real-time and high efficiency.

[0056] Exemplarily, based on the above-mentioned embodiments, the above-mentioned first coefficient and second coefficient can be determined in the following manner: obtain an original X-ray image, stretch the original X-ray image to obtain an ideal X-ray image, and determine a scaling ratio based on a first size of the original X-ray image in the target direction and a second size of the ideal X-ray image in the target direction, and based on the scaling ratio, map the pixel points in the original X-ray image to the ideal X-ray image to obtain the coordinates of the mapped pixel points, determine the floating-point coordinates of the corresponding pixel points in the original X-ray image based on the coordinates of the mapped pixel points, and then determine the first coefficient and second coefficient based on the floating-point coordinates of the pixel points.

[0057] Specifically, Figure 5 A schematic diagram of a calibration object provided in an embodiment of the present invention, such as Figure 5 As shown, in the embodiment of the present invention, a calibration ruler can be selected as the calibration object. Figure 6 A schematic diagram of collecting X-ray images of a calibration object provided by an embodiment of the present invention, Figure 7 A schematic diagram of an original X-ray image provided by an embodiment of the present invention, such as Figure 6As shown in the figure, the calibration ruler used as a calibration tool is placed horizontally on the conveyor belt of the X-ray security inspection machine channel. When the calibration ruler passes through the security inspection channel, the X-ray image acquisition is completed, and the image is obtained as shown in the figure. Figure 7 The original X-ray image shown. Among them, Figure 7 The square object above the calibration ruler is a heavy fixture used to fix the calibration ruler to prevent it from being hit by obstacles or deviating from the horizontal direction due to movement vibration. The calibration ruler enters the security inspection channel of the X-ray machine in the horizontal direction because placing the calibration ruler horizontally can facilitate the subsequent calculation to obtain the ideal horizontal coordinates of each feature point in the calibration object, such as Figure 5-Figure 7 As shown, the calibration ruler includes multiple feature points, such as holes, which can be used for subsequent horizontal coordinate calibration.

[0058] like Figure 7 As shown in the figure, the spacing between the holes on the left side of the calibration ruler in the original X-ray image is relatively uniform, while the spacing between the holes on the right side changes at a certain point, such as Figure 7 In the illustrated embodiment, the ruler is gradually reduced, so the correction ruler in the original X-ray image is geometrically deformed relative to the actual correction ruler, and is quite different from the physical structure of the original correction ruler.

[0059] After the original X-ray image is acquired, the original X-ray image is stretched by reverse stretching or deformation to correct the deformation in the original X-ray image and obtain an ideal X-ray image in which the calibration object is not deformed.

[0060] Furthermore, the first size of the original X-ray image in the target direction and the second size of the ideal X-ray image in the target direction can also be measured. For example, the image width of the original X-ray image in the horizontal direction can be measured. and the image width in the horizontal direction of the ideal X-ray image . For example, in this embodiment, It can be 640, It can be 850, etc. In addition, the second size of the ideal X-ray image can also be calculated based on the distance between each feature point in the calibration object. Furthermore, the scaling ratio can be determined according to the following formula (2): : (2)

[0061] Determine the scaling After that, for the original X-ray image, each pixel is mapped along the target direction to determine the coordinates of the pixel points mapped to the ideal X-ray image. It should be noted that if the target direction is horizontal, pixel mapping can be performed in units of pixel columns; if the target direction is vertical, pixel mapping can be performed in units of pixel rows. For example, if the target direction is horizontal, the index will be started from 0 to 640 along the horizontal coordinate direction to achieve column matching from the pixel column of the original X-ray image to the pixel column of the ideal X-ray image. During mapping, the horizontal coordinate of the mapped pixel point can be determined according to the following formula (3): : (3)

[0062] Among them, col represents the pixel column that needs to be mapped in the original X-ray image.

[0063] In the pixel mapping process, since scaling may cause the coordinates of the mapped pixel points to be not integer coordinates, the floating point coordinates of these pixel points in the original X-ray image can also be determined based on the mapped pixel point coordinates, and the first coefficient and the second coefficient corresponding to the adjacent pixel points can be determined based on the floating point coordinates of the pixel points. Among them, the first coefficient is the correction coefficient corresponding to the adjacent pixel points on the left side of the pixel point, and the second coefficient is the correction coefficient corresponding to the adjacent pixel points on the right side of the pixel point. The first coefficient and the second coefficient can reflect the relationship between the pixel points in the original X-ray image and the corresponding pixel points in the ideal X-ray image.

[0064] In this embodiment, by accurately determining the scaling ratio between the sizes of the original X-ray image and the ideal X-ray image in the target direction, and mapping each pixel in the original X-ray image to the ideal X-ray image based on the scaling ratio, after obtaining the mapped pixel coordinates, the first coefficient and the second coefficient are determined based on the mapped pixel coordinates. The first coefficient and the second coefficient determined in the above manner are more accurate, thereby improving the accuracy of image correction and the image quality of the X-ray image.

[0065] Exemplarily, the above-mentioned calibration object includes a plurality of feature points arranged at equal intervals. When determining the floating-point coordinates of the corresponding pixel points in the original X-ray image based on the coordinates of the mapped pixel points, it can be achieved by determining the first target feature point that has been deformed in the original X-ray image, and when the coordinates of the mapped pixel points are less than or equal to the coordinates of the pixel points corresponding to the target feature points, the coordinates of the mapped pixel points are determined as the floating-point coordinates of the corresponding pixel points.

[0066] Specifically, Figure 5As shown, the calibration object includes a plurality of feature points arranged at equal intervals, such as the calibration ruler in this embodiment includes 28 holes arranged at equal intervals. In order to reduce the amount of calculation, the first target feature point that undergoes deformation can be determined from the original X-ray image, that is, the pixel column colBendStart at which the deformation just begins in the original X-ray image, for example Figure 7 The 339th pixel in the column is shown in the figure. When the coordinates of the pixel point after mapping When the coordinate colBendStart is less than or equal to the coordinate colBendStart of the pixel corresponding to the target feature point, it means that the pixel before mapping has not been deformed in the original X-ray image. Therefore, the coordinate of the pixel after mapping can be directly determined as the floating-point coordinate of the corresponding pixel before mapping. In this way, the amount of calculation can be reduced and the efficiency of determining the floating-point coordinates of the pixel can be improved, thereby ensuring the real-time performance of subsequent image correction.

[0067] In one implementation, when determining the first deformed target feature point in the original X-ray image, the actual coordinates of each feature point in the original X-ray image can be obtained, and after obtaining the ideal coordinates of each feature point in the ideal X-ray image, the first deformed target feature point can be determined based on the actual coordinates of each feature point and the ideal coordinates of each feature point.

[0068] Specifically, Figure 8 A schematic diagram of a pseudo-color original X-ray image provided by an embodiment of the present invention, such as Figure 8 As shown, it can be based on Figure 7 ,Sure Figure 8 The pseudo-color original X-ray image shown in the figure, that is, the original X-ray image of the calibration object that has undergone geometric deformation, can clearly display the characteristic points in the calibration object through the pseudo-color original X-ray image, which is convenient for users to accurately identify and record the coordinates of the characteristic points. Among them, OpenCV can be used to read the pseudo-color original X-ray image, and the actual coordinates of each characteristic point in the calibration object can be recorded by manually recording by clicking the mouse. For example, the actual horizontal coordinates of each hole in the calibration ruler can be recorded. These actual horizontal coordinates reflect the position of the hole in the geometrically deformed original X-ray image.

[0069] In addition, the ideal horizontal coordinates of each feature point in the ideal X-ray image without geometric deformation can be calculated by the physical distance between adjacent feature points known on the calibration object. These ideal horizontal coordinates represent the position of the feature point on the ideal X-ray image. Because the physical distance between adjacent feature points known on the calibration object is fixed, theoretically the pixel distance between the feature points on the image of the calibration object in the ideal X-ray image is also constant. For example, for the calibration ruler, assuming that the horizontal coordinate of the first hole is 20 and the horizontal coordinate of the second hole is 30, then the actual spacing between the two adjacent holes is 10. The ideal horizontal coordinate values ​​of the remaining holes are calculated to be 40, 50, 60... respectively. Furthermore, based on the ideal horizontal coordinates of each hole, the size information of the ideal X-ray image without geometric deformation in the horizontal direction, that is, the pixel width, for example, the pixel width of the ideal X-ray image is 850 pixels.

[0070] It should be understood that when a feature point is not deformed, the actual coordinates of the feature point in the original X-ray image and the ideal coordinates in the ideal X-ray image should be consistent. When a feature point is deformed, the actual coordinates of the feature point in the original X-ray image will change, and therefore will be different from the ideal coordinates in the ideal X-ray image. Therefore, the actual coordinates of each feature point in the original X-ray image can be compared with its corresponding ideal coordinates in the ideal X-ray image, such as calculating the difference or distance between the two. Starting from the first feature point in the original X-ray image, a traversal comparison is performed, and the first feature point whose actual coordinates are inconsistent with the ideal coordinates or has changed significantly is determined as the first target feature point that has been deformed. Among them, the significant change can be judged based on a preset threshold. For example, among all feature points, when the distance between the actual coordinates and the ideal coordinates of a feature point first exceeds the preset threshold, the feature point is considered to be the first target feature point that has been deformed.

[0071] In this embodiment, the first deformed target feature point is determined by comparing the actual coordinates and ideal coordinates of each feature point. This method can not only improve the efficiency of determining the target feature point, but also improve the accuracy of the determined target feature point.

[0072] Exemplarily, when the coordinates of the mapped pixel points are greater than the coordinates of the pixel points corresponding to the target feature points, the polynomial fitting coefficients can be obtained, and based on the polynomial fitting coefficients and the coordinates of the mapped pixel points, the floating-point coordinates of the corresponding pixel points can be determined using the fitting polynomial.

[0073] Specifically, if the coordinates of the mapped pixel points are calculated When the coordinate colBendStart is greater than the coordinate colBendStart of the pixel corresponding to the target feature point, it means that the pixel before mapping has been deformed in the original X-ray image. Therefore, it is necessary to fit the floating-point coordinates of the corresponding pixel in the original X-ray image by fitting a polynomial. For example, the cubic fitting polynomial shown in the following formula (4) can be used to fit and determine the floating-point coordinates of the corresponding pixel in the original X-ray image. : (4)

[0074] in, , , and are the fitting coefficients of the polynomial, used for the calculation of nonlinear transformation, .

[0075] In this embodiment, when the coordinates of the mapped pixel point are greater than the coordinates of the pixel point corresponding to the target feature point, the polynomial fitting coefficient can be obtained, and based on the polynomial fitting coefficient, the floating-point coordinates of the corresponding pixel point can be determined by fitting. The polynomial fitting can more accurately describe the complex deformation relationship, so that the determined floating-point coordinates are more accurate, thereby improving the correction accuracy of subsequent images.

[0076] Exemplarily, based on the above embodiment, when obtaining the polynomial fitting coefficient, the polynomial fitting coefficient can be obtained by performing data fitting using a fitting polynomial based on the actual coordinates of each feature point and the ideal coordinates of each feature point.

[0077] Specifically, the actual coordinates of each feature point and the ideal coordinates of each feature point can be used to fit a polynomial function through the least squares method. This polynomial function can describe the mapping relationship between the actual coordinates and the ideal coordinates. The specific polynomial fitting can be calculated by the following formula (5): (5)

[0078] in, represents the actual coordinates, represents the ideal coordinates, m represents the end of the higher order terms, represents the fitting coefficient.

[0079] In this embodiment, data fitting can be performed using the cubic polynomial in the following formula (6): (6)

[0080] The fitting coefficients of the fitting polynomial obtained after fitting are: is 7.788e-07, is -0.00132, is 1.059, is -0.9825, and thus we can get the fitting polynomial function of the mapping relationship from the actual coordinates to the ideal coordinates.

[0081] In this embodiment, a high-precision fitting polynomial can be used to perform data fitting based on the actual coordinates and ideal coordinates of each feature point, which can describe the geometric deformation law in the original X-ray image, so that the obtained polynomial fitting coefficients can be applicable to linear scenes and nonlinear scenes. Therefore, when the polynomial fitting coefficients are used for subsequent image correction, X-ray images of different sources and different qualities can be corrected, making the image correction more universal.

[0082] Exemplarily, based on the above embodiments, when determining the first coefficient and the second coefficient based on the floating point coordinates of the pixel point, it can be performed in the following manner: The floating-point coordinates of the pixel point are rounded up to obtain a first integer, and the difference between the first integer and the floating-point coordinates of the pixel point is determined as a first coefficient, the first coefficient corresponds to the first pixel point, and the first pixel point is the previous pixel point of the pixel point in the target direction; the floating-point coordinates of the pixel point are rounded down to obtain a second integer, and the difference between the floating-point coordinates of the pixel point and the second integer is determined as a second coefficient, the second coefficient corresponds to the second pixel point, and the second pixel point is the next pixel point of the pixel point in the target direction.

[0083] Specifically, assuming that the target direction is horizontal, for a certain pixel in the X-ray image, the adjacent pixel on the left side of the pixel is the first pixel, and the adjacent pixel on the right side of the pixel is the second pixel. Assuming that the target direction is vertical, for a certain pixel in the X-ray image, the adjacent pixel above the pixel is the first pixel, and the adjacent pixel below the pixel is the second pixel. In practical applications, the following formula (7) can be used to determine the first coefficient corresponding to the first pixel: (7)

[0084] in, represents the first coefficient, Floating point coordinates representing pixels Round up the value.

[0085] The second coefficient corresponding to the second pixel is determined using the following formula (8): (8)

[0086] in, represents the second coefficient, Floating point coordinates representing pixels The value to round down.

[0087] Determine the first coefficient corresponding to each pixel in the original X-ray image in the above manner and the second coefficient In the subsequent calibration process, since the size of the X-ray image collected by the same X-ray security inspection machine is the same as the size of the original X-ray image, it is not necessary to re-determine the first coefficient. and the second coefficient , directly adopt the previously determined coefficients for correction, which improves the real-time performance of image correction.

[0088] In this embodiment, for each pixel point, the first coefficient corresponding to the first pixel point adjacent to it and the second coefficient corresponding to the second pixel point adjacent to it can be determined. The first coefficient and the second coefficient are then used to jointly determine the corrected pixel value of the pixel point. Since the influence of the pixels on both sides is taken into account, the accuracy of the final corrected image can be improved, thereby improving the image quality.

[0089] Exemplarily, based on the above embodiments, when the target direction is horizontal, the first coefficients of the pixel points in the same column are the same, and the second coefficients of the pixel points in the same column are the same; when the target direction is vertical, the first coefficients of the pixel points in the same row are the same, and the second coefficients of the pixel points in the same row are the same.

[0090] Specifically, when the target direction is horizontal, it means that the original X-ray image has a large deformation in the horizontal direction. At this time, when determining the first coefficient and the second coefficient, the calculation is performed in units of pixel columns. In this way, the first coefficients determined by the pixels in the same column are the same, and the second coefficients are also the same.

[0091] Similarly, when the target direction is vertical, it means that the original X-ray image has a large deformation in the vertical direction. At this time, when determining the first coefficient and the second coefficient, the calculation is performed in units of pixel rows. In this way, the first coefficients determined by the pixels in the same row are the same, and the second coefficients are also the same.

[0092] In this embodiment, when the target direction is horizontal, the first coefficients of the pixels in the same column are the same, and the second coefficients of the pixels in the same column are the same; when the target direction is vertical, the first coefficients of the pixels in the same row are the same, and the second coefficients of the pixels in the same column are the same, thereby avoiding determining the first coefficient and the second coefficient corresponding to each pixel point separately in units of a single pixel point, thereby greatly reducing the amount of calculation and improving the efficiency of determining the first coefficient and the second coefficient.

[0093] Exemplarily, based on the above-mentioned embodiments, when determining that an X-ray image has undergone geometric deformation, the position of the area wrapped in the X-ray image may be determined first. If the position does not match a preset position, it is determined that the X-ray image has undergone geometric deformation. The preset position is a position where no geometric deformation occurs when the X-ray image is taken.

[0094] Specifically, in X-ray images, some areas are usually deformed while other areas are not deformed, such as Figure 7 and Figure 8 As shown in the figure, the left area of ​​the X-ray image is not deformed, while the right area is deformed. In the field of security inspection, the main purpose of correcting the X-ray image is to better display the package that needs to be inspected. When the package that needs to be inspected is in the left area of ​​the X-ray image, that is, it is not deformed, there is no need to correct the X-ray image.

[0095] Therefore, in practical applications, a preset position where no geometric deformation occurs when shooting an X-ray image can be pre-set, such as the left position of the X-ray image. When it is determined that the position of the package that needs security inspection in the X-ray image is not at the above preset position, it means that the portion of the X-ray image containing the package has also been deformed, and it can be determined that the X-ray image has undergone geometric deformation, and the X-ray image needs to be corrected later. When it is determined that the position of the package that needs security inspection in the X-ray image is at the above preset position, it means that the portion of the X-ray image containing the package has not been deformed, and it can be determined that the X-ray image has not undergone geometric deformation, and the X-ray image does not need to be corrected later.

[0096] In this embodiment, after the position of the package in the X-ray image is determined, it is determined that the X-ray image has undergone geometric deformation only when the position does not match the preset position, thereby avoiding the phenomenon of correcting the X-ray image even if the part where the package is located has not been deformed, saving system resources and improving security inspection efficiency.

[0097] The geometric deformation correction device for X-ray images provided by the present invention is described below. The geometric deformation correction device for X-ray images described below and the geometric deformation correction method for X-ray images described above can be referenced to each other.

[0098] Fig. 9 A schematic diagram of the structure of the geometric deformation correction device for X-ray images provided by an embodiment of the present invention, referring to Fig. 9 As shown, the geometric deformation correction device 900 for X-ray images includes: A first determination module 11 is used to determine, for each pixel point in the X-ray image, a pixel value of a first pixel point and a second pixel point adjacent to the pixel point in a target direction when it is determined that the X-ray image has geometric deformation; A second determination module 12 is used to determine the corrected pixel value of the pixel point based on the pixel value of the first pixel point, the first coefficient corresponding to the first pixel point, the pixel value of the second pixel point, and the second coefficient corresponding to the second pixel point; the first coefficient and the second coefficient are determined based on the pixel coordinates obtained by mapping the pixel points in the original X-ray image to the ideal X-ray image, the original X-ray image is an image including the calibration object and undergoing geometric deformation, and the ideal X-ray image is an image including the calibration object and not undergoing geometric deformation; The third determination module 13 is used to determine a corrected X-ray image corresponding to the X-ray image based on the corrected pixel value of each of the pixel points.

[0099] In an exemplary embodiment, the second determining module 12 is specifically configured to: Multiplying the pixel value of the first pixel point by a first coefficient corresponding to the first pixel point to obtain a first product, and multiplying the pixel value of the second pixel point by a second coefficient corresponding to the second pixel point to obtain a second product; The sum of the first product and the second product is determined as the corrected pixel value of the pixel point.

[0100] In an exemplary embodiment, the apparatus further comprises: An acquisition module, used for acquiring the original X-ray image; A stretching module, used for stretching the original X-ray image to obtain the ideal X-ray image; A fourth determination module, configured to determine a scaling ratio based on a first size of the original X-ray image in the target direction and a second size of the ideal X-ray image in the target direction; A mapping module, used for mapping the pixel points in the original X-ray image to the ideal X-ray image based on the scaling ratio to obtain the coordinates of the mapped pixel points; A fifth determination module, configured to determine the floating point coordinates of the corresponding pixel points in the original X-ray image based on the coordinates of the mapped pixel points; A sixth determination module is used to determine the first coefficient and the second coefficient based on the floating point coordinates of the pixel point.

[0101] In an exemplary embodiment, the calibration object includes a plurality of feature points arranged at equal intervals; The fifth determining module is specifically used for: Determine the first deformed target feature point in the original X-ray image; In a case where the coordinates of the mapped pixel point are less than or equal to the coordinates of the pixel point corresponding to the target feature point, the coordinates of the mapped pixel point are determined as floating-point coordinates of the corresponding pixel point.

[0102] In an exemplary embodiment, the fifth determining module is specifically configured to: Obtaining the actual coordinates of each feature point in the original X-ray image; Obtaining the ideal coordinates of each of the feature points in the ideal X-ray image; Based on the actual coordinates of each of the feature points and the ideal coordinates of each of the feature points, a first target feature point that undergoes deformation is determined.

[0103] In an exemplary embodiment, the acquisition module is further used to acquire the polynomial fitting coefficient when the coordinates of the mapped pixel point are greater than the coordinates of the pixel point corresponding to the target feature point; The fifth determination module is further used to determine the floating-point coordinates of the corresponding pixel points by using the fitting polynomial based on the polynomial fitting coefficients and the coordinates of the mapped pixel points.

[0104] In an exemplary embodiment, the acquisition module is specifically configured to: Based on the actual coordinates of each of the feature points and the ideal coordinates of each of the feature points, the fitting polynomial is used to perform data fitting to obtain the polynomial fitting coefficients.

[0105] In an exemplary embodiment, the sixth determining module is specifically configured to: Rounding up the floating point coordinates of the pixel to obtain a first integer; Determine the difference between the first integer and the floating-point coordinates of the pixel point as the first coefficient, where the first coefficient corresponds to the first pixel point, and the first pixel point is a pixel point previous to the pixel point in the target direction; Rounding down the floating point coordinates of the pixel to obtain a second integer; The difference between the floating point coordinates of the pixel point and the second integer is determined as the second coefficient, the second coefficient corresponds to the second pixel point, and the second pixel point is the next pixel point of the pixel point in the target direction.

[0106] In an exemplary embodiment, when the target direction is a horizontal direction, the first coefficients of the pixels in the same column are the same, and the second coefficients of the pixels in the same column are the same; In the case where the target direction is a vertical direction, the first coefficients of the pixel points in the same row are the same, and the second coefficients of the pixel points in the same row are the same.

[0107] In an exemplary embodiment, the first determining module 11 is specifically configured to: determining a location of a package in the X-ray image; In the case where the position does not match a preset position, it is determined that the X-ray image undergoes geometric deformation, and the preset position is a position where no geometric deformation occurs when the X-ray image is taken.

[0108] The device for correcting geometric deformation of X-ray images of the present embodiment can be used to execute the method of any one of the embodiments in the method for correcting geometric deformation of X-ray images. Its specific implementation process and technical effects are similar to those in the method for correcting geometric deformation of X-ray images. For details, please refer to the detailed introduction in the method for correcting geometric deformation of X-ray images, which will not be repeated here.

[0109] Fig.10 A schematic diagram of the physical structure of an electronic device provided by an embodiment of the present invention, such as Fig.10 As shown, the electronic device may include: a processor (processor) 1010 , a communication interface (Communications Interface) 1020 , a memory (memory) 1030 and a communication bus 1040 , wherein the processor 1010 , the communication interface 1020 , and the memory 1030 communicate with each other via the communication bus 1040 . The processor 1010 can call the logic instructions in the memory 1030 to execute a method for correcting geometric deformation of an X-ray image, the method comprising: when it is determined that the X-ray image has undergone geometric deformation, determining, for each pixel point in the X-ray image, a pixel value of a first pixel point and a pixel value of a second pixel point adjacent to the pixel point in a target direction; determining a corrected pixel value of the pixel point based on the pixel value of the first pixel point, a first coefficient corresponding to the first pixel point, the pixel value of the second pixel point, and a second coefficient corresponding to the second pixel point; the first coefficient and the second coefficient are determined based on the pixel coordinates obtained after mapping the pixel points in the original X-ray image to the ideal X-ray image, the original X-ray image is an image that includes a calibration object and has undergone geometric deformation, and the ideal X-ray image is an image that includes a calibration object and has not undergone geometric deformation; based on the corrected pixel values ​​of each of the pixel points, determining a corrected X-ray image corresponding to the X-ray image.

[0110] In addition, the logic instructions in the above-mentioned memory 1030 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0111] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the geometric deformation correction method of the X-ray image provided by the above-mentioned methods, the method including: when it is determined that the X-ray image has undergone geometric deformation, for each pixel point in the X-ray image, determining the pixel value of a first pixel point and the pixel value of a second pixel point adjacent to the pixel point in the target direction; based on the pixel value of the first pixel point, the first coefficient corresponding to the first pixel point, the pixel value of the second pixel point, and the second coefficient corresponding to the second pixel point, determining the corrected pixel value of the pixel point; the first coefficient and the second coefficient are determined based on the pixel coordinates obtained after mapping the pixel points in the original X-ray image to the ideal X-ray image, the original X-ray image is an image that includes a calibration object and has undergone geometric deformation, and the ideal X-ray image is an image that includes a calibration object and has not undergone geometric deformation; based on the corrected pixel value of each of the pixel points, determining the corrected X-ray image corresponding to the X-ray image.

[0112] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the geometric deformation correction method of the X-ray image provided by the above-mentioned methods, the method comprising: in the case of determining that the X-ray image has undergone geometric deformation, determining, for each pixel point in the X-ray image, the pixel value of a first pixel point and the pixel value of a second pixel point adjacent to the pixel point in the target direction; determining the corrected pixel value of the pixel point based on the pixel value of the first pixel point, the first coefficient corresponding to the first pixel point, the pixel value of the second pixel point, and the second coefficient corresponding to the second pixel point; the first coefficient and the second coefficient are determined based on the pixel coordinates obtained after mapping the pixel points in the original X-ray image to the ideal X-ray image, the original X-ray image is an image including a calibration object and undergoing geometric deformation, and the ideal X-ray image is an image including a calibration object and not undergoing geometric deformation; based on the corrected pixel value of each of the pixel points, determining the corrected X-ray image corresponding to the X-ray image.

[0113] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0114] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0115] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for correcting geometric deformation of an X-ray image, characterized in that: include: When it is determined that the X-ray image has undergone geometric deformation, for each pixel point in the X-ray image, determining a pixel value of a first pixel point and a second pixel point adjacent to the pixel point in a target direction; Determine a corrected pixel value of the pixel based on a pixel value of the first pixel, a first coefficient corresponding to the first pixel, a pixel value of the second pixel, and a second coefficient corresponding to the second pixel; The first coefficient and the second coefficient are determined based on pixel coordinates obtained by mapping pixel points in an original X-ray image to an ideal X-ray image, wherein the original X-ray image is an image including a calibration object and undergoing geometric deformation, and the ideal X-ray image is an image including a calibration object and undergoing no geometric deformation; Based on the corrected pixel value of each of the pixel points, a corrected X-ray image corresponding to the X-ray image is determined.

2. The method for correcting geometric deformation of an X-ray image according to claim 1, characterized in that: The determining the corrected pixel value of the pixel point based on the pixel value of the first pixel point, the first coefficient corresponding to the first pixel point, the pixel value of the second pixel point, and the second coefficient corresponding to the second pixel point includes: Multiplying the pixel value of the first pixel point by a first coefficient corresponding to the first pixel point to obtain a first product, and multiplying the pixel value of the second pixel point by a second coefficient corresponding to the second pixel point to obtain a second product; The sum of the first product and the second product is determined as the corrected pixel value of the pixel point.

3. The method for correcting geometric deformation of X-ray images according to claim 1, characterized in that: The method further comprises: Acquiring the original X-ray image; Stretching the original X-ray image to obtain the ideal X-ray image; Determining a scaling ratio based on a first size of the original X-ray image in the target direction and a second size of the ideal X-ray image in the target direction; Based on the scaling ratio, mapping the pixel points in the original X-ray image to the ideal X-ray image to obtain the coordinates of the mapped pixel points; Based on the coordinates of the mapped pixel points, determining the floating point coordinates of the corresponding pixel points in the original X-ray image; The first coefficient and the second coefficient are determined based on the floating point coordinates of the pixel point.

4. The method for correcting geometric deformation of an X-ray image according to claim 3, characterized in that: The calibration object includes a plurality of feature points arranged at equal intervals; The step of determining the floating point coordinates of the corresponding pixel points in the original X-ray image based on the coordinates of the mapped pixel points includes: Determine the first deformed target feature point in the original X-ray image; In a case where the coordinates of the mapped pixel point are less than or equal to the coordinates of the pixel point corresponding to the target feature point, the coordinates of the mapped pixel point are determined as floating-point coordinates of the corresponding pixel point.

5. The method for correcting geometric deformation of X-ray images according to claim 4, characterized in that: The step of determining the first deformed target feature point in the original X-ray image comprises: Obtaining the actual coordinates of each feature point in the original X-ray image; Obtaining the ideal coordinates of each of the feature points in the ideal X-ray image; Based on the actual coordinates of each of the feature points and the ideal coordinates of each of the feature points, a first target feature point that undergoes deformation is determined.

6. The method for correcting geometric deformation of X-ray images according to claim 4, characterized in that: The method further comprises: When the coordinates of the mapped pixel points are greater than the coordinates of the pixel points corresponding to the target feature points, obtaining polynomial fitting coefficients; Based on the polynomial fitting coefficients and the coordinates of the mapped pixel points, the floating point coordinates of the corresponding pixel points are determined using the fitting polynomial.

7. The method for correcting geometric deformation of an X-ray image according to claim 6, characterized in that: The obtaining of polynomial fitting coefficients comprises: Based on the actual coordinates of each of the feature points and the ideal coordinates of each of the feature points, the fitting polynomial is used to perform data fitting to obtain the polynomial fitting coefficients.

8. The method for correcting geometric deformation of X-ray images according to claim 3, characterized in that: The determining the first coefficient and the second coefficient based on the floating point coordinates of the pixel point includes: Rounding up the floating point coordinates of the pixel to obtain a first integer; Determine the difference between the first integer and the floating-point coordinates of the pixel point as the first coefficient, where the first coefficient corresponds to the first pixel point, and the first pixel point is a pixel point previous to the pixel point in the target direction; Rounding down the floating point coordinates of the pixel to obtain a second integer; The difference between the floating point coordinates of the pixel point and the second integer is determined as the second coefficient, the second coefficient corresponds to the second pixel point, and the second pixel point is the next pixel point after the pixel point in the target direction.

9. The method for correcting geometric deformation of an X-ray image according to any one of claims 1 to 8, characterized in that: When the target direction is a horizontal direction, the first coefficients of the pixels in the same column are the same, and the second coefficients of the pixels in the same column are the same; In the case where the target direction is a vertical direction, the first coefficients of the pixel points in the same row are the same, and the second coefficients of the pixel points in the same row are the same.

10. The method for correcting geometric deformation of an X-ray image according to any one of claims 1 to 8, characterized in that: Determining that the X-ray image has undergone geometric deformation includes: determining a location of a package in the X-ray image; In the case where the position does not match a preset position, it is determined that the X-ray image undergoes geometric deformation, and the preset position is a position where no geometric deformation occurs when the X-ray image is taken.

Citation Information

Patent Citations

  • Image distortion correction method

    CN103268597A

  • Plane type camera calibration method

    CN103854271A

  • Image processing method and device

    CN106204419A

  • Image correction method, apparatus, device and system, camera device and display device

    CN107424126A

  • Image distortion correction method and device

    CN110276734A