Package image segmentation method, device, electronic device and storage medium
Through the use of contour optical detectors and geometric deformation correction technology, the problem of inaccurate package image segmentation in the existing technology is solved, and accurate segmentation of packages in X-ray images is achieved.
Patent Information
- Application Number
- CN202210760171.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-30
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2042-06-30
AI Technical Summary
Existing infrared light barrier and X-ray package image segmentation methods cannot accurately segment adjacent packages with no blank spacing in the light barrier direction or the low-density outer packaging outline has insufficient grayscale display on the X-ray image, resulting in inaccurate package image segmentation.
A contour optical detector is used to obtain the contour image of the package, and the X-ray image is deformed and corrected through the preset geometric deformation correction correspondence. The package contour area is determined and segmented by matching the corrected X-ray image with the contour image.
It achieves accurate segmentation of each package in the X-ray image, solves the problem of inaccurate segmentation caused by insufficient grayscale of low-density outer packaging contours, and ensures the accuracy of the package image.
Smart Images

Figure CN115131379B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a package image segmentation method, device, electronic device and storage medium. Background Art
[0002] Security inspection equipment is an electronic device that uses a conveyor belt to transport inspected objects into a detection beam channel for inspection. It is widely used in security inspection scenarios such as airports, railways, and postal express delivery. Commonly used security inspection equipment consists of a radiation source, collimator, detector, conveyor structure, and image processing unit. The security inspection process is as follows: the radiation source emits detection beams, which are collimated by the collimator to form a scanning plane. As the inspected object passes through the scanning plane driven by the conveyor structure, the detector collects the detection beam signals that pass through the object, generating detection strip data. The image processing unit analyzes the detection strip data to obtain an image of the inspected object, completing the security inspection.
[0003] Security inspection equipment can also be used in non-destructive inspection scenarios involving large numbers of packages, such as postal and express delivery services. Due to the large number of packages required in these non-destructive inspection scenarios, it is often necessary to segment and extract each individual package in the inspection image. This segmented package image can then be matched with the actual package, and non-destructive inspection can be performed on the actual matching package using the segmented package image. Therefore, the ability to segment package images is crucial for non-destructive inspection.
[0004] Common package image segmentation methods include infrared light barrier segmentation and X-ray package image segmentation. However, methods using infrared light barriers can only effectively segment adjacent packages where there is a certain amount of space between the transmitting and receiving ends of the barrier. They cannot segment adjacent packages where there is no space in the direction of the barrier, meaning they cannot accurately segment package images. Furthermore, X-ray package image segmentation methods cannot accurately segment package images due to the high penetrating power of X-rays, as the low-density outer packaging outlines of packages appear almost invisible in grayscale on X-ray images. Summary of the Invention
[0005] The purpose of the embodiments of the present invention is to provide a package image segmentation method, apparatus, electronic device, and storage medium to achieve accurate segmentation of images of individual packages. The specific technical solution is as follows:
[0006] In a first aspect, an embodiment of the present invention provides a package image segmentation method, the method being applied to an image processing device configured to process images captured by security inspection equipment, the security inspection equipment including an X-ray detector, the method comprising:
[0007] Acquiring a contour image captured by a contour optical detector and an X-ray image captured by the X-ray detector during the process of the package passing through the security inspection equipment, wherein the contour optical detector is a light detector capable of capturing an image of the contour area of the package;
[0008] Based on a preset geometric deformation correction correspondence, the X-ray image is deformed and corrected to obtain a corrected X-ray image, wherein the preset geometric deformation correction correspondence is a geometric size correspondence between the images collected by the X-ray detector and the contour optical detector;
[0009] matching the corrected X-ray image with the contour image;
[0010] determining a parcel contour region of the parcel in the corrected X-ray image based on a contour image matched with the corrected X-ray image;
[0011] The corrected X-ray image is segmented based on the package contour area to obtain a package image.
[0012] In a second aspect, an embodiment of the present invention provides a package image segmentation device, which is applied to an image processing device configured to process images captured by security inspection equipment, wherein the security inspection equipment includes an X-ray detector. The package image segmentation device includes:
[0013] an image acquisition module, configured to acquire a contour image captured by the contour optical detector and an X-ray image captured by the X-ray detector during the process of the package passing through the security inspection equipment; wherein the contour optical detector is a light detector capable of capturing an image of the contour area of the package;
[0014] an image geometric correction module, configured to perform deformation correction on the X-ray image based on a preset geometric deformation correction correspondence relationship to obtain a corrected X-ray image, wherein the preset geometric deformation correction correspondence relationship is a geometric size correspondence relationship between the images collected by the X-ray detector and the contour optical detector;
[0015] an image matching module, configured to match the corrected X-ray image with the contour image;
[0016] a parcel contour determination module, configured to determine a parcel contour area wrapped in the corrected X-ray image based on a contour image matched with the corrected X-ray image;
[0017] An image segmentation module is used to segment the corrected X-ray image based on the package contour area to obtain a package image.
[0018] In a third aspect, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;
[0019] Memory for storing computer programs;
[0020] The processor is configured to implement any of the method steps described in the first aspect when executing a program stored in the memory.
[0021] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of the first aspects are implemented.
[0022] Beneficial effects of the embodiments of the present invention:
[0023] Using the method provided by the embodiments of the present invention, since the contour optical detector is a light detector capable of capturing images of the package's contour area, deformation correction can be performed on the X-ray image based on a preset geometric deformation correction correspondence. This allows the corrected X-ray image to accurately match the contour image in terms of the object's contour. Using the contour image that accurately matches the corrected X-ray image, the package contour area of each package in the corrected X-ray image can be determined, allowing for accurate segmentation of each package image in the corrected X-ray image. In other words, using the contour image that matches the X-ray image, the outer contour area of each package in the X-ray image can be determined, allowing for accurate segmentation of each individual package image. This solves the current problem of being unable to accurately segment package images in X-ray images due to the low grayscale value of the low-density outer packaging outline in the X-ray image. Of course, implementing any product or method of the present invention does not necessarily require achieving all of the aforementioned advantages simultaneously. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in 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 only some embodiments of the present invention. For ordinary technicians in this field, other embodiments can also be obtained based on these drawings.
[0025] Figure 1 A schematic diagram of the imaging principle of X-ray security inspection equipment;
[0026] FIG2(A) is a schematic diagram of package image segmentation using the infrared light barrier segmentation method;
[0027] FIG2(B) is another schematic diagram of using the infrared light barrier segmentation method to perform package image segmentation;
[0028] Figure 3(A) is an actual image of a package;
[0029] FIG3(B) is a schematic diagram of a segmented package image obtained by using the X-ray package image segmentation method;
[0030] Figure 4 A flow chart of a package image segmentation method provided by an embodiment of the present invention;
[0031] Figure 5 A schematic structural diagram of a security inspection device provided by an embodiment of the present invention;
[0032] FIG6(A) is a schematic diagram of X-ray image geometric deformation correction according to an embodiment of the present invention;
[0033] FIG6(B) is another schematic diagram of X-ray image geometric deformation correction according to an embodiment of the present invention;
[0034] FIG6(C) is another schematic diagram of X-ray image geometric deformation correction according to an embodiment of the present invention;
[0035] Figure 7 A flowchart for determining a package outline area provided by an embodiment of the present invention;
[0036] Figure 8(A) shows the actual package image;
[0037] Figure 8(B) shows the package image captured by the X-ray detector;
[0038] Figure 8(C) shows the package image captured by the contour optical detector;
[0039] FIG8(D) is a package contour mask image extracted based on the package image acquired by the contour optical detector;
[0040] Figure 8(E) shows the package image obtained by segmenting the package image collected by the X-ray detector.
[0041] Figure 9 A schematic diagram of the security inspection equipment system structure provided by an embodiment of the present invention;
[0042] Figure 10 A schematic structural diagram of a package image segmentation device provided by an embodiment of the present invention.
[0043] Figure 11 A schematic structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0044] The following will be combined with the accompanying drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the embodiments described are only 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 based on this application are within the scope of protection of the present invention.
[0045] The following are the professional terms involved in the embodiments of the present invention:
[0046] Security inspection equipment: a device that uses an X-ray source and a linear array detector to inspect objects;
[0047] Integration time: the time it takes for the detector of the security inspection equipment to collect a set of signals;
[0048] Full load image: An image captured by the X-ray detector of the security inspection equipment when there is no package in the equipment and the X-ray source and detector are turned on.
[0049] Background image: The image collected by the X-ray detector of the security inspection equipment when the X-ray source is turned off and the X-ray detector is on. The data in the image is usually dark current offset and noise;
[0050] Full-load background correction: Normalizes images collected by the security equipment's X-ray detector at different pixel levels to eliminate the effects of factors such as the equipment's geometric structure and X-ray detector inconsistencies on the image.
[0051] Image segmentation: Image processing to identify background pixels and foreground pixels in an image;
[0052] Image segmentation mask: The result of the image segmentation algorithm, generally the background pixel value is 0 and the foreground pixel value is 1.
[0053] Security inspection equipment can be used for security checks at entrances and exits of facilities like airports, railways, and museums, as well as in industrial non-destructive testing scenarios like postal and express delivery. It can also be used for non-destructive testing of packages in these industrial scenarios. X-ray security inspection equipment is commonly used. Due to its high energy and penetrating power, X-rays can quickly image the internal structure of objects without contacting or damaging the surface. Therefore, X-ray security inspection equipment that uses X-rays as its detection radiation can be used.
[0054] X-ray security inspection equipment may include: a ray source, a collimator, a detector, a transmission structure and an image processing unit, wherein the transmission structure can usually be a roller, and the detector of the security inspection equipment can be a linear array detector.
[0055] Figure 1A schematic diagram of the imaging principle of X-ray security inspection equipment is shown in Figure 2. Figure 1 As shown, the mode of X-ray scanning of objects is a line scanning mode, and its imaging process is specifically as follows: the ray source 101 emits X-rays, which are collimated into a fan-shaped beam by a collimator and reach the detector 102 to form a scanning plane; the object to be detected 103 passes through the scanning plane under the drive of the conveying structure 104 (roller); in the process of the object to be detected 103 passing through the scanning plane, the detector 102 continuously measures the X-ray signals that pass through the object to be detected 103 and reach the detector 102, and the time of each continuous measurement is called an integration time. After each continuous measurement, a series of image signals can be output, which is called a strip image; the image processing unit can splice a series of strip images in the order of acquisition time to obtain the imaging result image 105 of the object to be detected.
[0056] In nondestructive package inspection scenarios involving postal and express delivery industries, due to the large number of packages, currently commonly used package image segmentation methods are unable to accurately segment package images. For example, Figure 2(A) is a schematic diagram of package image segmentation using an infrared light barrier segmentation method, and Figure 2(B) is a schematic diagram of another package image segmentation method using an infrared light barrier segmentation method. Both Figures 2(A) and 2(B) use the commonly used infrared light barrier segmentation method to segment package images. As shown in Figure 2(A), there is a blank space between package 1 and package 2 along the direction from the light barrier transmitter to the light barrier receiver. Therefore, during image segmentation, the images of package 1 and package 2 can be completely separated based on this blank space. As shown in Figure 2(B), there is no blank space between package 1 and package 2 along the direction from the light barrier transmitter to the light barrier receiver. Therefore, during image segmentation, the images of package 1 and package 2 cannot be completely separated, that is, the package images cannot be accurately segmented. For another example, Figure 3(A) is an actual package image, and Figure 3(B) is a schematic diagram of a segmented package image obtained using the X-ray package image segmentation method. The segmented package image shown in Figure 3(B) corresponds to the actual package image shown in Figure 3(A). As shown in Figure 3(A), actual package 301 is a low-density packaging bag, such as a plastic bag, containing packages 1 and 2. Due to the strong penetrating power of X-rays, the low-density outer packaging outline of the packages is almost invisible in the X-ray image. Therefore, as shown in Figure 3(B), the low-density outer packaging of actual package 301 in Figure 3(A) is almost invisible in the captured X-ray image. Therefore, when segmenting the image shown in Figure 3(B), packages 1 and 2, which actually belong to the same package, are separated into two separate packages, resulting in incorrect package image segmentation.
[0057] Therefore, in order to achieve accurate segmentation of images of each independent package, embodiments of the present invention provide a package image segmentation method, apparatus, electronic device, computer-readable storage medium, and computer program product.
[0058] The following first introduces the package image segmentation method provided by the embodiment of the present invention. The package image segmentation method provided by the embodiment of the present invention can be applied to any electronic device with image processing function, such as security inspection equipment, and is not specifically limited here.
[0059] Figure 4 A flowchart of a package image segmentation method provided in an embodiment of the present invention is provided. The method is applied to an image processing device configured to process images captured by security inspection equipment, wherein the security inspection equipment includes an X-ray detector. The method includes:
[0060] S401 , acquiring a contour image captured by the contour optical detector and an X-ray image captured by the X-ray detector when a package passes through a security inspection device.
[0061] The contour optical detector is a light detector capable of capturing an image of the contour area of a package. Specifically, the contour optical detector may be a visible light detector or an infrared detector.
[0062] In one possible implementation, Figure 5 A schematic diagram of the structure of the security inspection equipment provided by the embodiment of the present invention. Figure 5 As shown, the X-ray detector uses an X-ray linear array detector, and the contour optical detector can use a visible light detector, specifically a visible light array detector. The hardware structure of the security inspection equipment includes: an X-ray linear array detector 501, an X-ray source 502, a visible light array detector 503, a conveying structure (roller) 504 and a collimator, wherein the imaging focus of the visible light array detector is at the same horizontal position as the focus of the X-ray source. If the contour optical detector uses an infrared detector, then directly Figure 5 The visible light detector in the image can be replaced with an infrared detector, and other hardware devices remain unchanged.
[0063] like Figure 5 As shown, package 505 is driven by roller 504 and moves in the direction indicated by the arrow. After entering the security inspection equipment, package 505 first passes through visible light array detector 503 and then passes through X-ray linear array detector 501. When the package passes through visible light array detector 503, visible light array detector 503 is turned on to capture a visible light image as a contour image. After the contour image is captured, the X-ray source is turned on when the package passes through X-ray linear array detector 501 to capture an X-ray image.
[0064] In the image segmentation msk step, a visible light image segmentation mask can be obtained. The collected X-ray image is matched with the visible light image to obtain a matching X-ray image and visible light image. In the mask background shielding step, the visible light image segmentation mask can be used to shield the background pixels of the matched X-ray image. In the image post-processing and stitching step, the X-ray image after background pixel shielding can be subjected to image post-processing, such as full-load background correction, grayscale fusion, image enhancement processing, dual-energy resolution processing and other security inspection image processing operations. If the collected visible light image and X-ray image are strip images, image stitching processing can also be performed. Then, in the step of further segmenting the image using the mask to extract the package image, the visible light image segmentation mask can be used to further segment the image obtained by image post-processing and image stitching to extract the package image.
[0065] S402: Based on a preset geometric deformation correction correspondence, the X-ray image is subjected to deformation correction to obtain a corrected X-ray image.
[0066] The preset geometric deformation correction correspondence is a geometric size correspondence between images collected by the X-ray detector and the contour optical detector.
[0067] S403: Match the corrected X-ray image with the contour image.
[0068] S404: Determine a parcel contour area parceled in the corrected X-ray image according to the contour image matched with the corrected X-ray image.
[0069] S405 , segmenting the corrected X-ray image based on the package contour area to obtain a package image.
[0070] Using the method provided by an embodiment of the present invention, since the contour optical detector is a light detector capable of capturing images of the contour area of a package, deformation correction can be performed on the X-ray image based on a preset geometric deformation correction correspondence, allowing the corrected X-ray image to accurately match the contour image in terms of the object contour. Using the contour image that accurately matches the corrected X-ray image, the package contour area of each package in the corrected X-ray image can be determined, and the images of each package in the corrected X-ray image can then be accurately segmented. In other words, using the contour image that matches the X-ray image, the outer contour area of each package in the X-ray image can be determined, allowing the images of each individual package to be accurately segmented. This solves the current problem of being unable to accurately segment the package images in the X-ray image due to the low grayscale value of the low-density outer packaging contour in the X-ray image.
[0071] Due to the differences in characteristics such as pixel size and magnification ratio between X-ray detectors and profile optical detectors, and the different imaging angles between the imaging planes of X-ray detectors and profile optical detectors, these differences result in a certain degree of image deformation and scale magnification changes in the imaging of X-ray detectors relative to that of profile optical detectors.
[0072] In an embodiment of the present invention, since the radiation source focal point of the X-ray detector and the imaging focal point of the profile optical detector are on the same horizontal line, that is, the imaging focal point of the profile optical detector and the X-ray focal point are fixed on the same horizontal line in the horizontal movement direction of the package, when performing deformation correction on the X-ray image, the imaging focal points of the X-ray image and the profile image can be assumed to be at the same position. Furthermore, based on the imaging principles and specific structural relationship between the X-ray detector and the profile optical detector, the projective relationship between the X-ray image and the profile image can be determined. This also allows for a simpler and more accurate determination of the geometric dimension correspondence between the images captured by the X-ray detector and the profile optical detector, i.e., the preset geometric deformation correction correspondence. The profile image captured by the profile optical detector is an image showing the outline of the package.
[0073] Therefore, when designing the structure of the security inspection equipment, the X-ray source focus of the X-ray detector and the imaging focus of the contour optical detector can be set at the same horizontal position. Figure 5 As shown, the imaging focus of the visible light array detector and the focus of the X-ray source are fixed on the same horizontal line in the horizontal movement direction of the object.
[0074] To accurately match the X-ray detector's imaging results (X-ray image) with the contour optical detector's imaging results (contour image) within the object's contour region, embodiments of the present invention predetermine the geometrical dimension correspondence between the images captured by the X-ray detector and the contour optical detector, yielding a preset geometrical deformation correction correspondence. After deformation correction is performed on the X-ray image based on the preset geometrical deformation correction correspondence, the corrected X-ray image is consistent with the image obtained by projecting the X-ray detector's imaging results onto the contour optical detector's imaging plane. This allows for convenient matching of the corrected X-ray image with the contour image.
[0075] As an implementation of an embodiment of the present invention, for the case where the ray source focus of the X-ray detector and the imaging focus of the profile optical detector are at the same horizontal position, the method for determining the preset geometric deformation correction correspondence relationship may include:
[0076] Based on the preset geometric position relationship between each detection plate of the X-ray detector and the preset equivalent detection plane position of the contour optical detector, the projection scale factor between each pixel detected by the X-ray detector and the corresponding pixel after projecting the pixel onto the preset equivalent detection plane of the contour optical detector is calculated as the preset geometric deformation correction correspondence relationship.
[0077] Performing deformation correction on the X-ray image is equivalent to projecting the X-ray image onto the imaging plane of the profile optical detector (i.e., the preset equivalent detection plane), that is, projecting each pixel detected by the X-ray detector onto the preset equivalent detection plane of the profile optical detector. The X-ray detector is generally composed of multiple detection plates, the position of each detection plate is known, and the installation position of the profile optical detector is determined, so the preset equivalent detection plane position is also known.
[0078] Therefore, the preset geometric position relationship between each detection plate of the X-ray detector and the preset equivalent detection plane position of the contour optical detector can be determined. Based on the preset geometric position relationship, the projection scale factor between each pixel detected by the X-ray detector and the corresponding pixel after projecting the pixel onto the preset equivalent detection plane of the contour optical detector can be calculated. The projection scale factor can be used as the preset geometric deformation correction correspondence relationship.
[0079] In one embodiment, the X-ray detector is an L-shaped detector. FIG6(A) is a schematic diagram of X-ray image geometric deformation correction provided by an embodiment of the present invention. FIG6(A) shows a schematic diagram of the imaging principle of the X-ray detector and the profile optical detector, taken along the direction of package movement. The profile optical detector is a visible light detector. Since the X-ray source focus of the X-ray detector and the imaging focus of the profile optical detector are on the same horizontal line, in FIG6(A), the X-ray source focus and the imaging focus of the visible light detector can be considered to overlap at one point. The visible light detector collects the profile image using the pinhole imaging principle. The profile image is on the actual visible light detection plane. Therefore, based on the pinhole imaging principle, the visible light equivalent detection plane corresponding to the actual visible light detection plane can be determined. The X-ray L-shaped detector includes multiple detection plates, each detection plate corresponds to a sub-detection plane 601, and the multiple sub-detection planes 601 constitute the L-shaped detection plane of the X-ray L-shaped detector.
[0080] As shown in Figure 6(A), when each sub-detection plane 601 is projected onto the visible light equivalent detection plane, the corresponding plane is the visible photon detection plane 602. For example, when sub-detection plane X1 is projected onto the visible light equivalent detection plane, the corresponding plane is the visible photon detection plane L1; when sub-detection plane X2 is projected onto the visible light equivalent detection plane, the corresponding plane is the visible photon detection plane L2. Each detection plate of the X-ray detector corresponds to a sub-plane on the visible light equivalent detection plane.
[0081] In another embodiment, the X-ray detector is an arc detector. FIG6(B) is another schematic diagram of X-ray image geometric deformation correction provided by an embodiment of the present invention. FIG6(B) shows a schematic diagram of the imaging principle of the X-ray detector and the profile optical detector, taken along the direction of package travel. The profile optical detector is a visible light detector. Because the X-ray source focus of the X-ray detector and the imaging focus of the profile optical detector are on the same horizontal line, in FIG6(B), the X-ray source focus and the imaging focus of the visible light detector can be considered to overlap at a point. The visible light detector captures the profile image using the pinhole imaging principle. The profile image is on the actual visible light detection plane. Therefore, based on the pinhole imaging principle, the visible light equivalent detection plane corresponding to the actual visible light detection plane can be determined. The X-ray arc detector includes multiple detection plates, each of which corresponds to a sub-detection plane 603. The multiple sub-detection planes 603 constitute the arc detection plane of the X-ray arc detector.
[0082] As shown in Figure 6(B), when each sub-detection plane 603 is projected onto the visible light equivalent detection plane, the corresponding plane is a visible photon detection plane 604. For example, when sub-detection plane Y1 is projected onto the visible light equivalent detection plane, the corresponding plane is visible photon detection plane L1; when sub-detection plane Y2 is projected onto the visible light equivalent detection plane, the corresponding plane is visible photon detection plane L2. Each detection plate of the X-ray detector corresponds to a sub-plane on the visible light equivalent detection plane.
[0083] In another embodiment, the X-ray detector is a linear detector. FIG6(C) is another schematic diagram of X-ray image geometric deformation correction provided by an embodiment of the present invention. FIG6(C) shows a schematic diagram of the imaging principle of the X-ray detector and the profile optical detector, taken along the direction of package travel. The profile optical detector is a visible light detector. Because the X-ray source focus of the X-ray detector and the imaging focus of the profile optical detector are on the same horizontal line, in FIG6(C), the X-ray source focus and the imaging focus of the visible light detector can be considered to overlap at a point. The visible light detector captures the profile image using the pinhole imaging principle. The profile image is on the actual visible light detection plane. Therefore, based on the pinhole imaging principle, the visible light equivalent detection plane corresponding to the actual visible light detection plane can be determined. The X-ray arc detector includes multiple detection plates, each of which corresponds to a sub-detection plane 605. The multiple sub-detection planes 605 constitute the linear detection plane of the X-ray linear detector.
[0084] As shown in Figure 6(C), when each sub-detection plane 605 is projected onto the visible light equivalent detection plane, the corresponding plane is a visible photon detection plane 606. For example, when sub-detection plane Z1 is projected onto the visible light equivalent detection plane, the corresponding plane is visible photon detection plane L1; when sub-detection plane Z2 is projected onto the visible light equivalent detection plane, the corresponding plane is visible photon detection plane L2. Each detection plate of the X-ray detector corresponds to a sub-plane on the visible light equivalent detection plane.
[0085] Therefore, for each pixel detected by each detection plate of the X-ray detector, since the positional relationship between each detected pixel and the detection plate is determined by the structure of the detection plate and is known, based on the preset geometric positional relationship between the detection plate and the preset equivalent detection plane position of the profile optical detector, the projection scale factor between the pixel and the corresponding pixel after projecting the pixel onto the preset equivalent detection plane of the profile optical detector can be calculated and used as the preset geometric deformation correction correspondence.
[0086] In this embodiment, the X-ray detector's radiation source focal point can be co-located with the profile optical detector's imaging focal point. Based on a preset geometric positional relationship between each detector plate of the X-ray detector and a preset equivalent detection plane position of the profile optical detector, the electronic device can calculate a projection scale factor between each pixel detected by the X-ray detector and the corresponding pixel after projecting the pixel onto the preset equivalent detection plane of the profile optical detector, and use the calculated scale factor as a preset geometric deformation correction correspondence. This allows for quick and accurate determination of the preset geometric deformation correction correspondence, ensuring accurate deformation correction of subsequent X-ray images and obtaining an accurately corrected X-ray image.
[0087] As an implementation of an embodiment of the present invention, the deformation correction of the X-ray image based on the preset geometric deformation correction correspondence to obtain the corrected X-ray image may include the following steps A1-A3:
[0088] Step A1: For each pixel of the X-ray image, determine the target pixel corresponding to the pixel after the pixel is projected onto the equivalent detection plane of the contour optical detector based on the projection scale factor corresponding to the pixel and the position of the pixel in the X-ray image.
[0089] The projection scale factor corresponding to each pixel in the X-ray image identifies the geometric relationship between the corresponding pixels after the pixel is projected onto the preset equivalent detection plane of the profile optical detector. Therefore, based on the projection scale factor corresponding to each pixel, the target pixel corresponding to the pixel after the pixel is projected onto the equivalent detection plane of the profile optical detector can be determined.
[0090] In one embodiment, the corresponding target pixel can be calculated for each pixel in the X-ray image. Since the positional relationship between the same detection plate and the preset equivalent detection plane position is fixed, the projection scale factors corresponding to the pixels corresponding to the detection plate can be considered to be the same.
[0091] The positional relationship of the detection sub-planes corresponding to each detection plate is determined. Therefore, in another embodiment, the geometric deformation correction of the X-ray image shown in FIG6(A) is used as an example for illustration. If the projection scale factor corresponding to the projection of the pixel located on the X-ray detection sub-plane X1 in FIG6(A) onto L1 is calculated to be Z1, then for the pixel located on the X-ray detection sub-plane X2, the pixel position corresponding to the pixel located on the X-ray detection sub-plane X2 after being projected onto the equivalent detection plane of the profile optical detector can be calculated using the following cumulative determination formula:
[0092]
[0093] Among them, R(N) is the cumulative value of the scale factor corresponding to the Nth pixel of the X-ray detector, that is, the cumulative value of the projection scale factor corresponding to the 1st pixel - the Nth pixel of the X-ray image, Z n The projection scale factor of the pixel with index coordinate n, that is, the projection scale factor corresponding to the nth pixel. If R(N) is not an integer, its integer value can be used as the value of R(N).
[0094] Exemplarily, for the second pixel located on the X-ray detection sub-plane X2, assuming that there are 10 pixels on the X-ray detection sub-plane X1, then the second pixel on the X-ray detection sub-plane X2 is the 12th pixel, and its corresponding scale factor cumulative value R(12)=Z1+Z2 can be calculated, wherein Z1 is the cumulative value of the projection scale factors corresponding to the 10 pixels located on the X-ray detection sub-plane X1 projected onto the visible photon detection plane L1, and Z2 is the cumulative value of the projection scale factors corresponding to the 1st and 2nd pixels located on the X-ray detection sub-plane X2 projected onto the visible photon detection plane L2. Then, the R(12)th pixel starting from the visible photon detection plane L1 in the equivalent detection plane of the profile optical detector can be determined as the target pixel corresponding to the second pixel located on the X-ray detection sub-plane X2 after being projected onto the equivalent detection plane of the profile optical detector.
[0095] Step A2: Calculate the corrected grayscale value corresponding to the pixel according to the grayscale values of the adjacent pixels of the pixel and a preset correction coefficient.
[0096] Through the above steps, the mapping relationship between each pixel of the X-ray image and the corresponding target pixel can be obtained, that is, the position mapping relationship between the image pixel before correction and the pixel after correction. However, the grayscale value of each pixel of the X-ray image may change during the projection process. In order to improve the accuracy of the corrected X-ray image, an interpolation index correction table can be established based on the position mapping relationship. The length of the index correction table is the total number of pixels in the actual detection plane of the profile optical detector. That is, the number of indices included in the index correction table is the total number of pixels in the actual detection plane of the profile optical detector. Each index includes the grayscale values of the two adjacent pixels of the pixel in the pre-correction image corresponding to the target pixel corresponding to the index, that is, P n With P (n+1) , and a preset correction coefficient F, which can be set as a floating point number between 0 and 1 and can be set according to the actual correction scenario. The grayscale value of each pixel in the corrected image can be calculated by combining the grayscale values of the two adjacent pixels of the corresponding pre-corrected image pixel and the preset correction coefficient F, for example, it can be (1-F)×P n +P n+1 ×F.
[0097] In one embodiment, the index correction table may be as shown in the following table:
[0098] index Target pixel Grayscale values of adjacent pixels of the image pixel before correction Preset correction factor Index 1 Target pixel 1 Pa; Pb F1 Index 2 Target pixel 2 Pc; Pd F2 Index 3 Target pixel 3 Pe;Pf F3 … … … …
[0099] Step A3: determining the corrected grayscale value as the grayscale value of the target pixel to obtain a corrected X-ray image.
[0100] After obtaining the corrected grayscale value corresponding to each pixel, the corrected grayscale value can be determined as the grayscale value of the target pixel corresponding to the pixel, and then a corrected X-ray image can be obtained.
[0101] In this embodiment, the electronic device can project each pixel of the X-ray image onto the equivalent detection plane of the profile optical detector based on the projection scale factor. Based on the grayscale values of its neighboring pixels and a preset correction coefficient, the electronic device calculates a corrected grayscale value for each pixel. This corrected grayscale value is then determined as the grayscale value of the target pixel corresponding to each pixel, thereby generating a corrected X-ray image. By projecting each pixel and correcting its grayscale, the resulting corrected X-ray image is more accurate.
[0102] As an implementation manner of an embodiment of the present invention, the above-mentioned calculation of the projection scale factor between each pixel detected by the X-ray detector and the corresponding pixel after projecting the pixel onto the preset equivalent detection plane of the profile optical detector based on the preset geometric position relationship between each detection plate of the X-ray detector and the preset equivalent detection plane position of the profile optical detector may include the following steps B1-B5:
[0103] Step B1: Calculate a first ratio between the number of pixels of the actual detection plane of the profile optical detector and the preset equivalent detection plane length of the profile optical detector.
[0104] For a profile image captured by a profile optical detector, the image processing device can determine the number of pixels in the actual detection plane of the profile optical detector and the preset equivalent detection plane length of the profile optical detector. The number of pixels in the actual detection plane can represent the size characteristics of the actual object corresponding to the profile image, and the preset equivalent detection plane length can represent the size characteristics of the profile image. Furthermore, a first ratio of the number of pixels in the actual detection plane to the preset equivalent detection plane length is calculated. This first ratio can represent the magnification ratio of the profile image captured by the profile optical detector.
[0105] Step B2: for each detection plate of the X-ray detector, based on a preset geometric position relationship between the detection plate and a preset equivalent detection plane position of the profile optical detector, calculate the corresponding length of the detection plate in the preset equivalent detection plane.
[0106] Based on the preset geometric position relationship between each detection plate of the X-ray detector and the preset equivalent detection plane position of the contour optical detector, the image processing device can calculate the corresponding length of the detection plate in the preset equivalent detection plane, and the corresponding length can represent the corresponding magnification ratio of the part of the X-ray image collected by the detection plate projected onto the preset equivalent detection plane of the contour optical detector.
[0107] Step B3: Calculate a second ratio between the corresponding length and the actual number of detection pixels of the detection plate.
[0108] The image processing device can determine the actual number of detected pixels of each detector panel. The actual number of detected pixels can represent a characteristic of the pixel size of the X-ray image captured by the detector panel. The second ratio between the corresponding length and the actual number of detected pixels can represent the magnification ratio between the pixels in the portion of the X-ray image captured by the detector panel and the corresponding length.
[0109] Step B4: multiplying the first ratio by the second ratio corresponding to the detection plate to determine the target projection scaling factor between the preset position pixel detected by the detection plate and the corresponding pixel after the preset position pixel is projected onto the preset equivalent detection plane of the contour optical detector.
[0110] Furthermore, the image processing device can calculate the product of the first ratio and the second ratio corresponding to the detection plate. The product of the first ratio and the second ratio corresponding to the detection plate can characterize the projection relationship between the corresponding pixels in the detection plate of the X-ray detector after being projected onto the preset equivalent detection plane of the contour optical detector. Therefore, the product can be determined as the target projection scale factor between the preset position pixel detected by the detection plate and the corresponding pixel after the preset position pixel is projected onto the preset equivalent detection plane of the contour optical detector.
[0111] The preset position pixel can generally be set as the pixel at the middle position of the detection plate. For example, for each detection plate of the X-ray detector, the target projection scale factor between the preset position pixel detected by the detection plate and the corresponding pixel after the preset position pixel is projected onto the preset equivalent detection plane of the profile optical detector can be calculated using the following formula:
[0112]
[0113] Among them, X1 is the actual detection pixel number of the detection plate, that is, the length of the X-ray detection plane corresponding to the pixels of the detection plate, L1 is the corresponding length of the detection plate in the preset equivalent detection plane, that is, the length of the area corresponding to the pixels of the detection plate projected onto the equivalent detection plane of the profile optical detector, M is the number of pixels of the actual detection plane of the profile optical detector, L is the preset equivalent detection plane length of the profile optical detector, and Z is the target projection scale factor between the preset position pixel detected by the detection plate and the corresponding pixel after the preset position pixel is projected onto the preset equivalent detection plane of the profile optical detector.
[0114] Step B5: Based on the positional relationship between other pixels in the detection plate and the pixel at the preset position, interpolation processing is performed on the target projection scale factor to obtain projection scale factors corresponding to other pixels.
[0115] For each detection plate, after calculating the target projection scale factor corresponding to the pixel at the preset position, since the positional relationship between each detection plate is fixed, that is, the positional relationship between other pixels in the detection plate and the pixel at the preset position is fixed, it is not necessary to repeat the above steps for the pixel at each position. Based on the positional relationship between other pixels in the detection plate and the pixel at the preset position, the target projection scale factor can be interpolated to obtain the projection scale factors corresponding to other pixels.
[0116] In this embodiment, the electronic device can calculate the product of the first ratio and the second ratio based on the first ratio between the number of pixels of the actual detection plane of the profile optical detector and the preset equivalent detection plane length, and the second ratio between the corresponding length of each detection plate of the X-ray detector in the preset equivalent detection plane and the actual number of detection pixels of the detection plate. The product represents the difference between the profile image and the X-ray image in terms of pixel size and magnification ratio, and can be used as the target projection scale factor corresponding to the pixel at the preset position. The target projection scale factor can then be interpolated to obtain the projection scale factors corresponding to other pixels. The target projection scale factor corresponding to the pixel at the preset position can be accurately determined, and the amount of calculation required to calculate the projection scale factors corresponding to other pixels is reduced by interpolation processing, so that the projection scale factor corresponding to each pixel on the detection plate of the X-ray detector can be obtained more quickly and conveniently.
[0117] As an implementation manner of an embodiment of the present invention, the step of interpolating the target projection scale factor based on the positional relationship between other pixels in the detection plate and the pixel at the preset position to obtain the projection scale factors corresponding to other pixels may include:
[0118] The projection scale factor Z0 of the other pixels is calculated using the following formula:
[0119]
[0120] Among them, l is the number of pixels between the preset position pixels of two adjacent detection plates, l1 is the number of pixels between the other pixels and the preset position pixels of the first detection plate among the two adjacent detection plates, l2 is the number of pixels between the other pixels and the preset position pixels of the second detection plate among the two adjacent detection plates, Z1 is the projection scale factor corresponding to the preset position pixels of the first detection plate, and Z2 is the projection scale factor corresponding to the preset position pixels of the second detection plate.
[0121] The target projection scale factor is interpolated by the above formula to obtain the projection scale factors corresponding to other pixels. The ratio of the number of pixels between the other pixel and the two preset position pixels in the two adjacent detection plates to the number of pixels between the preset position pixels in the two adjacent detection plates is calculated respectively. The ratio can represent the distance between the other pixel and the preset position pixels in the two adjacent detection plates. Since the distance between the other pixel and the preset position pixels in the two adjacent detection plates can represent the degree of influence of the projection scale factor corresponding to the preset position pixel in the corresponding detection plate on the projection scale factor corresponding to the other pixel, the projection scale factor corresponding to the other pixel can be obtained by performing difference calculation on the projection scale factors corresponding to the two preset position pixels based on the ratio.
[0122] In this embodiment, the electronic device can interpolate the target projection scale factor using the above formula based on the positional relationship between the other pixels in the detection plate and the pixel at the preset position to obtain the projection scale factor corresponding to the other pixels. The interpolation process takes into account the influence of the projection scale factor corresponding to the pixels at the preset positions in two adjacent detection plates on the projection scale factor corresponding to the other pixels, thereby obtaining a more accurate projection scale factor for the other pixels.
[0123] As an implementation manner of an embodiment of the present invention, the above-mentioned contour image may be a contour strip image, or the above-mentioned contour image may be a spliced contour image obtained by splicing a target number of contour strip images in the order of acquisition time by the contour optical detector. Similarly, the above-mentioned X-ray image may be an X-ray strip image, or the above-mentioned X-ray image may be a spliced X-ray image obtained by splicing a target number of X-ray strip images in the order of acquisition time by the X-ray detector.
[0124] The above method may further include:
[0125] The acquisition time intervals of images of the same target acquired by the profile optical detector and the X-ray detector when the conveyor belt runs at multiple running speeds are recorded respectively to obtain a corresponding relationship between the running speed and the acquisition time interval.
[0126] In one embodiment, when the X-ray source, X-ray detector, and profile optical detector of the security inspection equipment are turned on, the time intervals between the images of the same target captured by the profile optical detector and the X-ray detector can be recorded respectively when the conveyor belt runs at multiple running speeds, so as to obtain a corresponding relationship between the running speed and the collection time interval.
[0127] Specifically, a conveyor belt marker can be set on the conveyor belt to record the time intervals between images captured by the profile optical detector and the X-ray detector, including the same conveyor belt marker, during a conveyor cycle when the conveyor belt is running at multiple speeds. This allows the corresponding relationship between the operating speed and the time intervals to be determined. The conveyor cycle is the period during which the conveyor belt completes one revolution.
[0128] For example, when the conveyor belt runs at a running speed of v1, within one conveying cycle, the time interval for collecting the conveyor belt mark image by the profile optical detector and the X-ray detector is Δt1, and the recorded running speed v1 corresponds to the time interval Δt1; when the conveyor belt runs at a running speed of v2, within one conveying cycle, the time interval for collecting the conveyor belt mark image by the profile optical detector and the X-ray detector is Δt2, and the recorded running speed v2 corresponds to the time interval Δt2.
[0129] Accordingly, the step of matching the corrected X-ray image with the contour image may include:
[0130] A target acquisition time interval is determined based on the current operating speed of the conveyor belt of the security inspection device and the corresponding relationship. When the contour image is a contour strip image and the X-ray image is an X-ray strip image, for each corrected X-ray image, the contour strip image corresponding to the corrected X-ray image with an acquisition time interval of the target acquisition time interval is determined as the contour strip image that matches the corrected X-ray image; or, when the contour image is a spliced contour image and the X-ray image is a spliced X-ray image, the contour strip image corresponding to the first X-ray strip image of the corrected X-ray image with an acquisition time interval of the target acquisition time interval is determined as the starting contour strip image; and a spliced contour image obtained by splicing the target number of contour strip images, starting from the starting contour strip image and including the starting contour strip image, is determined as the contour image that matches the corrected X-ray image.
[0131] In the first embodiment of the present invention, the contour image is a contour strip image, and the X-ray image is an X-ray strip image. The contour strip image may be acquired by a linear array contour optical detector, and the X-ray strip image may be acquired by a linear array X-ray detector. When the contour image is a contour strip image and the X-ray image is an X-ray strip image, matching the corrected X-ray strip image with the contour strip image may include the following steps C1-C2:
[0132] Step C1 : determining a target collection time interval according to the current running speed of the conveyor belt and the corresponding relationship between the running speed and the collection time interval.
[0133] For example, if the current running speed is v2, the collection time interval corresponding to v2 can be determined to be Δt2 according to the correspondence between the running speed and the collection time interval collected in advance, that is, the target collection time interval is Δt2.
[0134] Step C2: for each corrected X-ray strip image, determine the contour strip image whose acquisition time interval corresponding to the corrected X-ray strip image is the target acquisition time interval as the contour strip image that matches the corrected X-ray strip image.
[0135] The target acquisition time interval is the difference in acquisition time between the corrected X-ray strip image and its matching contour strip image. Therefore, for each corrected X-ray strip image, the contour strip image corresponding to the corrected X-ray strip image with the target acquisition time interval can be determined as the contour strip image matching the corrected X-ray strip image. The target acquisition time interval is the interval between the start acquisition time of the corrected X-ray strip image and the start acquisition time of the matching contour strip image, and the image widths are the same.
[0136] Since the profile optical detector can be positioned before or after the X-ray detector in the direction of package travel, if the profile optical detector is positioned before the X-ray detector, the acquisition time interval corresponding to the corrected X-ray strip image can be defined as the target acquisition time interval, and the profile strip images acquired before the target acquisition time interval can be determined as the profile strip images that match the corrected X-ray strip image. If the profile optical detector is positioned after the X-ray detector, the acquisition time interval corresponding to the corrected X-ray strip image can be defined as the target acquisition time interval, and the profile strip images acquired after the target acquisition time interval can be determined as the profile strip images that match the corrected X-ray strip image.
[0137] In the second case, the contour image is a stitched contour image obtained by stitching together a target number of contour strip images in the order of their acquisition time by the contour optical detector, and the X-ray image is a stitched X-ray image obtained by stitching together a target number of X-ray strip images in the order of their acquisition time by the X-ray detector. That is, after acquiring the X-ray strip images, the target number of X-ray strip images can be stitched together to obtain a stitched X-ray image, and then the stitched X-ray image can be deformed to obtain a corrected X-ray image.
[0138] When the contour image is a stitched contour image and the X-ray image is a stitched X-ray image, for each stitched X-ray image, the contour strip image whose acquisition time interval of the first X-ray strip image corresponding to the corrected X-ray image is the target acquisition time interval can be determined as the starting contour strip image, and then, the stitched contour image obtained by stitching a target number of contour strip images starting from the starting contour strip image and including the starting contour strip image can be determined as the contour image matching the corrected X-ray image.
[0139] The target acquisition time interval is the difference in acquisition time between the corrected X-ray strip image and its matching contour strip image. Therefore, for each corrected X-ray strip image, a spliced contour strip image whose acquisition time interval corresponding to the corrected X-ray strip image is the target acquisition time interval can be determined as the contour strip image matching the corrected X-ray strip image. The spliced contour strip image is an image obtained by splicing contour strip images starting from the starting contour strip image and including the same number of starting contour strip images as the number of ray strip images included in the spliced ray image.
[0140] The starting contour strip image, i.e., the first X-ray strip image corresponding to the corrected X-ray image, is a contour strip image whose acquisition time interval is the target acquisition time interval. Thus, the acquisition time interval between the first X-ray strip image in the corrected X-ray strip image and the first contour strip image included in the matching spliced contour image is the target acquisition time interval, and the image widths of the corrected X-ray image and the spliced contour image are the same.
[0141] Similarly, since the profile optical detector can be positioned before or after the X-ray detector in the package running direction, if the profile optical detector is positioned before the X-ray detector, the acquisition time of the first X-ray strip image in the corrected X-ray strip image is later than the acquisition time interval of the first contour line strip image included in the corresponding spliced contour image. If the profile optical detector is positioned after the X-ray detector, the acquisition time of the first X-ray strip image in the corrected X-ray strip image is earlier than the acquisition time interval of the first contour line strip image included in the corresponding spliced contour image.
[0142] For example, if the profile optical detector is placed before the X-ray detector, the number of targets is 10, and the target acquisition interval is 5 seconds, the profile strip image acquired before the first X-ray strip image corresponding to the corrected X-ray image, and the acquisition interval with the first X-ray strip image corresponding to the corrected X-ray image is 5 seconds, can be determined as the starting profile strip image. This starting profile strip image is then used as the first profile strip image and is spliced with the nine subsequent profile strip images in chronological order to obtain a spliced profile image that matches the corrected X-ray image.
[0143] In this embodiment, the contour image can be a contour strip image, or a spliced contour image obtained by splicing a preset number of contour strip images in the order of acquisition time by the contour optical detector. The X-ray image can be an X-ray strip image, or a spliced X-ray image obtained by splicing a target number of X-ray strip images in the order of acquisition time by the X-ray detector. Furthermore, for both strip images and spliced images, the corrected X-ray image can be accurately matched with the contour image, thus broadening the applicability of the package image segmentation method provided by the embodiments of the present invention.
[0144] In one embodiment, Figure 7 A flow chart for determining the package contour area provided by an embodiment of the present invention is as follows: Figure 7 As shown, determining the parcel contour area wrapped in the corrected X-ray image based on the contour image matched with the corrected X-ray image includes:
[0145] S701 , based on the background image pre-collected by the contour optical detector, removing the background area in the contour image that matches the corrected X-ray image to obtain a wrapped silhouette image.
[0146] In an embodiment of the present invention, an image of the contour optical detector when no package passes through can be collected in advance and saved as a background image. During the actual scanning, a grayscale difference is performed between the contour image that matches the corrected X-ray image and the corresponding background image to obtain a silhouette image of the package after removing the influence of background pixels.
[0147] S702 , performing grayscale segmentation on each of the package silhouette images based on differences in image grayscale value distribution, to obtain a package outline mask image corresponding to the package silhouette image, with the package outline area as the image foreground.
[0148] Specifically, since the detection light emitted by the contour optical detector can effectively image the contour of low-density outer packaging, overcoming the imaging defects of X-rays on such materials, the package silhouette image corresponding to the contour image detected by the contour optical detector can be used to more accurately segment the package contour area. Specifically, the following segmentation strategy can be used to obtain the package contour mask image:
[0149] Strategy 1: Traditional image segmentation methods can be used, such as the Otsu method (maximum inter-class variance method) to obtain the optimal segmentation grayscale threshold, or the optimal segmentation grayscale threshold can be manually set. The grayscale values of pixels in the wrapped silhouette image with grayscale values less than the optimal segmentation grayscale threshold are set to 0, and the grayscale values of pixels in the wrapped silhouette image with grayscale values not less than the optimal segmentation grayscale threshold are set to 1. This yields a wrapped silhouette mask image (mask image) corresponding to the wrapped silhouette image, with the wrapped silhouette area as the image foreground.
[0150] Strategy 2: Deep learning segmentation can be used: Use a segmentation network such as U-net to segment the package silhouette image and obtain a package contour mask image corresponding to the package silhouette image, with the package contour area as the image foreground.
[0151] S703: Determine a package contour area in the corrected X-ray image according to the package contour mask image.
[0152] Specifically, this step can be performed by setting pixels in an area of the corrected X-ray image other than the area corresponding to the parcel contour area in the parcel contour mask image, based on the parcel contour mask image corresponding to the contour image matching the corrected X-ray image, as preset background pixels to obtain the parcel contour area in the corrected X-ray image. The grayscale value of the preset background pixels can be set to 0.
[0153] That is, this step can utilize the wrapped contour mask image corresponding to the contour image matching the corrected X-ray image to shield the background pixels of the corrected X-ray image.
[0154] Moreover, in the subsequent full-load background correction process of the corrected X-ray image, only the pixel area with a grayscale value not equal to 0 in the corrected X-ray image can be corrected, and the pixels in the area with a grayscale value of 0 in the corrected X-ray strip image can be directly set to the set background pixel value. In this way, while determining the wrapped contour area in the corrected X-ray image, the background correction artifacts caused by the full-load background correction error in the background image can also be effectively removed, thereby improving the image quality.
[0155] In this embodiment, the corrected X-ray image and contour image can be strip images or spliced images derived from the strip images, which is reasonable. Accordingly, the resulting package silhouette image can be a strip image or a spliced image derived from the strip images. This does not affect the process of determining the package contour area and is not specifically limited here.
[0156] In one embodiment, segmenting the corrected X-ray image based on the package contour region to obtain the package image may include the following steps D1-D3:
[0157] Step D1: Acquire a full-load image of the security inspection equipment and a background image of the security inspection equipment pre-collected by the X-ray detector.
[0158] Specifically, after determining the conveying cycle corresponding to the current running speed of the conveyor belt, the image of the security inspection equipment within the conveying cycle can be collected as a fully loaded image of the security inspection equipment when no package passes through the security inspection equipment and the X-ray source and X-ray detector of the security inspection equipment are both turned on.
[0159] When the X-ray source is turned off and the X-ray detector is turned on, the image collected by the detector of the security inspection equipment is used as the background image of the security inspection equipment. The image usually contains dark current offset and noise.
[0160] Step D2: Based on the full-load image of the security inspection equipment and the background image of the security inspection equipment, perform full-load background correction on the corrected X-ray image including the package outline area to obtain a corresponding target correction image.
[0161] In this step, the full image corresponding to the corrected X-ray image corresponding to the parcel contour area can be determined in advance, and then the pixel grayscale of the target corrected image can be calculated based on the following formula:
[0162] (Pixel grayscale of the corrected X-ray image corresponding to the wrapped contour area - pixel grayscale of the background image) / (pixel grayscale of the fully loaded image - pixel grayscale of the background image) = pixel grayscale of the target corrected image.
[0163] The above formulas are all calculated for pixels at the same position in each image, so as to obtain the pixel grayscale of each pixel in the target corrected image.
[0164] Step D3, segmenting the package contour area in the target corrected image to obtain a package image.
[0165] After obtaining the target correction image, the package contour area in the target correction image can be directly segmented to obtain the package image.
[0166] In this embodiment, the image processing device can obtain a fully loaded image and a background image of the security inspection equipment, pre-captured by the X-ray detector. Based on the fully loaded and background images, the corrected X-ray image, including the package outline, is corrected for the fully loaded image to obtain a corresponding target corrected image. The package outline in the target corrected image is then segmented to obtain a package image. This allows image segmentation based on the fully loaded background corrected target corrected image to eliminate the effects of geometric structure, detector inconsistencies, and other factors on the package image, resulting in a more accurate package image.
[0167] As an implementation of an embodiment of the present invention, the X-ray detector may include multiple detectors configured to capture grayscale images corresponding to X-rays of different radiation energies. In this case, the step of segmenting the package contour region in the target correction image to obtain the package image may include:
[0168] The grayscale images corresponding to the target correction image collected by each detector are fused to obtain a target grayscale fused image; and the package contour area in the target grayscale fused image is segmented to obtain a package image.
[0169] In one embodiment, since the X-ray source can simultaneously emit multiple X-rays with different radiation energies, in order to obtain the best possible X-ray image, the X-ray detector may include multiple detectors, each of which can be used to collect grayscale images corresponding to X-rays with different radiation energies.
[0170] The image processing device can then fuse the grayscale images corresponding to the target correction image captured by each detector to produce a target grayscale fused image. An X-ray detector comprising multiple detectors can typically capture grayscale images corresponding to at least two X-rays of different radiation energies. These multiple grayscale images at different radiation energies can then be fused to produce a target grayscale fused image. Furthermore, the package contour region within the target grayscale fused image can be segmented to produce a package image. Because the target grayscale fused image obtained after fusion is more effective, the package image obtained by segmentation based on the target grayscale fused image can be more accurate and clear.
[0171] In addition, in order to further improve the image effect of the package image, before the package contour area in the target correction image is segmented to obtain the package image, the target correction image can also be subjected to security inspection image processing operations such as image enhancement processing and dual-energy resolution processing. No specific limitations or explanations are given here.
[0172] In this embodiment, the X-ray detector may include multiple detectors configured to capture grayscale images corresponding to X-rays of varying radiation energies. The grayscale images corresponding to the target correction image captured by each detector may then be fused to produce a target grayscale fused image. The parcel contour region within the target grayscale fused image is then segmented to produce a parcel image. By fusing multiple grayscale images at varying radiation energies, the resulting target grayscale fused image is more accurate, enabling precise segmentation of individual parcel images and resulting in superior image quality.
[0173] As an implementation method of an embodiment of the present invention, the above-mentioned contour optical detector can be deployed outside the security inspection equipment; or, the above-mentioned contour optical detector can be deployed inside the security inspection equipment, and a light source for supplementing the contour optical detector is provided inside the security inspection equipment.
[0174] When the profile optical detector is deployed outside the security inspection equipment, the external environment can meet the lighting conditions required for the profile optical detector to capture profile images, so there is no need to provide a supplemental light source. When the profile optical detector is deployed inside the security inspection equipment, since the interior of the security inspection equipment is generally dark and insufficiently illuminated, a light source can be installed inside the security inspection equipment to provide supplemental light for the profile optical detector. The supplemental light source for the profile optical detector can be any light source that provides sufficient light intensity, such as an LED (Light-Emitting Diode), as long as it does not adversely affect the X-ray detector.
[0175] The configuration of the contour optical detector at different installation positions does not affect the correction and matching of the X-ray image. The principle is the same as the above-mentioned correction and matching of the X-ray image, and will not be repeated here.
[0176] In this embodiment, the contour optical detector can be deployed externally or internally on the security inspection equipment. When deployed internally, the detector can be supplemented with light from a light source within the equipment, resulting in clearer and more accurate contour images captured by the detector. Regardless of whether the contour optical detector is deployed externally or internally on the security inspection equipment, accurate X-ray image segmentation can be achieved.
[0177] The following Figure 8(A)-Figure 8(E) As an example, the process of segmenting the target correction image based on the package contour area to obtain the package image is described. Figure 8(A)-Figure 8(E) The package images in correspond to the same package.
[0178] Figure 8(A) is an actual package image, Figure 8(B) is a package image captured by an X-ray detector, Figure 8(C) is a package image captured by a contour optical detector, Figure 8(D) is a package contour mask image extracted based on the package image captured by the contour optical detector, and Figure 8(E) is a package image obtained by segmenting the package image captured by the X-ray detector.
[0179] As shown in FIG8(B), for an object whose outer contour is made of low-density material, the package image captured by the X-ray detector cannot capture the package outer contour image, and can only capture the image of the internal object passing through the package outer contour; as shown in FIG8(C), the package image captured by the contour optical detector can capture the package outer contour image; the package contour mask image can be extracted from the package image captured by the contour optical detector shown in FIG8(D), and a package contour mask image with the package outer contour area as the foreground and other areas as the background is obtained; then, the package contour mask image shown in FIG8(D) can be used to crop the package image captured by the X-ray detector shown in FIG8(B), and the package image shown in FIG8(E) can be cropped to obtain a complete and independent package image.
[0180] Figure 9 A schematic diagram of the security inspection equipment system structure provided by an embodiment of the present invention is shown in FIG. Figure 9 As shown, the security inspection equipment system consists of three parts: control system, hardware system and data processing system.
[0181] The control system includes a sensing unit and a control unit. The sensing unit is used to detect whether an object to be detected enters the security inspection equipment, and the control unit is used to adjust the system parameters of the security inspection equipment.
[0182] The hardware system includes an X-ray source, an X-ray detector, a motion transmission mechanism (i.e., a transport structure), and a profile optical detector. X-ray sources include, but are not limited to, X-ray machines, accelerators, and radioisotopes. X-ray detectors include, but are not limited to, single-energy detectors, pseudo-dual-energy detectors, and energy spectrum detectors. Profile optical detectors include, but are not limited to, visible light detectors and infrared detectors. The motion transmission mechanism can utilize rollers or other transmission structures.
[0183] The hardware system is used to emit and receive X-rays, drive the object to be inspected to move in the security inspection equipment at different speeds, and collect the contour strip image of the package.
[0184] The data processing system includes a data acquisition unit, an image matching unit, an image segmentation unit, an image processing unit, and an image display unit. These units perform functions such as detector data acquisition, matching of visible light (or infrared) images with X-ray images, visible light (or infrared) image segmentation, stripe data processing and splicing, and image display. The data acquisition unit acquires detector data. The image matching unit matches the contour image with the X-ray image. The image segmentation unit segments the image captured by the contour optical detector. The image processing unit performs operations such as splicing the stripe images. The image display unit displays the image.
[0185] In the embodiments of the present invention, the specific viewing angles of the X-ray source and detector are not limited. The X-ray and profile optical detectors in the embodiments of the present invention can be single-row or multi-row detectors, L-shaped, curved, linear, or have other structures. The embodiments of the present invention do not limit the final calibration detection plane; in addition to calibration to the profile optical detector detection plane, calibration can also be performed to a detection plane parallel to the roller channel or to another detection plane.
[0186] The present invention does not limit the specific segmentation implementation method of the image collected by the contour optical detector. As long as the corresponding image segmentation function can be achieved, the method provided by the embodiment of the present invention can be used.
[0187] In the system provided by the embodiment of the present invention, the focus of the contour optical detector and the focus of the X-ray source can be set to maintain the same position in the horizontal direction, and a geometric deformation correction rule between the X-ray image and the image collected by the contour optical detector is designed for this structure to ensure the consistency of the image collected by the contour optical detector and the X-ray image in contour morphology. Furthermore, for the image and X-ray image collected by the matching contour optical detector, the characteristic of the contour optical detector that can collect the contour area image of the package can be utilized to accurately segment the independent package image in the X-ray image collected by the matching contour optical detector, thereby overcoming the imaging defect of X-rays on low-density materials and improving the accuracy of package image segmentation. In addition, the method provided by the embodiment of the present invention can achieve effective shielding of background pixels while achieving accurate segmentation of X-ray image packages, effectively removing background image correction artifacts caused by full-load background correction errors, and improving the image quality of the segmented package image.
[0188] Corresponding to the above-mentioned package image segmentation method, an embodiment of the present invention further provides a package image segmentation device. The package image segmentation device provided by the embodiment of the present invention is introduced below. Figure 10As shown, a package image segmentation device is applied to an image processing device, wherein the image processing device is used to process strip images collected by security inspection equipment, wherein the security inspection equipment includes an X-ray detector, and the package image segmentation device includes:
[0189] The image acquisition module 1001 is used to acquire the contour image captured by the contour optical detector and the X-ray image captured by the X-ray detector when the package passes through the security inspection equipment;
[0190] The contour optical detector is a light detector capable of capturing an image of the contour area of the package.
[0191] An image geometric correction module 1002 is configured to perform deformation correction on the X-ray image based on a preset geometric deformation correction correspondence relationship to obtain a corrected X-ray image;
[0192] The preset geometric deformation correction correspondence is a geometric size correspondence between images collected by the X-ray detector and the contour optical detector.
[0193] An image matching module 1003 is configured to match the corrected X-ray image with the contour image;
[0194] a package contour determination module 1004 for determining a package contour region wrapped in the corrected X-ray image based on a contour image matched with the corrected X-ray image;
[0195] The image segmentation module 1005 is configured to segment the corrected X-ray image based on the package contour region to obtain a package image.
[0196] Using the device provided by an embodiment of the present invention, since the contour optical detector is a light detector capable of capturing images of the contour area of a package, deformation correction can be performed on the X-ray image based on a preset geometric deformation correction correspondence, allowing the corrected X-ray image to accurately match the contour image in terms of the object contour. Using the contour image that accurately matches the corrected X-ray image, the package contour area of each package in the corrected X-ray image can be determined, and the images of each package in the corrected X-ray image can then be accurately segmented. In other words, using the contour image that matches the X-ray image, the outer contour area of each package in the X-ray image can be determined, allowing the images of each individual package to be accurately segmented. This solves the current problem of being unable to accurately segment the package images in the X-ray image due to the low grayscale value of the low-density outer packaging contour in the X-ray image.
[0197] Optionally, the ray source focus of the X-ray detector and the imaging focus of the profile optical detector may be at the same horizontal position, and the apparatus may further include:
[0198] A geometric correspondence determination module is used to calculate, based on the preset geometric position relationship between each detection plate of the X-ray detector and the preset equivalent detection plane position of the profile optical detector, a projection scale factor between each pixel detected by the X-ray detector and the corresponding pixel after the pixel is projected onto the preset equivalent detection plane of the profile optical detector, as a preset geometric deformation correction correspondence.
[0199] Optionally, the image geometric correction module 1002 may include:
[0200] a target pixel determination unit, configured to determine, for each pixel of the X-ray image, a target pixel corresponding to the pixel after the pixel is projected onto an equivalent detection plane of the profile optical detector according to a projection scale factor corresponding to the pixel and a position of the pixel in the X-ray image;
[0201] A grayscale value calculation unit, configured to calculate a corrected grayscale value corresponding to the pixel based on the grayscale values of the pixel's adjacent pixels and a preset correction coefficient;
[0202] The image correction unit is configured to determine the corrected grayscale value as the grayscale value of the target pixel to obtain a corrected X-ray image.
[0203] Optionally, the target pixel determination unit may include:
[0204] The cumulative value calculation subunit is configured to calculate, for the Nth pixel of the X-ray image, the cumulative value R(N) of the proportional factor corresponding to the Nth pixel using the following formula:
[0205]
[0206] Among them, Z n is the projection scale factor corresponding to the nth pixel of the X-ray image;
[0207] The target pixel determination subunit is used to determine the R(N)th pixel in the equivalent detection plane of the profile optical detector as the target pixel corresponding to the Nth pixel of the X-ray image after being projected onto the equivalent detection plane of the profile optical detector.
[0208] Optionally, the geometric correspondence determination module may include:
[0209] a first ratio calculation unit, configured to calculate a first ratio between the number of pixels of an actual detection plane of the profile optical detector and a preset equivalent detection plane length of the profile optical detector;
[0210] a length calculation unit, configured to calculate, for each detection plate of the X-ray detector, a corresponding length of the detection plate in the preset equivalent detection plane based on a preset geometric position relationship between the detection plate and the preset equivalent detection plane position of the profile optical detector;
[0211] a second ratio calculation unit, configured to calculate a second ratio between the corresponding length and the actual number of detection pixels of the detection plate;
[0212] a first target projection scale factor determining unit, configured to determine, by multiplying the first ratio by a second ratio corresponding to the detection plate, a target projection scale factor between a pixel at a preset position detected by the detection plate and a pixel corresponding to the pixel at the preset position after the pixel at the preset position is projected onto a preset equivalent detection plane of the profile optical detector;
[0213] The second target projection scale factor determining unit is configured to perform interpolation processing on the target projection scale factor based on the positional relationship between other pixels in the detection plate and the pixel at the preset position to obtain projection scale factors corresponding to other pixels.
[0214] Optionally, the second target projection scale factor determining unit may include:
[0215] The second target projection scale factor determination subunit is configured to calculate the projection scale factor Z0 of the other pixels using the following formula:
[0216]
[0217] Among them, l is the number of pixels between the preset position pixels of two adjacent detection plates, l1 is the number of pixels between the other pixels and the preset position pixels of the first detection plate among the two adjacent detection plates, l2 is the number of pixels between the other pixels and the preset position pixels of the second detection plate among the two adjacent detection plates, Z1 is the projection scale factor corresponding to the preset position pixels of the first detection plate, and Z2 is the projection scale factor corresponding to the preset position pixels of the second detection plate.
[0218] Optionally, the contour image may be a contour strip image, or the contour image may be a spliced contour image obtained by splicing a target number of contour strip images in the order of acquisition time by the contour optical detector; the X-ray image may be an X-ray strip image, or the X-ray image may be a spliced X-ray image obtained by splicing a target number of X-ray strip images in the order of acquisition time by the X-ray detector;
[0219] The above device may further include:
[0220] a speed-time correspondence determination module, configured to respectively record the time intervals between images of the same target captured by the profile optical detector and the X-ray detector when the conveyor belt is running at a plurality of running speeds, and obtain a correspondence between the running speeds and the time intervals;
[0221] The image matching module 1003 may include: a target acquisition time interval determination unit, configured to determine the target acquisition time interval according to the current running speed of the conveyor belt of the security inspection device and the corresponding relationship;
[0222] an image matching unit configured to, when the contour image is a contour strip image and the X-ray image is an X-ray strip image, determine, for each corrected X-ray image, a contour strip image corresponding to the corrected X-ray image and having an acquisition time interval corresponding to the corrected X-ray image being the target acquisition time interval, as the contour strip image matching the corrected X-ray image; or
[0223] Used to, when the contour image is a spliced contour image and the X-ray image is a spliced X-ray image, determine the contour strip image whose acquisition time interval of the first X-ray strip image corresponding to the corrected X-ray image is the target acquisition time interval as the starting contour strip image; and determine the spliced contour image obtained by splicing the target number of contour strip images including the starting contour strip image, starting from the starting contour strip image, as the contour image matching the corrected X-ray image.
[0224] Optionally, the package outline determination module 1004 may include:
[0225] a package silhouette image acquisition unit, configured to remove the background area in the contour image that matches the corrected X-ray image based on the background image pre-collected by the contour optical detector, to obtain a package silhouette image;
[0226] a package contour mask image acquisition unit, configured to perform grayscale segmentation on the package silhouette image based on image grayscale value distribution differences, and obtain a package contour mask image corresponding to the package silhouette image, with the package contour area as the image foreground;
[0227] The package contour determining unit is configured to determine a package contour area in the corrected X-ray image according to the package contour mask image.
[0228] Optionally, the package outline determining unit may include:
[0229] The pixel value replacement subunit is used to set the pixel values of pixels in other areas of the corrected X-ray image outside the area corresponding to the wrapped contour area in the wrapped contour mask image to preset background pixel values to obtain the wrapped contour area in the corrected X-ray image.
[0230] Optionally, the image segmentation module 1005 may include:
[0231] a full-load image and background image acquisition unit, configured to acquire a full-load image of the security inspection equipment and a background image of the security inspection equipment pre-collected by the X-ray detector;
[0232] Among them, the fully loaded image of the security inspection equipment is a detection image collected by the X-ray detector when no package passes through the security inspection equipment and the X-ray source and X-ray detector of the security inspection equipment are both in the turned-on state; the background image of the security inspection equipment is a detection image collected by the X-ray detector when the X-ray source is in the turned-off state and the X-ray detector is in the turned-on state.
[0233] a full-load background correction unit, configured to perform full-load background correction on the corrected X-ray image including the package outline area based on the full-load image of the security inspection equipment and the background image of the security inspection equipment, to obtain a corresponding target correction image;
[0234] The image segmentation unit is used to segment the package contour area in the target corrected image to obtain a package image.
[0235] Optionally, the X-ray detector may include multiple detectors, and the multiple detectors are used to collect grayscale images corresponding to X-rays of different radiation energies.
[0236] The image segmentation unit may include:
[0237] A grayscale image fusion subunit, configured to fuse the grayscale images corresponding to the target correction image acquired by each detector to obtain a target grayscale fused image;
[0238] The image segmentation subunit is used to segment the package contour area in the target grayscale fusion image to obtain a package image.
[0239] Optionally, the above-mentioned contour optical detector can be deployed outside the security inspection equipment; or, the above-mentioned contour optical detector can be deployed inside the security inspection equipment, and a light source for supplementing the contour optical detector is provided inside the security inspection equipment.
[0240] The embodiment of the present invention further provides an electronic device, such as Figure 11 As shown, it includes a processor 1101, a communication interface 1102, a memory 1103 and a communication bus 1104, wherein the processor 1101, the communication interface 1102, and the memory 1103 communicate with each other through the communication bus 1104.
[0241] Memory 1103, used for storing computer programs;
[0242] The processor 1101 is configured to implement any of the steps of the package image segmentation method when executing the program stored in the memory 1103 .
[0243] The communication bus mentioned in the electronic device above may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. This communication bus can be divided into address buses, data buses, control buses, etc. For ease of illustration, the figure uses only a single thick line, but this does not mean that there is only one bus or only one type of bus.
[0244] The communication interface is used for communication between the above electronic device and other devices.
[0245] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage. Alternatively, the memory may be at least one storage device located away from the processor.
[0246] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.
[0247] In another embodiment of the present invention, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium. When the computer program is executed by a processor, the steps of any of the above-mentioned package image segmentation methods are implemented.
[0248] In another embodiment of the present invention, a computer program product comprising instructions is provided. When the computer program product is executed on a computer, the computer is enabled to execute any one of the package image segmentation methods in the above embodiments.
[0249] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).
[0250] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply the existence of any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.
[0251] Each embodiment in this specification is described in a related manner. Similar portions between embodiments can be referenced to each other. Each embodiment focuses on the differences between other embodiments. In particular, the device, electronic device, computer-readable storage medium, and computer program product embodiments are generally similar to the method embodiments, so their descriptions are relatively simple. For related portions, reference can be made to the descriptions of the method embodiments.
[0252] The above description is only a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention are included in the scope of protection of the present invention.
Claims
1. A package image segmentation method, characterized in that: The method is applied to an image processing device, the image processing device being used to process images collected by a security inspection device, the security inspection device including an X-ray detector, and the method comprising: Acquire a contour image captured by a contour optical detector and an X-ray image captured by the X-ray detector during the process of the package passing through the security inspection equipment, wherein the contour optical detector is a light detector capable of capturing an image of the contour area of the package; and the radiation source focal point of the X-ray detector and the imaging focal point of the contour optical detector are at the same horizontal position; Based on a preset geometric deformation correction correspondence, the X-ray image is deformed and corrected to obtain a corrected X-ray image, wherein the preset geometric deformation correction correspondence is a geometric size correspondence between the image captured by the X-ray detector and the profile optical detector; the preset geometric deformation correction correspondence is determined by: based on a preset geometric position relationship between each detection plate of the X-ray detector and a preset equivalent detection plane position of the profile optical detector, and a first ratio between the number of pixels of the actual detection plane of the profile optical detector and the preset equivalent detection plane length of the profile optical detector, calculating a projection scale factor between each pixel detected by the X-ray detector and a corresponding pixel after the pixel is projected onto the preset equivalent detection plane of the profile optical detector, as the preset geometric deformation correction correspondence; matching the corrected X-ray image with the contour image; determining a parcel contour region of the parcel in the corrected X-ray image based on a contour image matched with the corrected X-ray image; The corrected X-ray image is segmented based on the package contour area to obtain a package image.
2. The method according to claim 1, characterized in that The step of performing deformation correction on the X-ray image based on the preset geometric deformation correction correspondence to obtain a corrected X-ray image includes: For each pixel of the X-ray image, determining, based on a projection scale factor corresponding to the pixel and a position of the pixel in the X-ray image, a target pixel corresponding to the pixel after the pixel is projected onto an equivalent detection plane of the profile optical detector; Calculate the corrected grayscale value corresponding to the pixel based on the grayscale values of the adjacent pixels of the pixel and the preset correction coefficient; The corrected grayscale value is determined as the grayscale value of the target pixel to obtain a corrected X-ray image.
3. The method according to claim 2, characterized in that The step of determining, for each pixel of the X-ray image, a target pixel corresponding to the pixel after the pixel is projected onto the equivalent detection plane of the profile optical detector according to a projection scale factor corresponding to the pixel and a position of the pixel in the X-ray image, includes: For the Nth pixel of the X-ray image, the following formula is used to calculate the cumulative value R(N) of the proportional factor corresponding to the Nth pixel: Among them, Z n is the projection scale factor corresponding to the nth pixel of the X-ray image; The R(N)th pixel in the equivalent detection plane of the profile optical detector is determined as the target pixel corresponding to the Nth pixel of the X-ray image after being projected onto the equivalent detection plane of the profile optical detector.
4. The method according to claim 1, wherein The method of calculating a projection scale factor between each pixel detected by the X-ray detector and a corresponding pixel after projecting the pixel onto the preset equivalent detection plane of the profile optical detector based on a preset geometric position relationship between each detection plate of the X-ray detector and a preset equivalent detection plane position of the profile optical detector, and a first ratio between the number of pixels of the actual detection plane of the profile optical detector and the preset equivalent detection plane length of the profile optical detector, comprises: calculating a first ratio between the number of pixels of an actual detection plane of the profile optical detector and a preset equivalent detection plane length of the profile optical detector; For each detection plate of the X-ray detector, based on a preset geometric position relationship between the detection plate and a preset equivalent detection plane position of the profile optical detector, calculating a corresponding length of the detection plate in the preset equivalent detection plane; calculating a second ratio between the corresponding length and the actual number of detection pixels of the detection plate; The product of the first ratio and the second ratio corresponding to the detection plate is determined as a target projection scale factor between a pixel at a preset position detected by the detection plate and a corresponding pixel after the pixel at the preset position is projected onto a preset equivalent detection plane of the profile optical detector; Based on the positional relationship between other pixels in the detection plate and the pixel at the preset position, the target projection scale factor is interpolated to obtain projection scale factors corresponding to other pixels.
5. The method according to claim 4, characterized in that The interpolation processing of the target projection scale factor based on the positional relationship between other pixels in the detection plate and the pixel at the preset position to obtain projection scale factors corresponding to other pixels includes: The projection scale factor Z0 of the other pixels is calculated using the following formula: Among them, l is the number of pixels between the preset position pixels of two adjacent detection plates, l1 is the number of pixels between the other pixels and the preset position pixels of the first detection plate among the two adjacent detection plates, l2 is the number of pixels between the other pixels and the preset position pixels of the second detection plate among the two adjacent detection plates, Z1 is the projection scale factor corresponding to the preset position pixels of the first detection plate, and Z2 is the projection scale factor corresponding to the preset position pixels of the second detection plate.
6. The method according to claim 1, characterized in that The contour image is a contour strip image, or the contour image is a spliced contour image obtained by splicing a target number of contour strip images in the order of acquisition time by the contour optical detector; the X-ray image is an X-ray strip image, or the X-ray image is a spliced X-ray image obtained by splicing a target number of X-ray strip images in the order of acquisition time by the X-ray detector; The method further comprises: Recording the time intervals between images of the same target captured by the profile optical detector and the X-ray detector when the conveyor belt of the security inspection equipment runs at multiple speeds, respectively, to obtain a corresponding relationship between the running speeds and the time intervals; The matching of the corrected X-ray image with the contour image comprises: Determining a target collection time interval according to the current operating speed of the conveyor belt of the security inspection equipment and the corresponding relationship; When the contour image is a contour strip image and the X-ray image is an X-ray strip image, for each corrected X-ray image, the contour strip image corresponding to the corrected X-ray image and having an acquisition time interval equal to the target acquisition time interval is determined as the contour strip image matching the corrected X-ray image; or When the contour image is a spliced contour image and the X-ray image is a spliced X-ray image, the contour strip image whose acquisition time interval of the first X-ray strip image corresponding to the corrected X-ray image is the target acquisition time interval is determined as the starting contour strip image; and the spliced contour image obtained by splicing the target number of contour strip images including the starting contour strip image, starting from the starting contour strip image, is determined as the contour image matching the corrected X-ray image.
7. The method according to any one of claims 1 to 6, characterized in that The step of determining a parcel contour area wrapped in the corrected X-ray image based on a contour image matched with the corrected X-ray image comprises: removing the background area in the contour image that matches the corrected X-ray image based on the background image pre-collected by the contour optical detector to obtain a wrapped silhouette image; Based on the grayscale value distribution difference of the image, the grayscale segmentation of the package silhouette image is performed to obtain a package outline mask image corresponding to the package silhouette image, with the package outline area as the image foreground; The package contour area in the corrected X-ray image is determined according to the package contour mask image.
8. The method according to claim 7, characterized in that The step of determining the package contour area in the corrected X-ray image according to the package contour mask image includes: The pixel values of pixels in other areas of the corrected X-ray image outside the area corresponding to the wrapping contour area in the wrapping contour mask image are set to preset background pixel values to obtain the wrapping contour area in the corrected X-ray image.
9. The method according to claim 8, characterized in that The step of segmenting the corrected X-ray image based on the package contour area to obtain a package image includes: Acquire a fully loaded image of the security inspection equipment and a background image of the security inspection equipment pre-captured by the X-ray detector, wherein the fully loaded image of the security inspection equipment is a detection image captured by the X-ray detector when no packages pass through the security inspection equipment and the X-ray source and X-ray detector of the security inspection equipment are both in an on state, and the background image of the security inspection equipment is a detection image captured by the X-ray detector when the X-ray source is in an off state and the X-ray detector is in an on state; Based on the full-load image of the security inspection equipment and the background image of the security inspection equipment, performing full-load background correction on the corrected X-ray image including the package outline area to obtain a corresponding target correction image; The parcel contour area in the target corrected image is segmented to obtain a parcel image.
10. The method according to claim 9, characterized in that The X-ray detector includes a plurality of detectors, and the plurality of detectors are used to collect grayscale images corresponding to X-rays of different radiation energies; The step of segmenting the package contour area in the target corrected image to obtain the package image includes: Fusing the grayscale images corresponding to the target correction image collected by each detector to obtain a target grayscale fused image; The package contour area in the target grayscale fusion image is segmented to obtain a package image.
11. The method according to any one of claims 1 to 6, characterized in that: The contour optical detector is deployed outside the security inspection device; or, the contour optical detector is deployed inside the security inspection device, and a light source for supplementing light for the contour optical detector is provided inside the security inspection device.
12. A package image segmentation device, characterized in that: The device is applied to an image processing device, which is used to process images collected by security inspection equipment, wherein the security inspection equipment includes an X-ray detector, and the package image segmentation device includes: An image acquisition module, configured to acquire a contour image captured by a contour optical detector and an X-ray image captured by the X-ray detector during the process of a package passing through the security inspection equipment; wherein the contour optical detector is a light detector capable of capturing an image of the contour area of the package; and the radiation source focus of the X-ray detector and the imaging focus of the contour optical detector are at the same horizontal position; An image geometric correction module is configured to perform deformation correction on the X-ray image based on a preset geometric deformation correction correspondence to obtain a corrected X-ray image, wherein the preset geometric deformation correction correspondence is a geometric size correspondence between the image captured by the X-ray detector and the image captured by the profile optical detector; the preset geometric deformation correction correspondence is determined by: based on a preset geometric position relationship between each detection plate of the X-ray detector and a preset equivalent detection plane position of the profile optical detector, and a first ratio between the number of pixels of the actual detection plane of the profile optical detector and the preset equivalent detection plane length of the profile optical detector, calculating a projection scale factor between each pixel detected by the X-ray detector and the corresponding pixel after the pixel is projected onto the preset equivalent detection plane of the profile optical detector, as the preset geometric deformation correction correspondence; an image matching module, configured to match the corrected X-ray image with the contour image; a parcel contour determination module, configured to determine a parcel contour area wrapped in the corrected X-ray image based on a contour image matched with the corrected X-ray image; An image segmentation module is used to segment the corrected X-ray image based on the package contour area to obtain a package image.
13. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; Memory for storing computer programs; A processor, configured to implement the method steps described in any one of claims 1 to 11 when executing a program stored in a memory.
14. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps of any one of claims 1 to 11 are implemented.
Citation Information
Patent Citations
Transmission image deformation correction method for channel type X-ray safety inspection equipment
CN102230975A
Breast X-ray image display method and device and storage medium
CN111899260A