A method, system and device for injecting pseudo-color contraband images based on X-ray
Through the image fusion method guided by mixing gradient vector field and contraband material, combined with secondary fusion technology, the edge and tone problems in the injection of contraband in X-ray pseudo-color image contraband is solved, and efficient and accurate contraband detection is achieved.
Patent Information
- Application Number
- CN202311158782.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-08
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2043-09-08
AI Technical Summary
When the existing X-ray pseudo-color image contraband injection technology deals with edge problems and overall tone problems after image synthesis, there are problems of edge blur, color distortion and obvious traces, which is difficult to meet the precise detection needs in the security inspection field.
The fusion method guided by mixed gradient vector fields and the fusion method guided by prohibited material are used, combined with the secondary fusion technology, the edge and material information of the image are processed separately, and the image fusion is optimized through the Poisson equation to ensure seamless fusion and material consistency of the image.
The seamless fusion of images is achieved, the traces of contraband injection are reduced, the accuracy and nature of contraband detection are improved, and the computing resource requirements are reduced.
Smart Images

Figure CN117197013B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a method, system and device for injecting contraband images based on X-ray pseudo-color images, which is mainly applied to the contraband injection technology of X-ray pseudo-color images and belongs to the field of image processing technology. Background Art
[0002] With the increasing prevalence of X-ray contraband object detection and recognition tasks in the security inspection field, the application of X-ray contraband image injection technology is becoming increasingly widespread. This technology can insert a preset contraband image (i.e., the injected target image) into any X-ray pseudo-color image (i.e., the source image) to produce a fused image. It can also freely expand image data for any contraband category, improving the training effectiveness of deep learning models, thereby achieving more accurate contraband detection and identification. This technology is widely applicable in areas such as rail transit security inspection, customs security inspection, freight security inspection, and security inspection test training.
[0003] Currently, many researchers and institutions are committed to developing more stable and accurate contraband injection technologies for X-ray pseudo-color images. For example, contraband injection methods using staged weighted image fusion can produce synthetic images close to real data. The authenticity of image injection can be further improved by using deep convolutional networks and building generative models. Specifically, commonly used image synthesis schemes can be divided into two main categories:
[0004] One type of method is based on pixel-domain fusion. Its main idea is to extract the mask region of the image to be injected with the contraband and inject it into the original X-ray pseudo-color image using a weighted averaging method, thus completing the injection of the corresponding contraband image. While this method is simple to implement and has fast computational speed, it ignores image details, reduces image contrast, and blurs image edges to a certain extent, leaving obvious artifacts of fusion. This makes it difficult to achieve satisfactory fusion results in most applications.
[0005] The other type of method is based on deep learning, which primarily utilizes a convolutional neural network model. The basic components are fused through weighted averaging, and the detailed components are fused based on a deep learning framework. The fused basic and detailed components are then superimposed to reconstruct the final composite image. The advantages of this type of method are lower noise, less distortion of the original image's texture features, and better preservation of the original data details. However, while this type of method performs well on natural images, it suffers from some color distortion when processing X-ray pseudo-color data in certain scenarios with perspective occlusion, affecting material discrimination. Furthermore, it relies on GPU computing resources to complete image generation.
[0006] In fact, recent research, whether based on pixel-level fusion or popular deep learning methods, has primarily been applied to natural image processing rather than X-ray pseudo-color image processing. This has resulted in many methods that perform well on natural images struggling to achieve the desired results when applied to X-ray pseudo-color images. In particular, the boundaries of some fused regions are often poorly processed, and the fusion artifacts are visible to the naked eye, making the image look less natural than the original contraband image.
[0007] Therefore, it is urgent to propose an accurate, stable, and seamless X-ray pseudo-color image fusion method that can effectively deal with the edge problems and overall color tone problems after synthesis and greatly reduce the traces of contraband injection. Summary of the Invention
[0008] In response to the above-mentioned existing technical problems, the present invention provides a method, system and device for injecting contraband images based on X-ray pseudo-color, so as to effectively deal with the edge problems and overall color tone problems after image synthesis, and greatly reduce the traces when injecting contraband images.
[0009] To achieve the above objectives, the present invention first provides a method for injecting a pseudo-color contraband image based on X-ray, comprising:
[0010] S1. Acquire an X-ray pseudo-color target image of contraband and an X-ray pseudo-color source image that does not contain contraband;
[0011] S2, using a fusion method guided by a mixed gradient vector field to fuse the target image with the source image in the fusion region and at the boundary of the fusion region to obtain a first fused image containing the contraband;
[0012] S3, using a fusion method guided by the material of the contraband, fusing the target image with the source image in the fusion area to obtain a second fused image containing the contraband;
[0013] S4. Fusing the first fused image and the second fused image twice in the fusion area and the area near the boundary to obtain a final fused image containing contraband.
[0014] The method of the present invention further comprises step S2:
[0015] S2-1, extracting the area where the contraband is located in the target image as the fusion area, and extracting the sub-target image of the target image in the fusion area;
[0016] S2-2. Select a location to be fused on the source image according to the size range of the fusion region, and extract a sub-source image of the source image in the fusion region, with the sub-source image having the same size as the sub-target image;
[0017] S2-3. Using the mixed gradient vector field of the sub-source image and the sub-target image as a guide, fuse the source image and the sub-target image to obtain a first fused image. The formula is as follows:
[0018]
[0019] Where, Ω is the fusion area; is the boundary of the fusion area; is the gradient vector field of the fused image in the fusion area; is the mixed gradient vector field of the sub-source image and the sub-target image; I * is the first fused image obtained by fusing the target image and the source image;
[0020] Furthermore, the above formula is simplified into Poisson equation by using Euler-Lagrange equation to obtain the first fused image I * The only solution to the equation is as follows:
[0021]
[0022] in, is the boundary of the fusion area; ΔI is the Laplace operator, and I is the fusion image in the fusion area; is the divergence of the mixed gradient vector field; I * It is the first fused image obtained by fusing the target image with the source image.
[0023] Furthermore, the method of the present invention calculates the mixed gradient vector field in step S2-3 according to the material categories of the objects in the sub-source image and the sub-target image, using the following formula:
[0024]
[0025] Where (x, y) is the coordinate of the pixel point in the fusion area; I A is the sub-source image of the source image in the fusion area; I B is the sub-target image of the target image in the fusion area; is the gradient vector field of the sub-source image; is the gradient vector field of the sub-target image; is the mixed gradient vector field of the sub-source image and the sub-target image.
[0026] The method of the present invention further comprises step S3:
[0027] S3-1, preprocessing the target image and extracting the fusion area and the area near the boundary;
[0028] S3-2, extracting the sub-target image of the target image in the fusion area;
[0029] S3-3. Select a location to be fused on the source image according to the size range of the fusion region, and extract a sub-source image of the source image in the fusion region, with the sub-source image and the sub-target image having the same size;
[0030] S3-4. Based on the material type of the prohibited items, perform adaptive pixel-level fusion on the sub-source image and the sub-target image to obtain a second fused image. The formula is as follows:
[0031]
[0032]
[0033] Where Ω is the fusion area; (x, y) is the coordinate of the pixel point in the fusion area; a is the weight value, which is obtained by uniformly distributed random sampling; I A is the sub-source image of the source image in the fusion area; I B is the sub-target image of the target image in the fusion area; I + It is the second fused image obtained after the target image and the source image are fused in the fusion area.
[0034] The method of the present invention further comprises the following steps:
[0035] S3-1-1, pseudo-color target image I obj Performing binarization image processing to obtain a binary image;
[0036] S3-1-2. Perform morphological processing of dilation and erosion on the binary image to obtain a fused region image, and extract the region where the contraband is located in the fused region image as the fused region;
[0037] S3-1-3. Perform morphological processing of corrosion and then expansion on the binary image to obtain a fusion region boundary image, and extract the white area in the fusion region boundary image as the area near the boundary.
[0038] The method of the present invention further comprises step S4:
[0039] The first fused image and the second fused image are fused twice in the fusion area and the area near the boundary. The formula is as follows:
[0040]
[0041] Where Ω is the fusion area; (x, y) is the coordinate of the pixel point in the fusion area; is the area near the boundary; I * is the first fused image; I + is the second fused image; I ois the final fused image.
[0042] As can be seen from the above technical solution, the method of the present invention first uses two image fusion methods to obtain two preliminary fused images, and then performs a secondary fusion on the two preliminary fused images to obtain the final fused image. The specific technical effects are as follows:
[0043] 1) Step S2 proposes an image fusion method guided by a mixed gradient vector field: a mathematical model based on variational optimization is adopted. The model is guided by the mixed gradient vector field of the source image and the target image of different materials in the fusion area, and the difference between the target image and the source image on the boundary of the fusion area is smoothly diffused into the fusion area. Therefore, the fused target image area can be seamlessly fused into the source image.
[0044] However, in image processing applications, it is not only necessary to achieve seamless fusion between the background image content, but also to ensure the authenticity of the synthesized image. The image fusion method described in step S2 only takes into account the constraints of the image gradient field in the fusion area. It can well fuse the image content of the background image (source image) and the foreground image (target image). However, due to the differences in image style, texture, noise, etc. between the foreground image and the background image themselves, the first fused image obtained will lack realism. For example, the texture information of the background image itself is lacking in the fusion area, and the traces of artificial synthesis are obvious. Based on this, steps S3 and S4 are also proposed, so that the final synthesized image can also be consistent with the background image in terms of image style, texture, etc., thereby increasing the authenticity of the fusion result.
[0045] 2) Step S3 proposes an image fusion method guided by the material of the contraband: In order to better maintain the pseudo-color image style of the target contraband, an adaptive weighting method is proposed according to the material of different target contraband. The sub-images extracted from the target image and the source image in the fusion area are fused at the pixel level, which can retain more original data of the source image, with relatively richer details and relatively more accurate target spatial position.
[0046] However, pixel-level image fusion primarily operates on the pixel level, a fundamental level of image fusion. Pre-fusion requires image preprocessing, which severely impacts subsequent fusion. Furthermore, processing X-ray pseudo-color data for certain perspective occlusion scenarios can result in color distortion, impacting material discrimination. Furthermore, image generation relies on GPU computing resources. Therefore, steps S2 and S4 are proposed to ensure that the final synthesized image maintains consistency with the background image in terms of image hue and texture, thereby increasing the accuracy of the fusion result.
[0047] 3) Step S4 proposes a secondary fusion of the fused image obtained by fusion of the above two images, which combines the advantages of the fusion of the above two images and makes up for the shortcomings of the fusion of the above two images. Whether it is retaining the color tone and material of the source image or inheriting the style and texture of the target image, it ultimately greatly reduces the sense of incongruity of the image after the secondary fusion, making the final fused image more natural and accurate.
[0048] Secondly, the present invention provides an X-ray pseudo-color contraband image injection system, which utilizes the X-ray pseudo-color contraband image injection method, including an acquisition module, a mixed gradient vector field fusion module, a contraband material fusion module, and a secondary fusion module;
[0049] The acquisition module is used to acquire an X-ray pseudo-color target image of contraband and an X-ray pseudo-color source image that does not contain contraband;
[0050] The mixed gradient vector field fusion module is used to fuse the target image and the source image in the fusion area and the boundary of the fusion area using a fusion method guided by the mixed gradient vector field to obtain a first fused image containing contraband;
[0051] The contraband material fusion module is used to fuse the target image with the source image in the fusion area using a fusion method guided by the contraband material to obtain a second fused image containing the contraband;
[0052] The secondary fusion module is used to perform secondary fusion of the first fused image and the second fused image in the fusion area and the area near the boundary to obtain a final fused image containing contraband.
[0053] Furthermore, the present invention provides an X-ray pseudo-color contraband image injection device, comprising at least one processor; and a memory connected to at least one of the processors; wherein,
[0054] The memory stores instructions that can be executed by the processor;
[0055] The instructions are used to be executed by the processor to implement the X-ray pseudo-color contraband image injection method.
[0056] In summary, the present invention proposes a stable, highly accurate, and high-fidelity method, system, and device, which are mainly used for injecting X-ray pseudo-color contraband images. It effectively addresses the edge and overall color tone issues after image synthesis, greatly reduces the traces of contraband injection, and improves the accuracy of contraband detection and labeling, thereby better assisting security personnel in security inspections.
[0057] Compared with the prior art, the technical advantages of the present invention are as follows:
[0058] A. Compared with other fusion methods for natural images, the present invention proposes an image fusion solution specifically for X-ray pseudo-color, which has better specificity in the application of X-ray pseudo-color contraband image injection.
[0059] B. Compared with the traditional pixel-level fusion method, the present invention retains the boundary information of the fused contraband image more completely and naturally, can achieve a seamless fusion process, and improve the quality of the fused image.
[0060] C. Compared with the currently popular deep learning methods, the present invention has lower computational cost and greater versatility. It not only better preserves the texture features of the original image and reduces color distortion, but also improves the efficiency and quality of security inspector training. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] In order to more clearly illustrate the embodiments of the present application 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 recorded in this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0062] Figure 1 is a flow chart of an embodiment of the method of the present invention;
[0063] Figure 2 The first fused image I obtained in step S2 of the method embodiment of the present invention * ;
[0064] Figure 3 This is a pre-processing flow chart of step S3-1 in an embodiment of the method of the present invention;
[0065] Figure 4 The target image I obtained in step S3-1 in the embodiment of the method of the present invention obj , target image I obj The fusion region Ω and the fusion region boundary image I edge ;
[0066] Figure 5 The source image I obtained in step S3-2 in the embodiment of the method of the present invention src and sub-source image I A ;
[0067] Figure 6 The second fused image I obtained in step S3 of the method embodiment of the present invention + ;
[0068] Figure 7The final fused image I obtained in step S4 of the method embodiment of the present invention o ;
[0069] Figure 8 This is a principle block diagram of an embodiment of the system of the present invention;
[0070] Figure 9 This is a principle block diagram of an embodiment of the device of the present invention. DETAILED DESCRIPTION
[0071] The present invention will be further described below with reference to the accompanying drawings and examples.
[0072] Example 1: X-ray-based pseudo-color contraband image injection method.
[0073] like Figure 1 As shown, this embodiment provides a method for injecting a pseudo-color contraband image based on X-ray, comprising the following steps:
[0074] S1. Obtain X-ray pseudo-color target image I of contraband obj , and the X-ray pseudo-color source image I without contraband src .
[0075] In specific implementation, prohibited items refer to items that are prohibited from being carried privately during security checks and pose a threat to people's lives and property, such as weapons, ammunition, explosives, highly toxic substances, anesthetics, radioactive substances, knives, etc. Target image I obj (i.e., the foreground image) is the contraband image to be fused, and the background is required to be white and contain no target contraband. src The background image can be obtained arbitrarily, for example, from a related professional website, or from an X-ray image that does not contain the target contraband and is stored by the X-ray machine during the detection process.
[0076] S2, using the image fusion method guided by the mixed gradient vector field, the target image I obj Blend into source image I src , get the first fused image I containing contraband * .
[0077] It should be noted that image fusion is a basic problem in image processing, and its purpose is to embed an object or a region in the target image into the source image to generate a new image. In the process of synthesizing images, in order to make the synthesized image more natural, the synthesis boundary should remain seamless. However, if the source image and the target image have significantly different texture features, the directly synthesized image will have obvious boundaries. To address this problem, this image fusion method uses the source image I src and target image I objThe mixed gradient vector field in the fusion region is used as a guide to transform the target image I obj With the source image I src The difference is smoothly diffused to the first fused image I * In this way, the first fused image I * The transition at the edge is more natural and soft, thus achieving the target image I obj With the source image I src Furthermore, the existing method of constructing the Poisson equation to solve the optimal pixel value can be used to fuse the source image and the target image while retaining the source image gradient information. The specified boundary conditions are used to solve a Poisson equation, achieving continuity in the gradient domain and thus achieving the effect of seamless fusion at the boundary.
[0078] Specifically, this step uses an image fusion method guided by a mixed gradient vector field, which includes the following steps:
[0079] S2-1. Extracting target image I obj The area where the contraband is located is taken as the fusion area Ω, and the target image I is extracted. obj Sub-target image I in the fusion region Ω B For example, we can use the existing image processing related extraction algorithms, such as the OPENCV function to extract the target image I obj The effective area, that is, the area where the prohibited items are located, is used for extraction.
[0080] S2-2, according to the target image I obj The size range of the fusion area Ω in the source image I src Randomly select the position to be fused and extract the source image I src Sub-source image I in the fusion region Ω A , and the sub-source image I A With sub-target image I B Same size.
[0081] S2-3. In existing technologies, X-ray security inspection images are formed by X-rays penetrating an object based on different transmittances. After an object is irradiated by X-rays, the X-ray security inspection machine assigns a color to the object based on the material's equivalent atomic number range and displays it on the monitor. Objects of different materials exhibit distinct colors under X-rays. Objects can be primarily categorized as organic, inorganic, or mixed. The images displayed on the monitor can be divided into the following four categories:
[0082] ① Orange: X-ray security inspection machines give orange color to organic matter with an equivalent atomic number less than 10, such as water, oil, explosives, paint, etc.
[0083] ② Blue: X-ray security inspection machines give blue color to inorganic substances with equivalent atomic numbers greater than 18, such as iron, copper, zinc, steel, etc., which are all inorganic substances. Knives, guns, etc. among the prohibited items are mainly composed of inorganic substances.
[0084] ③ Green: X-ray security inspection machines assign a green color to materials that fall between the two aforementioned categories, or to mixtures of these two. Specifically, mixtures are defined as materials with atomic numbers between 10 and 17, such as aluminum and silicon. Additionally, inorganic and organic substances may also appear green when they overlap.
[0085] ④ Black: Black is given to materials that are dense or large in volume and difficult for X-rays to penetrate.
[0086] It should be noted that since the X-ray pseudo-color rendering relies on the relative atomic number, this step first calculates the sub-source image I A The gradient vector field and sub-target image I B Gradient vector field, then according to the sub-target image I B With sub-source image I A The material category of the object is calculated based on the mixed gradient vector field of the X-ray relative atomic number. The formula is as follows:
[0087]
[0088] In formula (1), (x, y) is the coordinate of the pixel point in the fusion area Ω; I A is the source image I src The sub-source image in the fusion region Ω; I B The target image I obj Sub-target image in the fusion region Ω; is the sub-source image I A The gradient vector field of is the sub-target image I B The gradient vector field of is the source image I based on the relative atomic number of X-rays A With sub-target image I B The mixed gradient vector field can be obtained by the gradient vector field and the gradient vector field Calculated, and items of different materials correspond to different values
[0089] Second, using a mixed gradient vector field To guide image fusion, the first fused image I is obtained * . And, it is necessary to satisfy the first fused image I * The texture information of the source image can still be maintained, and there are no obvious traces at the boundaries. The calculation formula and boundary conditions are as follows:
[0090]
[0091] In formula (2), Ω is the fusion area; (x, y) is the coordinate of the pixel point in the fusion area Ω; is the boundary of the fusion region Ω; I * The target image I obj and source image I src A first fused image obtained after fusion in the fusion region Ω; is the gradient operator, which refers to the gradient vector field of the fused image in the fusion region Ω; is the sub-source image I A With sub-target image I B The mixed gradient vector field is also the mixed image I M The gradient vector field of .
[0092] Specifically, the variational equation of formula (2) shows that the seamless fusion of this step is based on the sub-source image I A With sub-target image I B Mixed gradient vector field As a guide, the boundaries of the fusion regions The target image I on obj and source image I src The difference is smoothly diffused into the fused image I. In this way, the fused image can be seamlessly integrated into the source image I src In the image, the pixels in the fused image and the mixed image I M The more similar the gradient information is, the better the original texture is preserved and the better the fusion effect is.
[0093] Then, by substituting the Euler-Lagrange equation and combining the concepts of divergence and Laplace to optimize the objective function of formula (2), formula (2) can be simplified to the Poisson equation form, thereby obtaining the first fused image I * The unique solution of Poisson's equation and boundary conditions are as follows:
[0094]
[0095] In formula (3), is the boundary of the fusion region Ω; is the Laplace operator, I refers to the fused image in the fusion region Ω, and (x, y) is the coordinate of the pixel point in the fusion region Ω; is the mixed gradient vector field Divergence of I * The target image I objThe first fused image is obtained after the source image Isrc is fused in the fusion region Ω. And the constraint condition is that The first fused image I after fusion * With mixed gradient vector fields The corresponding mixed image I M The values are the same.
[0096] It should be noted that the above variational equation (2) and the Poisson equation (3) with Dirichlet boundary conditions can be solved by the discrete quantization method in the prior art. In addition, the gradient vector field of the known fusion image is Find the divergence You only need to take the derivative, and finally perform Poisson equation reconstruction and solve the Poisson equation. After solving x, you can reconstruct the fused image.
[0097] In general, after the above Poisson fusion, the target image I obj and source image I src After fusion, the first fused image I is obtained * .like Figure 2 As shown in the figure, the two images are seamlessly connected, the transition is natural, and the boundary problem is well solved.
[0098] S3. Since items can be mainly divided into organic, inorganic and mixed materials, and different types of contraband have different materials, the image fusion method guided by the material of the contraband is used to transform the target image I obj Blend into source image I src , get the fused image I containing contraband + , including the following steps:
[0099] S3-1. Target image I to be injected obj Perform preprocessing and extract the preprocessed target image I obj The fusion region Ω and its boundary area in
[0100] like Figure 3 and Figure 4 As shown, for the target image I obj The pretreatment adopts conventional technology, and the specific process is as follows:
[0101] S3-1-1. First, let’s take a long knife as an example of prohibited items. Figure 4 As shown in the image (a), the pseudo-color target image I is obj Perform binarization image processing to obtain a binary image.
[0102] It should be noted that in the prior art, image binarization involves setting the grayscale values of pixels in an image to 0 or 255, essentially rendering the entire image appear distinctly black and white. Binary images play a crucial role in digital image processing. Binarization significantly reduces the amount of data in an image, thereby highlighting the outline of the target. Furthermore, the specific threshold value corresponding to the data used in different situations varies, so the threshold value can be determined based on the actual situation.
[0103] S3-1-2. Secondly, perform morphological processing of dilation and erosion on the binary image to obtain the fused region image, such as Figure 4 As shown in the image (b), the area where the contraband is located in the fusion area image is extracted and the area where the contraband is located is used as the fusion area Ω.
[0104] It's important to note that, in existing technology, erosion and dilation are the most basic morphological operations on binary images, both targeting white areas (highlights). Dilation expands the highlights in an image, resulting in a larger highlight area than the original image; erosion erodes the highlights in the original image, resulting in a smaller highlight area. Furthermore, the dilation minus erosion operation is called a gradient operation. Specifically, the image is eroded and dilated, and the result of the erosion operation is subtracted from the result of the dilation operation. The resulting gradient data is obtained. This can be achieved using OPENCV functions.
[0105] S3-1-3. At the same time, the binary image is subjected to morphological processing by first corroding and then dilating to obtain the boundary image I of the fusion area. edge ,like Figure 4 As shown in the image (c), the fusion area boundary image I edge The white area in the image is defined as the area near the boundary
[0106] It should be noted that in the prior art, the operation of first eroding and then dilating is called an opening operation. Its function is to amplify cracks and low-density areas, eliminate small objects, and smooth the boundaries of larger objects without changing their areas. The above can be achieved through the OPENCV function.
[0107] S3-2. Extracting target image I obj Sub-target image I in the fusion region Ω B .
[0108] S3-3, according to the target image I obj The size range of the fusion area Ω is in the source image I src Randomly select the position to be fused and extract the source image I src Sub-source image I in the fusion region Ω A, and the sub-source image I A With sub-target image I B Same size, such as Figure 5 shown.
[0109] S3-4, according to the different types of contraband materials, the sub-source image I A With sub-target image I B Adaptive pixel-level fusion is performed. Pixel-level fusion in the prior art refers to splicing and fusion based on image pixels, fusing two or more images into a whole to obtain a second fused image I + , the calculation formula is as follows:
[0110]
[0111]
[0112] In formula (4) and formula (5), (x, y) is the coordinate of the pixel point in the fusion area Ω, I A is the source image I src The sub-source image in the fusion region Ω; I B The target image I obj The sub-target image in the fusion area Ω; a is the weight value, which is obtained by random sampling from a uniform distribution, and the fusion effect is best within the uniform distribution range; uniform(x, y, z) is uniform sampling in the uniformly distributed xy coordinate system, and the step size is Z; I + is the target image I obj and source image I src The second fused image is obtained after fusion in the fusion region Ω.
[0113] In summary, after the above steps, the target image I obj and source image I src After fusion, the second fused image I is obtained + .like Figure 6 As shown, the second fused image I + The effect is good and can protect the edge texture details of the image to a certain extent, but some colors are distorted, which affects the judgment of the material.
[0114] S4, the first fused image I * and the second fused image I + Perform secondary fusion to obtain the final fused image I containing contraband o .
[0115] In specific implementation, the first fused image I is obtained by performing image fusion guided by the mixed gradient guidance vector. * , and the fused image I obtained by image fusion guided by the material of contraband+ , in the area near the boundary The image of the fusion area Ω is fused twice, and the formula is as follows:
[0116]
[0117] In formula (6), Ω is the fusion area; is the area near the boundary of the fusion region Ω; (x, y) is the coordinate of the pixel point in the fusion region Ω; I * is the first fused image obtained by using the mixed gradient vector field as a guide, I + is the second fused image obtained by using the contraband material as a guide, I ° is the final fused image.
[0118] It should be noted that since the first fused image I * The source image I can be better embedded near the boundary src Therefore, in the area near the boundary Directly select the first fused image I * The pixel values on the source image I are greatly reduced. src The destruction of fusion boundaries.
[0119] Moreover, since the pixel weighted averaging method (WA) is the simplest and most direct image fusion method in the prior art, the weighted averaging method is adopted in the fusion area Ω to perform the fusion of the first fused image I * and the second fused image I + Fusion is performed, which not only makes the fusion area Ω retain the source image I src The hue, gloss, and target image I obj style and texture, and also greatly reduces the first fused image I * and the second fused image I + The fused image feels awkward.
[0120] After the above steps, if Figure 7 As shown, the final fusion image is compared with I o The first fused image I * and the second fused image I + , more natural and stable.
[0121] In summary, the technical effects of the method of the present invention are specifically described as follows:
[0122] 1. Step S2 proposes an image fusion method guided by a mixed gradient vector field. By calculating the mixed gradient field in the source image region and the target image region of different materials and using this as a guide for image fusion, the target contraband image can be seamlessly integrated into the original image to obtain a first fused image.
[0123] 2. Step S3 proposes an image fusion method guided by the material of contraband. Adaptive weighted calculation is performed according to the material of different target contraband, completing the pixel-level fusion of the source image and the target image while retaining the pseudo-color image style to obtain a second fused image.
[0124] 3. Step S4 performs a secondary fusion of the first fused image and the second fused image obtained by the above two methods. The resulting fused image is more natural, which not only effectively addresses the edge problem and overall color tone problem after synthesis, but also greatly reduces the traces of contraband injection, thereby improving the efficiency and accuracy of contraband detection tasks in intelligent security inspections.
[0125] Example 2: X-ray-based pseudo-color contraband image injection system.
[0126] like Figure 8 As shown, this embodiment provides a system for injecting contraband images based on X-ray pseudo-color, using the method for injecting contraband images based on X-ray pseudo-color, including an acquisition module, a mixed gradient vector field fusion module, a contraband material fusion module, and a secondary fusion module.
[0127] The acquisition module is used to acquire the X-ray pseudo-color target image I of the contraband. obj , and the X-ray pseudo-color source image I without contraband src .
[0128] The mixed gradient vector field fusion module is used to adopt the mixed gradient vector field As a guided fusion method, the target image I obj With the source image I src In the fusion region Ω and the fusion region boundary Perform fusion to obtain the first fused image I containing contraband * .
[0129] The contraband material fusion module is used to use a fusion method guided by the contraband material to transform the target image I obj With the source image I src Fusion is performed in the fusion area Ω to obtain the second fused image I containing contraband + .
[0130] The secondary fusion module is used to transform the first fused image I* and the second fused image I + In the fusion region Ω and the area near the boundary Perform secondary fusion to obtain the final fused image I containing contraband o .
[0131] In other embodiments, the mixed gradient vector field fusion module includes a first extraction sub-target image unit, a first extraction sub-source image unit, and a first fused image acquisition unit.
[0132] Wherein, the sub-target image extraction unit is used to extract the target image I obj The area where the contraband is located is taken as the fusion area Ω, and the target image I is extracted obj The sub-target image I in the fusion region Ω B .
[0133] The sub-source image extraction unit is used to extract the sub-source image from the source image I according to the size range of the fusion area Ω. src Select the position to be fused and extract the source image I src Sub-source image I in the fusion region Ω A , and the sub-source image I A With sub-target image I B Same size.
[0134] The first fused image acquisition unit is used to obtain the sub-source image I A With sub-target image I B Mixed gradient vector field As a guide, the source image I src With the target image I obj Perform fusion to obtain the first fused image I * , the formula is as follows:
[0135]
[0136] Where, Ω is the fusion area; is the boundary of the fusion area; is the gradient vector field of the fused image in the fusion area; is the sub-source image I A With sub-target image I B Mixed gradient vector field of I * The target image I obj and source image I src a first fused image obtained after fusion;
[0137] Furthermore, the above formula is simplified into Poisson equation by using Euler-Lagrange equation, and the first fused image I is obtained. * The only solution to the equation is as follows:
[0138]
[0139] in, is the boundary of the fusion region Ω; ΔI is the Laplace operator, and I is the fusion image in the fusion region Ω; is the mixed gradient vector field Divergence of I * The target image I obj With the source image I src The first fused image obtained after fusion.
[0140] In a specific implementation, the first fused image acquisition unit further includes a mixed gradient vector field calculation unit for calculating the mixed gradient vector field according to the sub-source image I A With sub-target image I B The category of the item material in the calculation of the mixed gradient vector field The formula is as follows:
[0141]
[0142] Where (x, y) is the coordinate of the pixel point in the fusion area Ω; I A is the source image I src The sub-source image in the fusion region Ω; I B The target image I obj Sub-target image in the fusion region Ω; is the sub-source image I A The gradient vector field of is the sub-target image I B The gradient vector field of is the sub-source image I A With sub-target image I B The mixed gradient vector field.
[0143] In other embodiments, the contraband material fusion module includes a preprocessing unit, a second extraction sub-target image unit, a second extraction sub-source image unit, and a second fusion image acquisition unit.
[0144] Wherein, the pre-processing unit is used to process the target image I obj Perform preprocessing and extract the fusion area Ω and the area near the boundary When implementing it specifically, Figure 3 and Figure 4 As shown, the pre-processing unit is used to process the pseudo-color target image I objPerform binary image processing to obtain a binary image; perform morphological processing of dilation minus erosion on the binary image to obtain a fusion region Ω image, and extract the area where the contraband is located in the fusion region Ω as the fusion region Ω; perform morphological processing of erosion followed by dilation on the binary image to obtain a fusion region boundary image I edge , and extract the fusion area boundary image I edge The white area in the figure is the area near the boundary
[0145] The second sub-target image extraction unit is used to extract the target image I obj In the fusion region Ω, the sub-target image I B .
[0146] The second extraction sub-source image unit is used to extract the sub-source image from the source image I according to the size range of the fusion area Ω. src Select the position to be fused and extract the source image I src Sub-source image I in the fusion region Ω A , and the sub-source image I A and sub-target image I B Same size.
[0147] The second fusion image acquisition unit is used to convert the sub-source image I into A and sub-target image I B Perform adaptive pixel-level fusion to obtain the second fused image I + , the calculation formula is as follows:
[0148]
[0149]
[0150] Where Ω is the fusion area; (x, y) is the coordinate of the pixel point in the fusion area Ω; a is the weight value obtained by random sampling of uniform distribution; I A is the sub-source image of the source image in the fusion region Ω; I B is the sub-target image of the target image in the fusion area Ω; I + The target image I obj With the source image I src The second fused image is obtained after fusion in the fusion region Ω.
[0151] In specific implementation, the secondary fusion module is used to transform the first fused image I * and the second fused image I + In the fusion area Ω and the area near the boundary Perform secondary fusion, the formula is as follows:
[0152]
[0153] Where Ω is the fusion area; (x, y) is the coordinate of the pixel point in the fusion area Ω; is the area near the boundary; I * is the first fused image; I + is the second fused image; I o is the final fused image.
[0154] In summary, the system of the present invention is applied to the injection of contraband into X-ray pseudo-color images, effectively solving the edge problem and overall color tone problem after image synthesis, and greatly reducing the traces of X-ray pseudo-color contraband injection, thereby improving the accuracy of contraband detection and labeling, thereby better assisting security personnel in security inspections.
[0155] It should be noted that the X-ray pseudo-color contraband image injection system provided in the above embodiment is merely illustrated by the division of the above-mentioned functional modules. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the modules or steps in the embodiments of the present invention can be further decomposed or combined. For example, the modules in the above-mentioned embodiments can be combined into a single module or further divided into multiple sub-modules to complete all or part of the functions described above. The names of the modules and steps involved in the embodiments of the present invention are merely for the purpose of distinguishing the modules or steps and are not to be considered as improper limitations of the present invention.
[0156] Example 3: X-ray-based pseudo-color contraband image injection device.
[0157] like Figure 9 As shown, the present invention provides an X-ray pseudo-color contraband image injection device, comprising at least one processor; and a memory electrically connected to at least one of the processors; wherein the memory stores instructions executable by the processor; the instructions are used to be executed by the processor to implement the X-ray pseudo-color contraband image injection method.
[0158] The processor may be a central processing unit (CPU) or other forms of processing units with data processing capabilities and / or instruction execution capabilities, and may control other components in the device to perform desired functions.
[0159] The memory may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory. The non-volatile memory may include, for example, read-only memory (ROM), a hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor may execute the instructions to implement the functions of the methods and / or systems thereof described in the various embodiments above.
[0160] The instructions are computer program code written in one or more programming languages, or a combination thereof, for performing the operations of the present application. The programming languages include object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as "C" or similar programming languages. The program code may execute entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on the remote computer or server.
[0161] In addition, the block diagrams of the systems and devices to which the present invention relates are intended only as illustrative examples and are not intended to require or imply that they must be connected, arranged, or configured in the manner shown in the block diagrams. As will be appreciated by those skilled in the art, these systems and devices can be connected, arranged, or configured in any manner. Words such as "including," "comprising," "having," and the like are open-ended words that mean "including but not limited to," and can be used interchangeably therewith. The words "or" and "and" used herein refer to the words "and / or" and can be used interchangeably therewith unless the context clearly indicates otherwise. The word "such as" used herein refers to the phrase "such as but not limited to," and can be used interchangeably therewith.
[0162] Furthermore, those skilled in the art will appreciate that the various modules or steps of the present invention described above can be implemented using a general-purpose computing device. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Alternatively, they can be implemented using program code executable by a computing device, which can then be stored in a storage device and executed by the computing device. Alternatively, they can be fabricated into separate integrated circuit modules, or multiple modules or steps can be fabricated into a single integrated circuit module for implementation. Thus, the present application is not limited to any particular combination of hardware and software.
[0163] Thus far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it will be readily understood by those skilled in the art that the scope of protection of the present invention is obviously not limited to these specific embodiments. Without departing from the principles of the present invention, those skilled in the art may make equivalent changes or substitutions to the relevant technical features, and the technical solutions after such changes or substitutions will fall within the scope of protection of the present invention.
Claims
1. A method for injecting contraband images based on X-ray pseudo-color images, characterized in that: include: S1. Acquire an X-ray pseudo-color target image of contraband and an X-ray pseudo-color source image that does not contain contraband; S2, using a fusion method guided by a mixed gradient vector field to fuse the target image with the source image in the fusion region and at the boundary of the fusion region to obtain a first fused image containing the contraband; S3, using a fusion method guided by the material of the contraband, fusing the target image with the source image in the fusion area to obtain a second fused image containing the contraband; The step S3 includes: S3-1, preprocessing the target image and extracting the fusion area and the area near the boundary; S3-2, extracting the sub-target image of the target image in the fusion area; S3-3. Select a location to be fused on the source image according to the size range of the fusion region, and extract a sub-source image of the source image in the fusion region, with the sub-source image and the sub-target image having the same size; S3-4. Based on the material type of the prohibited items, perform adaptive pixel-level fusion on the sub-source image and the sub-target image to obtain a second fused image. The formula is as follows: ; ; in, For the integration area; is the coordinate of the pixel point in the fusion area; is the weight value, obtained by random sampling from uniform distribution; is the sub-source image of the source image in the fusion area; is the sub-target image of the target image in the fusion area; is the second fused image obtained after the target image and the source image are fused in the fusion area; S4, performing secondary fusion of the first fused image and the second fused image in the fusion area and the area near the boundary to obtain a final fused image containing contraband; The step S4 includes: The first fused image and the second fused image are fused twice in the fusion area and the area near the boundary. The formula is as follows: ; in, For the integration area; is the coordinate of the pixel point in the fusion area; For the area near the border; is the first fused image; is the second fused image; is the final fused image.
2. The method for injecting contraband images based on X-ray pseudo-color images according to claim 1, characterized in that: The step S2 includes: S2-1, extracting the area where the contraband is located in the target image as the fusion area, and extracting the sub-target image of the target image in the fusion area; S2-2. Select a location to be fused on the source image according to the size range of the fusion region, and extract a sub-source image of the source image in the fusion region, with the sub-source image having the same size as the sub-target image; S2-3. Using the mixed gradient vector field of the sub-source image and the sub-target image as a guide, fuse the source image and the sub-target image to obtain a first fused image. The formula is as follows: ; in, For the integration area; is the boundary of the fusion area; is the gradient vector field of the fused image in the fusion area; is the mixed gradient vector field of the sub-source image and the sub-target image; is the first fused image obtained by fusing the target image and the source image; Furthermore, the above formula is simplified into Poisson equation using Euler-Lagrange equation to obtain the first fused image The only solution to the equation is as follows: ; in, is the boundary of the fusion area; is the Laplace operator, and I is the fused image in the fused area; is the divergence of the mixed gradient vector field; It is the first fused image obtained by fusing the target image with the source image.
3. The method for injecting contraband images based on X-ray pseudo-color images according to claim 2, characterized in that: The mixed gradient vector field in step S2-3 is calculated based on the material categories of the objects in the sub-source image and the sub-target image, using the following formula: ; in, is the coordinate of the pixel point in the fusion area; is the sub-source image of the source image in the fusion area; is the sub-target image of the target image in the fusion area; is the gradient vector field of the sub-source image; is the gradient vector field of the sub-target image; is the mixed gradient vector field of the sub-source image and the sub-target image.
4. The method for injecting contraband images based on X-ray pseudo-color images according to claim 1, characterized in that: The step S3-1 includes: S3-1-1. Target image with pseudo color Performing binarization image processing to obtain a binary image; S3-1-2. Perform morphological processing of dilation and erosion on the binary image to obtain a fused region image, and extract the region where the contraband is located in the fused region image as the fused region; S3-1-3. Perform morphological processing of corrosion and then expansion on the binary image to obtain a fusion region boundary image, and extract the white area in the fusion region boundary image as the area near the boundary.
5. A system for injecting contraband images based on X-ray pseudo-color images, using the method for injecting contraband images based on X-ray pseudo-color images according to any one of claims 1 to 4, characterized in that: It includes acquisition module, mixed gradient vector field fusion module, contraband material fusion module, and secondary fusion module; The acquisition module is used to acquire an X-ray pseudo-color target image of contraband and an X-ray pseudo-color source image that does not contain contraband; The mixed gradient vector field fusion module is used to fuse the target image and the source image in the fusion area and the boundary of the fusion area using a fusion method guided by the mixed gradient vector field to obtain a first fused image containing contraband; The contraband material fusion module is used to fuse the target image and the source image in the fusion area using a fusion method guided by the contraband material to obtain a second fused image containing the contraband. The module includes: preprocessing the target image and extracting the fusion area and the area near the boundary; extracting a sub-target image of the target image in the fusion area; selecting a location to be fused on the source image based on the size range of the fusion area, and extracting a sub-source image of the source image in the fusion area, wherein the sub-source image and the sub-target image are of the same size; and adaptively fusing the sub-source image and the sub-target image at the pixel level based on the type of the contraband material to obtain the second fused image. The formula is as follows: ; ; in, For the integration area; is the coordinate of the pixel point in the fusion area; is the weight value, obtained by random sampling from uniform distribution; is the sub-source image of the source image in the fusion area; is the sub-target image of the target image in the fusion area; is the second fused image obtained after the target image and the source image are fused in the fusion area; The secondary fusion module is used to perform secondary fusion of the first fused image and the second fused image in the fusion area and the area near the boundary to obtain a final fused image containing contraband. The module includes: performing secondary fusion of the first fused image and the second fused image in the fusion area and the area near the boundary, and the formula is as follows: ; in, For the integration area; is the coordinate of the pixel point in the fusion area; For the area near the border; is the first fused image; is the second fused image; is the final fused image.
6. A device for injecting false color contraband images based on X-ray, characterized in that: comprising at least one processor; and a memory connected to at least one of the processors; wherein, The memory stores instructions that can be executed by the processor; The instructions are used to be executed by the processor to implement the X-ray pseudo-color contraband image injection method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Graph fusion method and system based on linear equation
CN106651749A
Fusion defogging method for medical operation video image
CN112734679A
