Image preprocessing method compatible with X-ray security inspection equipment of multiple manufacturers

By performing wrapping area segmentation, histogram matching and filtering on the images of X-ray security equipment, and combining with the Sobel convolution kernel to determine the gradient, the problem of image incompatibility among different manufacturers is solved, and unified preprocessing and clear recognition of images are achieved.

CN119295503APending Publication Date: 2025-01-10BEIJING HANGXING MACHINERY MFG CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411279728.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-12
Publication Date
2025-01-10

AI Technical Summary

Technical Problem

The image definition and encoding format of X-ray security equipment of different manufacturers are incompatible, making it difficult for intelligent image judgment systems or centralized image judgment systems to process X-ray original images from multiple manufacturers in a unified manner.

Method used

By obtaining the wrapping area and background area of ​​the X-ray image to be processed, hemigram matching is performed, divided into strong edge and weak edge images, and sliding window filtering and expansion processing is performed, and gradient is performed with the preset Sobel convolution kernel. Determine to realize unified preprocessing of images.

Benefits of technology

It realizes the unified format of X-ray images from different manufacturers, making the wrapped images after image preprocessing clearer and easy to uniformly identify images, solving the problem of image diversity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119295503A_ABST
    Figure CN119295503A_ABST
Patent Text Reader

Abstract

The invention relates to an image preprocessing method compatible with X-ray security inspection equipment of multiple manufacturers, belongs to the technical field of security inspection equipment, and solves the problem of diversification of X-ray images of different manufacturers in the prior art. The image preprocessing method comprises the following steps: segmenting a wrapping region and a background region of a to-be-processed X-ray image to obtain a to-be-processed wrapping image; performing histogram matching on the to-be-processed parcel image according to the reference parcel image to obtain a matched parcel image; dividing the matched parcel image into a strong edge parcel image and a weak edge parcel image; performing sliding window filtering on the strong edge wrapped image to obtain a strong edge wrapped filtered image; performing image expansion processing and mean filtering on the weak edge wrapping image to obtain a weak edge wrapping filtering image; and combining the strong edge wrapped filtering image and the weak edge wrapped filtering image to obtain a preprocessed image. And unification of X-ray images of different manufacturers is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of security inspection equipment, and in particular to an image preprocessing method compatible with X-ray security inspection equipment of multiple manufacturers. Background Art

[0002] In recent years, there have been many more X-ray security inspection equipment manufacturers, presenting a situation of flourishing. There are more manufacturers that can provide security inspection equipment for security inspection businesses that do not require civil aviation certification, such as railways, customs, subways, large conferences, etc., such as Shengxun Electronics, Antianxia, ​​Tianhe Times, Erlangshen, Zhangmenshen, etc. There are nearly a dozen security inspection equipment providers. Therefore, the security inspection equipment purchased by the same user in different batches of projects may involve X-ray security inspection equipment from multiple manufacturers.

[0003] In this case, the intelligent image judgment system or centralized image judgment system used by users faces the problem of needing to access X-ray security inspection equipment from multiple manufacturers. However, different X-ray security inspection equipment manufacturers have their own definitions and encoding formats for X-ray images, which are not compatible with each other. The original X-ray images of each X-ray security inspection equipment manufacturer can only be opened through the dedicated image viewing software developed by the manufacturer itself. Therefore, the intelligent image judgment system or centralized image judgment system that has been launched is either developed by each security inspection equipment manufacturer and can only access the original images of its own security inspection equipment, or the original X-ray images are converted into images in a universal format through screenshots or other methods and then connected to the intelligent image judgment system or centralized image judgment system. Even if some security inspection equipment manufacturers are willing to open the original images to the intelligent image judgment system and the centralized image judgment system and provide dedicated X-ray viewing software, the color systems presented by the X-ray images of different manufacturers are also very different, and cannot be unified in the intelligent image judgment system and the centralized image judgment system.

[0004] Therefore, there is an urgent need for a technical solution to unify X-ray original images from different manufacturers. Summary of the invention

[0005] In view of the above analysis, an embodiment of the present invention aims to provide an image preprocessing method compatible with X-ray security inspection equipment from multiple manufacturers, so as to solve the problem of diversification of X-ray images from different manufacturers in the prior art.

[0006] An embodiment of the present invention provides an image preprocessing method compatible with X-ray security inspection equipment of multiple manufacturers, the image preprocessing method comprising:

[0007] Obtaining X-ray images to be processed from different manufacturers, segmenting the package area and the background area of ​​the X-ray images to be processed, and obtaining the package images to be processed;

[0008] Performing histogram matching on the parcel image to be processed according to the reference parcel image to obtain a matched parcel image; dividing the matched parcel image into a strong edge parcel image and a weak edge parcel image;

[0009] Perform sliding window filtering on the strong edge wrapped image, determine the pixel value of the central pixel of the window after filtering according to the maximum, minimum, median and average of the pixel values ​​in the window, and obtain the strong edge wrapped filtered image;

[0010] Perform image dilation processing and mean filtering on the weak edge wrapping image to obtain a weak edge wrapping filtered image;

[0011] The strong edge wrapping filter image and the weak edge wrapping filter image are combined to obtain a preprocessed image.

[0012] Based on the further improvement of the above method, the segmentation of the package area and the background area of ​​the X-ray image to be processed includes:

[0013] The X-ray image to be processed is convolved by a preset horizontal Sobel convolution kernel and a preset vertical Sobel convolution kernel respectively, and the convolved images are merged and normalized to obtain a gradient image to be processed;

[0014] The processed gradient image is binarized and segmented by a preset pixel threshold to obtain a segmented contour image;

[0015] Determine all contour combinations in the segmented contour image, calculate the area of ​​the rectangular region occupied by each contour combination, and use the rectangular region occupied by the contour combination with the largest area as the package image to be processed.

[0016] Based on the further improvement of the above method, the preset horizontal Sobel convolution kernel is:

[0017] -1 0 1

[0018] -2 0 2

[0019] -1 0 1;

[0020] The preset vertical Sobel convolution kernel is:

[0021] -1 -2 -1 0 0 0

[0023] 1 2 1.

[0024] Based on the further improvement of the above method, the convolved images are merged and normalized to obtain a gradient image to be processed, including:

[0025] The images are merged using the following formula:

[0026]

[0027] Among them, E represents the merged pixel value, Gx represents the pixel value in the image after horizontal convolution, and Gy represents the pixel value in the image after vertical convolution;

[0028] Each pixel value of the merged image is normalized to a range of 255 to obtain an image within a normal pixel value range as the gradient image to be processed.

[0029] Based on the further improvement of the above method, the step of performing histogram matching on the parcel image to be processed according to the reference parcel image to obtain the matched parcel image includes:

[0030] Calculate the cumulative distribution values ​​of the to-be-processed package image and the reference package image in the range of 0 to 255 pixel values; obtain the cumulative distribution function of the reference package image by linearly interpolating the cumulative distribution values ​​of the reference package image in the range of 0 to 255 pixel values;

[0031] According to the cumulative distribution value corresponding to each pixel value in the package image to be processed and in combination with the cumulative distribution function of the reference package image, the mapped pixel value of each pixel value in the package image to be processed in the reference package image is determined;

[0032] Each pixel value in the package image to be processed is replaced with the mapped pixel value in the reference package image to obtain a matched package image.

[0033] Based on the further improvement of the above method, the matching wrapped image is divided into a strong edge wrapped image and a weak edge wrapped image, including:

[0034] The area occupied by all contours combined in the matched parcel image is taken as the strong edge parcel image;

[0035] The strong edge wrapping image is removed from the matched wrapping image, and the remaining image is used as the weak edge wrapping image.

[0036] Based on the further improvement of the above method, the strong edge wrapped image is subjected to sliding window filtering, and the pixel value of the central pixel of the window after filtering is determined according to the maximum value, minimum value, median value and average value of the pixel value in the window to obtain the strong edge wrapped filtered image, including:

[0037] Sequentially wrap each pixel in the image with a strong edge as the window center for sliding the window;

[0038] Determine the maximum, minimum and median values ​​of the pixels in the window, and the average value of the remaining pixel values ​​after removing the maximum and minimum values ​​of the pixels in the window;

[0039] The center pixel of the window is compared with the maximum value and the minimum value respectively; if the pixel is a maximum value or a minimum value, the median value is used as the pixel value of the pixel after filtering; otherwise, the average value is used as the pixel value of the pixel after filtering.

[0040] Based on the further improvement of the above method, the window size used when sliding the window for the strong edge wrapped image is 3×3 or 5×5.

[0041] Based on the further improvement of the above method, the image dilation processing and mean filtering are performed on the weak edge wrapping image to obtain the weak edge wrapping filtered image, including:

[0042] Sequentially wrap each pixel in the image with the weak edge as the window center for sliding window;

[0043] Get the maximum pixel value in the window, update the pixel value of the central pixel of the window to the maximum pixel value, and traverse each pixel in the weak edge wrapped image to obtain the expanded weak edge wrapped image;

[0044] The dilated weak edge wrapped image is mean filtered to obtain a weak edge wrapped filtered image.

[0045] Based on the further improvement of the above method, the window size used when sliding the window on the weak edge wrapping image is 3×3.

[0046] Compared with the prior art, the present invention can achieve at least one of the following beneficial effects:

[0047] 1. Segment the X-ray images of different manufacturers into background area and parcel area, perform histogram matching between the parcel image and the reference parcel image to make the parcel images of each manufacturer unified, and then divide the matched parcel images into strong edge parcel images and weak edge parcel images for targeted filtering, so that the pre-processed X-ray images of different manufacturers are as unified as possible in format, so as to facilitate unified image judgment processing;

[0048] 2. The gradient of the X-ray image is determined by the horizontal Sobel convolution kernel and the vertical Sobel convolution kernel, and the X-ray image is segmented into a background image and a package image, and the segmentation result is more reliable;

[0049] 3. Sliding window filtering is performed on the strong edge wrapped image, and image dilation processing and mean filtering are performed on the weak edge wrapped image, so that the pre-processed wrapped image is clearer and easier to perform unified image recognition.

[0050] In the present invention, the above-mentioned technical solutions can also be combined with each other to achieve more preferred combination solutions. Other features and advantages of the present invention will be described in the subsequent description, and some advantages can become obvious from the description, or can be understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained through the contents particularly pointed out in the description and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] The drawings are only for the purpose of illustrating particular embodiments and are not to be considered limiting of the present invention. Like reference symbols denote like components throughout the drawings.

[0052] Figure 1 A flowchart of an image preprocessing method compatible with X-ray security inspection equipment from multiple manufacturers provided by an embodiment of the present invention;

[0053] Figure 2 A schematic diagram of the structure of an X-ray image to be processed provided by an embodiment of the present invention;

[0054] Figure 3 A schematic diagram of the structure of a package image to be processed provided by an embodiment of the present invention;

[0055] Figure 4 A schematic diagram of the structure of a segmented contour image provided by an embodiment of the present invention;

[0056] Figure 5 A schematic diagram of the structure of a rectangular area occupied by a contour combination with the largest area provided by an embodiment of the present invention;

[0057] Figure 6 A schematic structural diagram of a contour image of a matched package image provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0058] The preferred embodiments of the present invention are described in detail below in conjunction with the accompanying drawings, wherein the accompanying drawings constitute a part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not used to limit the scope of the present invention.

[0059] A specific embodiment of the present invention discloses an image preprocessing method compatible with X-ray security inspection equipment of multiple manufacturers, such as Figure 1 As shown, the image preprocessing method includes:

[0060] Step S1: obtaining X-ray images to be processed from different manufacturers, segmenting the package area and background area of ​​the X-ray images to be processed, and obtaining the package images to be processed;

[0061] Step S2: performing histogram matching on the parcel image to be processed according to the reference parcel image to obtain a matched parcel image; dividing the matched parcel image into a strong edge parcel image and a weak edge parcel image;

[0062] Step S3: Perform sliding window filtering on the strong edge wrapped image, determine the pixel value of the center pixel of the window after filtering according to the maximum value, minimum value, median value and average value of the pixel values ​​in the window, and obtain the strong edge wrapped filtered image;

[0063] Step S4: performing image dilation processing and mean filtering on the weak edge wrapping image to obtain a weak edge wrapping filtered image;

[0064] Step S5: combining the strong edge wrapping filter image and the weak edge wrapping filter image to obtain a preprocessed image.

[0065] Specifically, when performing unified image recognition processing on X-ray images from different manufacturers, the X-ray images from different manufacturers are first preprocessed using the image preprocessing method provided in an embodiment of the present invention, and then combined with a trained image recognition model, the X-ray images from different manufacturers are accurately recognized.

[0066] Specifically, Figure 1 As shown, in step S1, a signal splitting device is added in the communication network from detectors of different manufacturers to the host computer, and the X-ray image is copied through the signal flow device without affecting the normal transmission process of the X-ray image to the host computer to obtain the X-ray image to be processed. It can be understood that the detectors of different manufacturers receive the X-rays passing through the object, and then convert the optical signal into an electrical signal, and obtain the X-ray image after rearrangement.

[0067] It is worth noting that the signal splitting device can not only ensure the normal transmission of detector data from different manufacturers, but also copy the X-ray image for pre-processing, and then perform unified image judgment processing.

[0068] Specifically, in step S1, the X-ray image to be processed is divided into a package area and a background area, and the package area is selected to obtain the package image to be processed. Figure 2 As shown in the figure, the shaded part is the package area, and the blank part is the background area. The package area and the background area are segmented to obtain the package image to be processed, as shown in Figure 3 shown.

[0069] Preferably, segmenting the package area and the background area of ​​the X-ray image to be processed includes:

[0070] The X-ray image to be processed is convolved by a preset horizontal Sobel convolution kernel and a preset vertical Sobel convolution kernel respectively, and the convolved images are merged and normalized to obtain a gradient image to be processed;

[0071] The processed gradient image is binarized and segmented by a preset pixel threshold to obtain a segmented contour image;

[0072] Determine all contour combinations in the segmented contour image, calculate the area of ​​the rectangular region occupied by each contour combination, and use the rectangular region occupied by the contour combination with the largest area as the package image to be processed.

[0073] Specifically, the edge of the image can be regarded as the place where the grayscale changes most dramatically, that is, the place where the spatial gradient is the largest. The convolution kernel is slid on the image by using a preset horizontal Sobel convolution kernel and a preset vertical Sobel convolution kernel to calculate the grayscale changes in the horizontal and vertical directions respectively, and the horizontal spatial gradient and vertical spatial gradient of the X-ray image to be processed are determined. The horizontal spatial gradient and the vertical spatial gradient are merged to obtain the processed gradient image.

[0074] Preferably, the preset horizontal Sobel convolution kernel is:

[0075] -1 0 1

[0076] -2 0 2

[0077] -1 0 1;

[0078] The preset vertical Sobel convolution kernel is:

[0079] -1 -2 -1 0 0 0

[0081] 1 2 1.

[0082] Specifically, a preset horizontal Sobel convolution kernel and a preset vertical Sobel convolution kernel are respectively slid on the X-ray image to be processed to obtain the pixel value of each pixel after horizontal convolution and vertical convolution.

[0083] Preferably, the convolved images are merged and normalized to obtain a gradient image to be processed, including:

[0084] The images are merged using the following formula:

[0085]

[0086] Among them, E represents the merged pixel value, Gx represents the pixel value in the image after horizontal convolution, and Gy represents the pixel value in the image after vertical convolution;

[0087] Each pixel value of the merged image is normalized to a range of 255 to obtain an image within a normal pixel value range as the gradient image to be processed.

[0088] Specifically, Gx represents the pixel value of each pixel after horizontal convolution, Gy represents the pixel value of each pixel after vertical convolution, and E represents the pixel value of each pixel after merging.

[0089] Specifically, the maximum pixel value in the merged image is found, and the pixel values ​​of all pixels in the merged image are normalized to a range of 255 to obtain an image in a range of 0 to 255, that is, a gradient image to be processed.

[0090] Specifically, the processed gradient image is binarized and segmented by a preset pixel threshold to obtain a segmented contour image. For example, the preset pixel value threshold is 50, and the pixel values ​​below the preset pixel value threshold are set to black, while the pixel values ​​above the preset pixel value threshold are set to white, to obtain a segmented contour image, such as Figure 4 shown.

[0091] Specifically, all contour combinations in the segmented contour image are determined, the area of ​​the rectangular region occupied by each contour combination is calculated, and the rectangular region occupied by the contour combination with the largest area is used as the package image to be processed.

[0092] like Figure 4 As shown, the segmented contour image includes multiple contour combinations, the area of ​​the rectangular area occupied by each contour combination is calculated, and the rectangular area occupied by the contour combination with the largest area is sorted out as the package image to be processed, such as Figure 5 The rectangular area shown is the rectangular area occupied by the contour combination with the largest area.

[0093] It is worth noting that in the binary segmentation contour image, any group of adjacent white pixels forms a connected component, and these connected components correspond to different objects or parts in the segmentation contour image;

[0094] For all connected components, trace their boundaries to form a contour combination. The tracing process is as follows: for each connected component, start from any white pixel and sequentially visit the white pixels around it. If they are connected, add them to the contour, and then get all the contour combinations.

[0095] Specifically, Figure 1 As shown, in step S2, histogram matching is performed on the package image to be processed obtained in step S1 to obtain a matched package image. The reference package image needs to be preset in advance and can be a package image to be processed of any manufacturer. The reference package image is used to perform histogram matching on package images to be processed of different manufacturers.

[0096] Preferably, performing histogram matching on the parcel image to be processed according to the reference parcel image to obtain a matched parcel image includes:

[0097] Calculate the cumulative distribution values ​​of the to-be-processed package image and the reference package image in the range of 0 to 255 pixel values; obtain the cumulative distribution function of the reference package image by linearly interpolating the cumulative distribution values ​​of the reference package image in the range of 0 to 255 pixel values;

[0098] According to the cumulative distribution value corresponding to each pixel value in the package image to be processed and in combination with the cumulative distribution function of the reference package image, the mapped pixel value of each pixel value in the package image to be processed in the reference package image is determined;

[0099] Each pixel value in the package image to be processed is replaced with the mapped pixel value in the reference package image to obtain a matched package image.

[0100] Specifically, the cumulative distribution values ​​of the to-be-processed package image and the reference package image in the pixel value range of 0 to 255 are calculated, including ①②③, specifically:

[0101] ① Count the number of pixel values ​​between 0 and 255 of the package image to be processed and the reference package image respectively, and obtain the pixel histogram of the package image to be processed and the reference package image:

[0102] H r1 (i) = number of i-th pixel in the reference parcel image;

[0103] H s1 (i) = the number of pixels in the i-th pixel in the package image to be operated;

[0104] It can be understood that the value range of i is 0 to 255.

[0105] ② Normalize the pixel histograms of the processed package image and the reference package image respectively:

[0106]

[0107] Among them, H′ r1 (i) represents the probability of the i-th pixel value appearing in the reference package image, H′ s1 (i) represents the probability of occurrence of the i-th pixel value in the package image to be processed.

[0108] ③ Calculate the cumulative distribution value of the package image to be processed and the reference package image:

[0109]

[0110] Among them, F r1(x) represents the probability of occurrence of pixel values ​​from 0 to x in the reference package image, that is, the cumulative distribution value of x in the reference package image; F s1 (x) represents the probability of occurrence of pixel values ​​from 0 to x in the package image to be processed, that is, the cumulative distribution value of x in the package image to be processed.

[0111] Specifically, the cumulative distribution function of the reference package image is obtained by linearly interpolating the cumulative distribution values ​​of the reference package image in the range of 0 to 255 pixel values.

[0112] Specifically, the cumulative distribution value corresponding to the pixel value to be matched in the package image to be processed is calculated, and the cumulative distribution value corresponding to the pixel value to be matched is substituted into the cumulative distribution function of the reference package image to obtain the corresponding mapping pixel value in the reference package image. It can be understood that the mapping pixel value is an integer value in the range of 0 to 255, and when the mapping pixel value is a decimal, a rounding operation is performed. For example: the pixel value to be matched in the package image to be processed is 10, according to the formula Calculate the cumulative distribution value F s1 (10), and then the cumulative distribution value F s1 (10) Replace the formula F r1 (x), calculate the corresponding pixel value x, and then round x to get the corresponding mapping pixel value in the reference wrapped image.

[0113] Specifically, the pixel values ​​to be matched in the package image to be processed are replaced with the mapped pixel values ​​in the reference package image, and after all the pixel values ​​to be matched are replaced, a matched package image is obtained.

[0114] Specifically, Figure 1 As shown, in step S2, the matched wrapped image is divided into a strong edge wrapped image and a weak edge wrapped image.

[0115] Preferably, dividing the matched wrapped image into a strong edge wrapped image and a weak edge wrapped image comprises:

[0116] The area occupied by all contours combined in the matched parcel image is taken as the strong edge parcel image;

[0117] The strong edge wrapping image is removed from the matched wrapping image, and the remaining image is used as the weak edge wrapping image.

[0118] Specifically, Figure 6 As shown, the white area is the area occupied by all contour combinations in the matched wrapped image, that is, the area where the strong edge wrapped image is located; similarly, the black area is the area where the weak edge wrapped image is located.

[0119] Specifically, Figure 1As shown, in step S3, the strong edge wrapped image is subjected to sliding window filtering, and the pixel value of the window center pixel after filtering is determined according to the maximum, minimum, median and average values ​​of the pixel values ​​in the window to obtain a strong edge wrapped filtered image.

[0120] Preferably, the sliding window filtering is performed on the strong edge wrapped image, and the pixel value of the central pixel of the window after filtering is determined according to the maximum value, minimum value, median value and average value of the pixel values ​​in the window to obtain the strong edge wrapped filtered image, including:

[0121] Sequentially wrap each pixel in the image with a strong edge as the window center for sliding the window;

[0122] Determine the maximum, minimum and median values ​​of the pixels in the window, and the average value of the remaining pixel values ​​after removing the maximum and minimum values ​​of the pixels in the window;

[0123] The center pixel of the window is compared with the maximum value and the minimum value respectively; if the pixel is a maximum value or a minimum value, the median value is used as the pixel value of the pixel after filtering; otherwise, the average value is used as the pixel value of the pixel after filtering.

[0124] Specifically, when the sliding window processing is performed on the strong edge wrapped image, the size of the window is 3×3 or 5×5, and the sliding window is performed with each pixel point in the strong edge wrapped image as the window center in turn.

[0125] Exemplarily, if the size of the window is 3×3, 9 pixels are wrapped in the window, and the maximum pixel value, minimum pixel value, and median pixel value of the 9 pixels are determined. At the same time, the average value of the remaining 7 pixel values ​​after removing the maximum pixel value and the minimum pixel value is calculated, that is, the average value of the remaining pixel values ​​after removing the maximum and minimum pixel values ​​in the window.

[0126] Specifically, the pixel value of the center pixel of the window is compared with the maximum pixel value and the minimum pixel value respectively; if the pixel value of the center pixel of the window is the maximum pixel value or the minimum pixel value, the median pixel value is used as the pixel value of the center pixel of the window after filtering; otherwise, the average value of the remaining 7 pixel values ​​after removing the maximum pixel value and the minimum pixel value is used as the pixel value of the center pixel of the window after filtering.

[0127] Specifically, Figure 1 As shown, in step S4, the weak edge wrapping image is subjected to image dilation processing and mean filtering to obtain a weak edge wrapping filtered image.

[0128] Preferably, performing image dilation processing and mean filtering on the weak edge wrapping image to obtain the weak edge wrapping filtered image includes:

[0129] Sequentially wrap each pixel in the image with the weak edge as the window center for sliding window;

[0130] Get the maximum pixel value in the window, update the pixel value of the central pixel of the window to the maximum pixel value, and traverse each pixel in the weak edge wrapped image to obtain the expanded weak edge wrapped image;

[0131] The dilated weak edge wrapped image is mean filtered to obtain a weak edge wrapped filtered image.

[0132] Specifically, a window is sequentially used to slide in the weak edge wrapped image. The exemplary window is square and has a size of 3×3. The maximum pixel value of 9 pixel values ​​in the window is obtained, and the pixel value of the central pixel point of the window is updated to the maximum pixel value. Each pixel point in the weak edge wrapped image is traversed to complete the image dilation processing of the weak edge wrapped image, and the expanded weak edge wrapped image is obtained.

[0133] Specifically, the dilated weak edge parcel image is filtered using a mean filter to obtain a weak edge parcel filter image.

[0134] Specifically, Figure 1 As shown, in step S5, the strong edge wrapping filter image and the weak edge wrapping filter image are combined to obtain a preprocessed image.

[0135] Compared with the prior art, an image preprocessing method compatible with X-ray security inspection equipment of multiple manufacturers provided by an embodiment of the present invention divides X-ray images of different manufacturers into a background area and a package area, performs histogram matching on the package image and the reference package image, so that the package image of each manufacturer is unified, and then divides the matched package image into a strong edge package image and a weak edge package image for targeted filtering, so that the preprocessed X-ray images of different manufacturers are as unified as possible in format, so as to facilitate unified image recognition processing; at the same time, the gradient of the X-ray image is determined by the horizontal Sobel convolution kernel and the vertical Sobel convolution kernel, and the X-ray image is divided into a background image and a package image, so that the division result is more reliable; and the strong edge package image is subjected to sliding window filtering, and the weak edge package image is subjected to image dilation processing and mean filtering, so that the preprocessed package image is clearer and easier to perform unified image recognition.

[0136] Those skilled in the art will appreciate that all or part of the processes of the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium, wherein the computer-readable storage medium is a disk, an optical disk, a read-only storage memory, or a random access memory, etc.

[0137] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by any technician familiar with the technical field within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention.

Claims

1. An image preprocessing method compatible with X-ray security inspection equipment from multiple manufacturers, characterized in that: The image preprocessing method comprises: Obtaining X-ray images to be processed from different manufacturers, segmenting the package area and the background area of ​​the X-ray images to be processed, and obtaining the package images to be processed; Performing histogram matching on the parcel image to be processed according to the reference parcel image to obtain a matched parcel image; dividing the matched parcel image into a strong edge parcel image and a weak edge parcel image; Perform sliding window filtering on the strong edge wrapped image, determine the pixel value of the central pixel of the window after filtering according to the maximum, minimum, median and average of the pixel values ​​in the window, and obtain the strong edge wrapped filtered image; Perform image dilation processing and mean filtering on the weak edge wrapping image to obtain a weak edge wrapping filtered image; The strong edge wrapping filter image and the weak edge wrapping filter image are combined to obtain a preprocessed image.

2. The image preprocessing method according to claim 1, characterized in that: The step of segmenting the package area and the background area of ​​the X-ray image to be processed includes: The X-ray image to be processed is convolved by a preset horizontal Sobel convolution kernel and a preset vertical Sobel convolution kernel respectively, and the convolved images are merged and normalized to obtain a gradient image to be processed; The processed gradient image is binarized and segmented by a preset pixel threshold to obtain a segmented contour image; Determine all contour combinations in the segmented contour image, calculate the area of ​​the rectangular region occupied by each contour combination, and use the rectangular region occupied by the contour combination with the largest area as the package image to be processed.

3. The image preprocessing method according to claim 2, characterized in that: The preset horizontal Sobel convolution kernel is: The preset vertical Sobel convolution kernel is:

4. The image preprocessing method according to claim 3, characterized in that: The convolved images are merged and normalized to obtain a gradient image to be processed, including: The images are merged using the following formula: Among them, E represents the merged pixel value, Gx represents the pixel value in the image after horizontal convolution, and Gy represents the pixel value in the image after vertical convolution; Each pixel value of the merged image is normalized to a range of 255 to obtain an image within a normal pixel value range as the gradient image to be processed.

5. The image preprocessing method according to claim 2, characterized in that: The step of performing histogram matching on the parcel image to be processed according to the reference parcel image to obtain a matched parcel image includes: Calculate the cumulative distribution values ​​of the to-be-processed package image and the reference package image in the range of 0 to 255 pixel values; obtain the cumulative distribution function of the reference package image by linearly interpolating the cumulative distribution values ​​of the reference package image in the range of 0 to 255 pixel values; According to the cumulative distribution value corresponding to each pixel value in the package image to be processed and in combination with the cumulative distribution function of the reference package image, the mapped pixel value of each pixel value in the package image to be processed in the reference package image is determined; Each pixel value in the package image to be processed is replaced with the mapped pixel value in the reference package image to obtain a matched package image.

6. The image preprocessing method according to claim 2, characterized in that: The step of dividing the matched wrapped image into a strong edge wrapped image and a weak edge wrapped image comprises: The area occupied by all contours combined in the matched parcel image is taken as the strong edge parcel image; The strong edge wrapping image is removed from the matched wrapping image, and the remaining image is used as the weak edge wrapping image.

7. The image preprocessing method according to claim 6, characterized in that: The method of performing sliding window filtering on the strong edge wrapped image, determining the pixel value of the center pixel of the window after filtering according to the maximum value, minimum value, median value and average value of the pixel values ​​in the window, and obtaining the strong edge wrapped filtered image includes: Sequentially wrap each pixel in the image with a strong edge as the window center for sliding the window; Determine the maximum, minimum and median values ​​of the pixels in the window, and the average value of the remaining pixel values ​​after removing the maximum and minimum values ​​of the pixels in the window; The center pixel of the window is compared with the maximum value and the minimum value respectively; if the pixel is a maximum value or a minimum value, the median value is used as the pixel value of the pixel after filtering; otherwise, the average value is used as the pixel value of the pixel after filtering.

8. The image preprocessing method according to claim 7, characterized in that: The window size used when sliding the window for the strong edge wrapped image is 3×3 or 5×5.

9. The image preprocessing method according to claim 6, characterized in that: The step of performing image dilation processing and mean filtering on the weak edge wrapping image to obtain the weak edge wrapping filtered image includes: Sequentially wrap each pixel in the image with the weak edge as the window center for sliding window; Get the maximum pixel value in the window, update the pixel value of the central pixel of the window to the maximum pixel value, and traverse each pixel in the weak edge wrapped image to obtain the expanded weak edge wrapped image; The dilated weak edge wrapped image is mean filtered to obtain a weak edge wrapped filtered image.

10. The image preprocessing method according to claim 9, characterized in that: The window size used when sliding the window on the weak edge wrapped image is 3×3.