Method and device for collecting and matching X-ray images of objects during security inspection
By recording the arrival and departure time of the package, combined with the binary algorithm to separate the X-ray image area information, it solves the problem of matching items of different lengths, realizes a highly accurate security inspection process, reduces hardware costs, and is suitable for security inspection of multiple items. scene.
Patent Information
- Application Number
- CN202110611195.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-01
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2041-06-01
AI Technical Summary
Existing security inspection technology is difficult to effectively match X-ray images of items of different lengths, and the algorithm is complex and the hardware cost is high. It cannot accurately handle the matching of multiple items with the same contours before and after.
By recording the time when the package arrives and leaves the photoelectric switch, the package length is estimated, and combined with the binary algorithm to separate the background and foreground points of the X-ray picture frame image, compare the regional information, judge the matching of the package and the X-ray picture, and adapt to different length packages, reducing hardware costs.
It achieves high-accuracy X-ray image matching of items, simplifies the calibration process, reduces hardware costs, and is suitable for security inspection scenarios of multiple items.
Smart Images

Figure CN114372991B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of security inspection, and in particular to a method and device for collecting and matching X-ray images of objects during security inspection. Background Art
[0002] At present, security inspection machines are used in many occasions to detect whether there are dangerous goods or prohibited items. The existing security inspection machine uses an X-ray image of the object, and uses a camera to obtain an appearance image of the object, extracts the contours of the X-ray image and the appearance image, and compares the similarity between the contours of the X-ray image and the appearance image to determine whether the X-ray image and the appearance image are for the same object. The above method uses a complex algorithm to determine the contour of the object. The algorithm cannot solve the problem of how to match multiple objects with the same contours. For long objects, they cannot be photographed in the same picture. It involves the problem of how to splice multiple package images together. It has high requirements for hardware performance and high requirements for algorithm accuracy, which will inevitably lead to high hardware costs. At the same time, the algorithm is also complex in calibration parameters. Summary of the invention
[0003] The purpose of the present invention is to overcome the shortcomings of the above-mentioned prior art and provide a method and device for collecting and matching X-ray images of objects during security inspection, which can adapt to packages of different lengths and solve the matching problem of multiple packages with the same front and rear contours, has high accuracy, is easy to calibrate, and has low hardware cost.
[0004] The present invention is realized by the following technical scheme: a method for collecting and matching X-ray images of objects during security inspection, comprising the following steps:
[0005] When the S1 package is conveyed through the detection area by the conveyor belt, the time T1 when the package arrives at the photoelectric switch and the time T2 when the package leaves the photoelectric switch are recorded, and the estimated length of the X-ray image corresponding to the package is estimated and saved in the request queue P;
[0006] S2. The acquisition device obtains the X-ray video of the package, obtains frame images from the X-ray video at regular intervals, uses a binarization algorithm to separate the background points and foreground points of the frame images, obtains the regional information R of the X-ray image, and records the acquisition time T;
[0007] S3. Store the X-ray images collected at the same time point and their region information R and collection time T into the same queue, sort them in order of position, and combine the X-ray images with adjacent positions;
[0008] S4. Compare the region information R of the X-ray images in the new queue with the region information R of the X-ray images in the old queue one by one to determine whether the two are the same image. If so, store them in the region information history queue Q; if not, store them in the original queue, wherein the new queue is the X-ray images collected at the next collection time point, and the old queue is the X-ray images collected at the previous collection time point;
[0009] S5. Determine whether the mean square error of the lengths of several X-ray images in the regional information history queue Q is less than a preset mean square error threshold. If so, determine that the X-ray image is displayed completely, and store the X-ray image in the to-be-matched data queue M;
[0010] S6. Compare the requests of the request queue P with the to-be-matched data queue. If the difference between the arrival time T1 of the package in the request queue P at the photoelectric switch and the acquisition time T of the X-ray image in the to-be-matched data queue M is less than the preset time threshold and the difference between the estimated length of the X-ray image corresponding to the package and the length of the X-ray image is less than the preset threshold, then it is determined that the package and the X-ray image match, the X-ray image is extracted and saved, otherwise it is determined that the package and the X-ray image do not match, the full screen of the current security inspection machine display screen is captured and saved;
[0011] S7. Repeat step S6 to compare the to-be-matched data queue M one by one until the end.
[0012] Further: the method for estimating the estimated length of the X-ray image corresponding to the package described in step S1 is:
[0013] S11. Subtract the time T1 when the package arrives at the photoelectric switch from the time T2 when the package leaves the photoelectric switch to obtain the time interval (T2-T1) when the package passes through the photoelectric switch;
[0014] S12. The length of the package is obtained by multiplying the conveying speed V of the conveyor belt by the time interval (T2-T1) for the package to pass through the photoelectric switch;
[0015] S13. Since the length of the X-ray image is proportional to the length of the package, and the length of the package is equal to the conveying speed V of the conveyor belt multiplied by the time interval (T2-T1) for the package to pass through the photoelectric switch, and the conveying speed V of the conveyor belt is constant, the estimated length of the X-ray image corresponding to the package is equal to the ratio R multiplied by the time interval (T2-T1) for the package to pass through the photoelectric switch, where the ratio R is obtained by actual measurement.
[0016] Further: the step S2 described in which the background points and foreground points of the frame image are separated by using a binarization algorithm includes:
[0017] S21. Set all background points to 0 and all foreground points to 1 to obtain a binary matrix;
[0018] S22. Perform an erosion and dilation operation on the binary matrix, and then perform a connectivity operation to obtain the maximum contour range of the foreground point, and obtain the region information R of the wrapped X-ray image.
[0019] Further: the method of comparing the region information R of the X-ray images in the new queue with the region information R of the X-ray images in the old queue one by one in step S4 is:
[0020] S41. Determine whether the moving range of the position of the X-ray image in the new queue and the position of the X-ray image in the old queue is less than a preset range threshold. If so, proceed to step S42;
[0021] S42. Determine whether the size error between the X-ray image in the new queue and the X-ray image in the old queue is less than a preset size threshold. If so, determine that the two are the same image. If not, determine that it is a newly appeared X-ray image.
[0022] The device for collecting and matching X-ray images of items during security inspection comprises a conveyor belt, a security inspection machine, a photoelectric switch and a collection device. The conveyor belt runs through the security inspection machine. The photoelectric switches are respectively arranged on both sides of the conveyor belt and are located in front of the security inspection machine. The security inspection machine is provided with a display screen. The collection device is arranged on the top of the security inspection machine. The collection device establishes communication connections with the security inspection machine and the photoelectric switch respectively.
[0023] Further: when the package reaches the photoelectric switch, the signal sent by the photoelectric switch to the collection device is a high level, and when the package leaves the photoelectric switch, the signal sent by the photoelectric switch to the collection device is a low level
[0024] Beneficial effects of the present invention:
[0025] Compared with the prior art, the present invention records the time T1 when the package arrives at the photoelectric switch and the time T2 when the package leaves the photoelectric switch, and then estimates the length of the package and the estimated length of the X-ray image corresponding to the package by using the time T1 when the package arrives at the photoelectric switch and the time T2 when the package leaves the photoelectric switch, and compares the difference between the time T1 when the package arrives at the photoelectric switch and the acquisition time T of the X-ray image, and the difference between the estimated length of the X-ray image corresponding to the package and the length of the X-ray image, so as to determine whether the package and the X-ray image match, that is, whether the X-ray image compared with the package is the X-ray image of the package, thereby achieving adaptability to packages of different lengths and solving the matching problem of multiple packages with the same front and rear contours. The present invention has high accuracy, is easy to calibrate, and has low hardware cost. At the same time, the present invention is suitable for situations where multiple items are stacked or multiple items pass through the security inspection machine in a disorderly manner during security inspection, and has high matching accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 The following is a flowchart of the method for collecting and matching X-ray images of items during security inspection of the present invention;
[0027] Figure 2 It is a structural schematic diagram of the device for collecting and matching X-ray images of objects during security inspection of the present invention.
[0028] Explanation of the reference numerals: 1- conveyor belt, 2- security inspection machine, 3- photoelectric switch, 4- collection equipment, 5- display screen, 6- package. DETAILED DESCRIPTION
[0029] Reference Figure 1 ,The method for collecting and matching X-ray images of items during security inspection includes the following steps:
[0030] When the S1 package is conveyed through the detection area via the conveyor belt, the time T1 when the package arrives at the photoelectric switch and the time T2 when the package leaves the photoelectric switch are recorded, and the estimated length of the X-ray image corresponding to the package is estimated and saved in the request queue P.
[0031] Specifically, the method for estimating the estimated length of the X-ray image corresponding to the package is:
[0032] S11. Subtract the time T1 when the package arrives at the photoelectric switch from the time T2 when the package leaves the photoelectric switch to obtain the time interval (T2-T1) when the package passes through the photoelectric switch.
[0033] S12. Multiply the conveying speed V of the conveyor belt by the time interval (T2-T1) for the package to pass through the photoelectric switch to obtain the length of the package.
[0034] S13. Since the length of the X-ray image is proportional to the length of the package, and the length of the package is equal to the conveying speed V of the conveyor belt multiplied by the time interval (T2-T1) for the package to pass through the photoelectric switch, and the conveying speed V of the conveyor belt is constant, the estimated length of the X-ray image corresponding to the package is equal to the ratio R multiplied by the time interval (T2-T1) for the package to pass through the photoelectric switch, where the ratio R is obtained by actual measurement.
[0035] S2. The acquisition device obtains the X-ray video of the package, obtains frame images from the X-ray video at regular intervals, uses a binarization algorithm to separate the background points and foreground points of the frame images, obtains the regional information R of the X-ray image, and records the acquisition time T.
[0036] Specifically, the use of a binarization algorithm to separate background points and foreground points of a frame image includes:
[0037] S21. Set all background points to 0 and all foreground points to 1 to obtain a binary matrix;
[0038] S22. Perform an erosion and dilation operation on the binary matrix, and then perform a connectivity operation to obtain the maximum contour range of the foreground point, and obtain the region information R of the wrapped X-ray image.
[0039] S3. The X-ray images acquired at the same time point and their region information R and acquisition time T are stored in the same queue, sorted in order of position, and the X-ray images with adjacent positions are combined.
[0040] Specifically, the adjacent X-ray images include X-ray images in two directions, the x-axis and the y-axis.
[0041] S4. Compare the regional information R of the X-ray image in the new queue with the regional information R of the X-ray image in the old queue one by one to determine whether the two are the same image. If so, store them in the regional information history queue Q; if not, save them in the original queue, where the new queue is the X-ray image collected at the next collection time point, and the old queue is the X-ray image collected at the previous collection time point.
[0042] Specifically, the method for comparing the region information R of the X-ray images in the new queue with the region information R of the X-ray images in the old queue one by one is:
[0043] S41. Determine whether the moving range of the position of the X-ray image in the new queue and the position of the X-ray image in the old queue is less than a preset range threshold. If so, proceed to step S42;
[0044] S42. Determine whether the size difference between the X-ray image in the new queue and the X-ray image in the old queue is less than a preset size threshold, if so, determine that the two are the same image, if not, determine that it is a newly appeared X-ray image. The size of the X-ray image includes the length and width of the X-ray image.
[0045] S5. Determine whether the mean square error of the lengths of several X-ray images in the regional information history queue Q is less than a preset mean square error threshold. If so, determine that the X-ray image is displayed completely and store the X-ray image in the to-be-matched data queue M.
[0046] S6. Compare the requests of the request queue P with the data queue to be matched. If the difference between the arrival time T1 of the package in the request queue P at the photoelectric switch and the acquisition time T of the X-ray image in the data queue M to be matched is less than the preset time threshold and the difference between the estimated length of the X-ray image corresponding to the package and the length of the X-ray image is less than the preset threshold, then it is determined that the package and the X-ray image match, the X-ray image is extracted and saved, otherwise it is determined that the package and the X-ray image do not match, the full screen image of the current security inspection machine display screen is captured and saved.
[0047] S7. Repeat step S6 to compare the to-be-matched data queue M one by one until the end.
[0048] Reference Figure 2 The device for collecting and matching X-ray images of items during security inspection includes a conveyor belt 1, a security inspection machine 2, a photoelectric switch 3, and a collection device 4. The conveyor belt 1 runs through the security inspection machine 2. Photoelectric switches 3 are respectively arranged on both sides of the conveyor belt 1, and the photoelectric switches 3 are located in front of the security inspection machine 2. A display screen 5 is arranged on the security inspection machine 2. The collection device 4 is arranged on the top of the security inspection machine 2, and the collection device 4 establishes communication connections with the security inspection machine 2 and the photoelectric switch 3 respectively.
[0049] Furthermore: when the package 6 reaches the photoelectric switch 3, the signal transmitted from the photoelectric switch 3 to the collection device 4 is at a high level, and when the package 6 leaves the photoelectric switch 3, the signal transmitted from the photoelectric switch 3 to the collection device 4 is at a low level.
[0050] The above detailed description is a specific description of a feasible embodiment of the present invention. The embodiment is not intended to limit the patent scope of the present invention. Any equivalent implementation or modification that does not deviate from the present invention should be included in the patent scope of this case.
Claims
1. A method for collecting and matching X-ray images of items during security inspection, characterized in that: The following steps are involved: When the S1 package is conveyed through the detection area by the conveyor belt, the time T1 when the package arrives at the photoelectric switch and the time T2 when the package leaves the photoelectric switch are recorded, and the estimated length of the X-ray image corresponding to the package is estimated and saved in the request queue P; S2. The acquisition device obtains the X-ray video of the package, obtains frame images from the X-ray video at regular intervals, uses a binarization algorithm to separate the background points and foreground points of the frame images, obtains the regional information R of the X-ray image, and records the acquisition time T; S3. Store the X-ray images collected at the same time point and their region information R and collection time T into the same queue, sort them in order of position, and combine the X-ray images with adjacent positions; S4. Compare the region information R of the X-ray images in the new queue with the region information R of the X-ray images in the old queue one by one to determine whether the two are the same image. If so, store them in the region information history queue Q; if not, store them in the original queue, wherein the new queue is the X-ray images collected at the next collection time point, and the old queue is the X-ray images collected at the previous collection time point; S5. Determine whether the mean square error of the lengths of several X-ray images in the regional information history queue Q is less than a preset mean square error threshold. If so, determine that the X-ray image is displayed completely, and store the X-ray image in the to-be-matched data queue M; S6. Compare the requests of the request queue P with the to-be-matched data queue. If the difference between the arrival time T1 of the package in the request queue P at the photoelectric switch and the acquisition time T of the X-ray image in the to-be-matched data queue M is less than the preset time threshold and the difference between the estimated length of the X-ray image corresponding to the package and the length of the X-ray image is less than the preset threshold, then it is determined that the package and the X-ray image match, the X-ray image is extracted and saved, otherwise it is determined that the package and the X-ray image do not match, the full screen of the current security inspection machine display screen is captured and saved; S7. Repeat step S6 to compare the to-be-matched data queue M one by one until the end.
2. The method for collecting and matching X-ray images of objects during security inspection according to claim 1, characterized in that: The method for estimating the estimated length of the X-ray image corresponding to the package described in step S1 is: S11. Subtract the time T1 when the package arrives at the photoelectric switch from the time T2 when the package leaves the photoelectric switch to obtain the time interval (T2-T1) when the package passes through the photoelectric switch. S12. Multiply the conveying speed V of the conveyor belt by the time interval (T2-T1) of the package passing through the photoelectric switch to obtain the length of the package; S13. Since the length of the X-ray image is proportional to the length of the package, and the length of the package is equal to the conveying speed V of the conveyor belt multiplied by the time interval (T2-T1) of the package passing through the photoelectric switch, and the conveying speed V of the conveyor belt is constant, the estimated length of the X-ray image corresponding to the package is equal to the ratio R multiplied by the time interval (T2-T1) of the package passing through the photoelectric switch, where the ratio R is obtained by actual measurement.
3. The method for collecting and matching X-ray images of objects during security inspection according to claim 2, characterized in that: The use of a binarization algorithm to separate background points and foreground points of a frame image in step S2 includes: S21. Set all background points to 0 and all foreground points to 1 to obtain a binary matrix; S22. Perform an erosion and dilation operation on the binary matrix, and then perform a connectivity operation to obtain the maximum contour range of the foreground point, and obtain the region information R of the wrapped X-ray image.
4. The method for collecting and matching X-ray images of objects during security inspection according to claim 3, characterized in that: The method of comparing the region information R of the X-ray images in the new queue with the region information R of the X-ray images in the old queue one by one in step S4 is: S41. Determine whether the moving range of the position of the X-ray image in the new queue and the position of the X-ray image in the old queue is less than a preset range threshold. If so, proceed to step S42; S42. Determine whether the size error between the X-ray image in the new queue and the X-ray image in the old queue is less than a preset size threshold. If so, determine that the two are the same image. If not, determine that it is a newly appeared X-ray image.
5. A device for collecting and matching X-ray images of objects during security inspection using the method for collecting and matching X-ray images of objects during security inspection as claimed in any one of claims 1 to 4, characterized in that: It includes a conveyor belt, a security inspection machine, a photoelectric switch, and a collection device. The conveyor belt runs through the security inspection machine. The photoelectric switches are respectively arranged on both sides of the conveyor belt, and the photoelectric switches are located in front of the security inspection machine. The security inspection machine is provided with a display screen. The collection device is arranged on the top of the security inspection machine, and the collection device establishes communication connections with the security inspection machine and the photoelectric switch respectively.
6. The device for collecting and matching X-ray images of objects during security inspection according to claim 5, characterized in that: When the package reaches the photoelectric switch, the signal transmitted by the photoelectric switch to the collection device is at a high level, and when the package leaves the photoelectric switch, the signal transmitted by the photoelectric switch to the collection device is at a low level.
