Disclosure of Invention
The invention aims to solve the defects in the prior art and provides a dangerous article image recognition algorithm.
In order to achieve the purpose, the invention adopts the following technical scheme:
a dangerous goods pattern recognition algorithm comprises the following specific steps:
(1) x-ray detection: obtaining an average effective atomic sequence value of an object image to be detected by an X-ray detector, jumping to the step (2) to perform image wavelet decomposition on the object image to be detected if the average effective atomic sequence value is greater than or equal to 10, and jumping to the step (6) to perform characteristic curve detection on the object image to be detected if the average effective atomic sequence value is less than or equal to 10;
(2) image wavelet decomposition: performing one-layer wavelet decomposition on an object image to be detected by adopting a wavelet decomposition method, wherein each layer of image is decomposed into a low-frequency wavelet coefficient matrix and a high-frequency wavelet coefficient matrix, the low-frequency coefficient represents an approximate part of the image, and the high-frequency wavelet coefficient matrix comprises coefficients in the horizontal direction, the vertical direction and the diagonal direction;
(3) and (3) image wavelet reconstruction: carrying out edge detection on an image approximate part, namely a low-frequency part by using a Canny algorithm to obtain a sub-image of the low-frequency part; simultaneously, utilizing Roberts and Sobel algorithms to carry out edge detection on coefficients in the horizontal direction, the vertical direction and the diagonal direction of the image, namely the high-frequency part, so as to obtain a sub-image of the high-frequency part; performing wavelet reconstruction on the sub-image of the low-frequency part and the sub-image of the high-frequency part to obtain an edge image;
(4) morphological filling: performing morphological filling on the edge image by using a hole filling mode to obtain an enhanced edge image to be detected;
(5) image matching: constructing a dangerous article standard image, and matching the enhanced edge image to be detected with the dangerous article standard image by using a curvature contour angular point method to obtain a dangerous article judgment result of a curvature angular point;
(6) and (3) characteristic curve detection: and constructing a characteristic curve of the common dangerous goods, and simultaneously carrying out dangerous goods detection matching on the image of the object to be detected by adopting an inorganic matter characteristic curve method to obtain a curved dangerous goods judgment result.
Preferably, the wavelet decomposition of the image in the step (2) needs a scale function in a two-dimensional case
And two-dimensional wavelet psi
H(x,y)、ψ
V(x, y) and ψ
D(x, y), each of which can be expressed as a one-dimensional scale function
And ψ, as follows:
its two-dimensional separable direction-sensitive wavelet can be represented as:
ψD(x,y)=ψ(x)ψ(y) (4)
in the formula: psiH、ψVAnd psiDRespectively representing the image intensity variation in different directions.
Preferably, given the separable two-dimensional scale and wavelet functions, the scale and wavelet basis functions are defined as follows:
in the formula: i ═ { H, V, D } represents wavelets in different directions;
then an f (x, y) discrete wavelet transform of size M × N:
in the formula: j is a function of
0In order to be the initial scale, the method comprises the following steps,
define a dimension of j
0F (x, y) approximation image; w
ψ(j, m, n) contains detail images in horizontal, vertical, and diagonal directions; let j
00, and N is selected to be M2
jJ-0, 1,2, …, j-1 and m, n-0, 1,2, … 2
j-1。
Preferably, the wavelet reconstruction formula in step (3) is as follows:
preferably, the hole filling formula in step (4) is as follows:
in the formula: k 1,2,3.
Preferably, the curvature in step (5) is mathematically defined as follows: taking an arc section from a point M on the smooth arc, wherein the length of the arc section is delta s, and the corresponding tangent rotation angle is delta alpha, and defining the arc section;
wherein the average curvature over Δ S is:
the curvature at point M is:
the formula for calculating the discrete curvature by using a curve parameter equation is as follows:
preferably, the curvature in step (5) includes global and local curvatures of the image, and the specific calculation process is as follows:
s1: calculating the average curvature of each to-be-detected enhanced edge image profile;
s2: then, judging the current contour point by taking the average curvature of the contour as a threshold, and if the current curvature is smaller than the threshold, determining the current contour point as a real contour angular point;
s3: after the angular points of all to-be-detected enhanced edge images are extracted, performing angular point matching on the to-be-detected enhanced edge images and the standard images of the dangerous goods;
when the corner points are matchedBuilding a corner feature descriptor, wherein the corner feature descriptor is defined as: suppose P1、P2And P3Three adjacent corner points on the contour curve S with curvatures of K1、K2And K3,P1To P2Is a distance L1,P2To P3Is L2) Then P is2The descriptor B is:
B=(L1+L2)(K3-K1) (14)。
preferably, the image matching in step (5) specifically comprises the following steps:
SS 1: extracting real corner points of a complete edge image with distinct outline features and a standard image of the dangerous goods;
SS 2: respectively solving descriptors B and B' of each enhanced edge image corner point to be detected and each dangerous article standard image corner point by using a formula (14);
SS 3: performing sequential difference operation on each corner point descriptor in the enhanced edge image to be detected and all corner point descriptors in the standard image of the hazardous article, wherein if the ratio of the first term to the second term of the vector of the difference value is smaller than a threshold value, and the threshold value is 0.5, the diagonal points of the two images are matched, otherwise, the diagonal points are not matched;
SS 4: and counting the matching similarity percentage of the corner points of the same target contour, and if the similarity is greater than a preset value, determining that the article is a dangerous article.
Preferably, the specific process of detecting the characteristic curve in the step (6) is as follows:
SSS 1: acquiring high and low energy gray values of an object image to be detected through an X-ray security inspection machine, and drawing a characteristic curve of the object image to be detected according to the high and low energy gray values;
SSS 2: constructing a characteristic curve of a common dangerous article, and taking the characteristic curve as a standard for detecting the dangerous article;
SSS 3: comparing the characteristic curve of the image of the object to be detected with the characteristic curve of the common dangerous goods; and if the characteristic curve of the image of the object to be detected is close to the characteristic curve of the dangerous goods, judging that the object is the dangerous goods, otherwise, judging that the object is normal.
Compared with the prior art, the invention has the beneficial effects that:
1. according to the method, the average effective atomic number value of an object is obtained by an X-ray detector, the detected object is divided into two types, the shape of the object with the average effective atomic number larger than 10 is detected and matched by adopting an X-ray image, and for the target with the average effective atomic number smaller than 10, a characteristic curve fitted by using the high-low gray value of the target is matched with a characteristic curve of a standard dangerous article; the dangerous goods are detected by combining two modes, so that the dangerous goods carried in the luggage can be comprehensively detected, the efficiency of dangerous goods detection is favorably improved, and the labor intensity of security personnel is favorably reduced.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments.
In the description of the present invention, it is to be understood that the terms "upper", "lower", "front", "rear", "left", "right", "top", "bottom", "inner", "outer", and the like, indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings, are merely for convenience in describing the present invention and simplifying the description, and do not indicate or imply that the device or element being referred to must have a particular orientation, be constructed and operated in a particular orientation, and thus, should not be construed as limiting the present invention.
Example 1
A dangerous goods pattern recognition algorithm comprises the following specific steps:
(1) x-ray detection: obtaining an average effective atomic sequence value of an object image to be detected by an X-ray detector, jumping to the step (2) to perform image wavelet decomposition on the object image to be detected if the average effective atomic sequence value is greater than or equal to 10, and jumping to the step (6) to perform characteristic curve detection on the object image to be detected if the average effective atomic sequence value is less than or equal to 10;
(2) image wavelet decomposition: performing one-layer wavelet decomposition on an object image to be detected by adopting a wavelet decomposition method, wherein each layer of image is decomposed into a low-frequency wavelet coefficient matrix and a high-frequency wavelet coefficient matrix, the low-frequency coefficient represents an approximate part of the image, and the high-frequency wavelet coefficient matrix comprises coefficients in the horizontal direction, the vertical direction and the diagonal direction;
(3) and (3) image wavelet reconstruction: carrying out edge detection on an image approximate part, namely a low-frequency part by using a Canny algorithm to obtain a sub-image of the low-frequency part; simultaneously, utilizing Roberts and Sobel algorithms to carry out edge detection on coefficients in the horizontal direction, the vertical direction and the diagonal direction of the image, namely the high-frequency part, so as to obtain a sub-image of the high-frequency part; performing wavelet reconstruction on the sub-image of the low-frequency part and the sub-image of the high-frequency part to obtain an edge image;
(4) morphological filling: performing morphological filling on the edge image by using a hole filling mode to obtain an enhanced edge image to be detected;
(5) image matching: constructing a dangerous article standard image, and matching the enhanced edge image to be detected with the dangerous article standard image by using a curvature contour angular point method to obtain a dangerous article judgment result of a curvature angular point;
(6) and (3) characteristic curve detection: and constructing a characteristic curve of the common dangerous goods, and simultaneously carrying out dangerous goods detection matching on the image of the object to be detected by adopting an inorganic matter characteristic curve method to obtain a curved dangerous goods judgment result.
In the step (2), the image wavelet decomposition needs a scale function under the condition of two dimensions
And two-dimensional wavelet psi
H(x,y)、ψ
V(x, y) and ψ
D(x, y), each of which can be expressed as a one-dimensional scale function
And ψ, as follows:
its two-dimensional separable direction-sensitive wavelet can be represented as:
ψD(x,y)=ψ(x)ψ(y) (4)
in the formula: psiH、ψVAnd psiDRespectively representing the image intensity variation in different directions.
After the two-dimensional scale and wavelet function are given separately, the scale and wavelet basis functions are defined as follows:
in the formula: i ═ { H, V, D } represents wavelets in different directions;
then an f (x, y) discrete wavelet transform of size M × N:
in the formula: j is a function of
0In order to be the initial scale, the method comprises the following steps,
define a dimension of j
0F (x, y) approximation image; w
ψ(j, m, n) contains detail images in horizontal, vertical, and diagonal directions; let j
00, and N is selected to be M2
jJ-0, 1,2, …, j-1 and m, n-0, 1,2, … 2
j-1。
The wavelet reconstruction formula in the step (3) is as follows:
the hole filling formula in the step (4) is as follows:
in the formula: k 1,2,3.
The mathematical definition of the curvature of step (5) is as follows: taking an arc section from a point M on the smooth arc, wherein the length of the arc section is delta s, and the corresponding tangent rotation angle is delta alpha, and defining the arc section;
wherein the average curvature over Δ S is:
the curvature at point M is:
the formula for calculating the discrete curvature by using a curve parameter equation is as follows:
the curvature in the step (5) comprises global curvature and local curvature of the image, and the specific calculation process is as follows:
s1: calculating the average curvature of each to-be-detected enhanced edge image profile;
s2: then, judging the current contour point by taking the average curvature of the contour as a threshold, and if the current curvature is smaller than the threshold, determining the current contour point as a real contour angular point;
s3: after the angular points of all to-be-detected enhanced edge images are extracted, performing angular point matching on the to-be-detected enhanced edge images and the standard images of the dangerous goods;
when the corner points are matched, a corner point feature descriptor is constructed, wherein the corner point feature descriptor is defined as: suppose P1、P2And P3Three adjacent corner points on the contour curve S with curvatures of K1、K2And K3,P1To P2Is a distance L1,P2To P3Is L2) Then P is2The descriptor B is:
B=(L1+L2)(K3-K1) (14)。
the image matching in the step (5) comprises the following specific steps:
SS 1: extracting real corner points of a complete edge image with distinct outline features and a standard image of the dangerous goods;
SS 2: respectively solving descriptors B and B' of each enhanced edge image corner point to be detected and each dangerous article standard image corner point by using a formula (14);
SS 3: performing sequential difference operation on each corner point descriptor in the enhanced edge image to be detected and all corner point descriptors in the standard image of the hazardous article, wherein if the ratio of the first term to the second term of the vector of the difference value is smaller than a threshold value, and the threshold value is 0.5, the diagonal points of the two images are matched, otherwise, the diagonal points are not matched;
SS 4: and counting the matching similarity percentage of the corner points of the same target contour, and if the similarity is greater than a preset value, determining that the article is a dangerous article.
The specific process of detecting the characteristic curve in the step (6) is as follows:
SSS 1: acquiring high and low energy gray values of an object image to be detected through an X-ray security inspection machine, and drawing a characteristic curve of the object image to be detected according to the high and low energy gray values;
SSS 2: constructing a characteristic curve of a common dangerous article, and taking the characteristic curve as a standard for detecting the dangerous article;
SSS 3: comparing the characteristic curve of the image of the object to be detected with the characteristic curve of the common dangerous goods; and if the characteristic curve of the image of the object to be detected is close to the characteristic curve of the dangerous goods, judging that the object is the dangerous goods, otherwise, judging that the object is normal.
In order to verify the image matching effect, an X-ray dangerous goods image with the size of 256 × 256 is selected as a sample (the sample comprises a pistol, handcuffs and a grenade), simulation is carried out by adopting matlab7.1, and the specific test data is as follows:
example 2
A dangerous goods pattern recognition algorithm comprises the following specific steps:
(1) x-ray detection: obtaining an average effective atomic sequence value of an object image to be detected by an X-ray detector, jumping to the step (2) to perform image wavelet decomposition on the object image to be detected if the average effective atomic sequence value is greater than or equal to 10, and jumping to the step (6) to perform characteristic curve detection on the object image to be detected if the average effective atomic sequence value is less than or equal to 10;
(2) image wavelet decomposition: performing one-layer wavelet decomposition on an object image to be detected by adopting a wavelet decomposition method, wherein each layer of image is decomposed into a low-frequency wavelet coefficient matrix and a high-frequency wavelet coefficient matrix, the low-frequency coefficient represents an approximate part of the image, and the high-frequency wavelet coefficient matrix comprises coefficients in the horizontal direction, the vertical direction and the diagonal direction;
(3) and (3) image wavelet reconstruction: carrying out edge detection on an image approximate part, namely a low-frequency part by using a Canny algorithm to obtain a sub-image of the low-frequency part; simultaneously, utilizing Roberts and Sobel algorithms to carry out edge detection on coefficients in the horizontal direction, the vertical direction and the diagonal direction of the image, namely the high-frequency part, so as to obtain a sub-image of the high-frequency part; performing wavelet reconstruction on the sub-image of the low-frequency part and the sub-image of the high-frequency part to obtain an edge image;
(4) morphological filling: performing morphological filling on the edge image by using a hole filling mode to obtain an enhanced edge image to be detected;
(5) image matching: constructing a dangerous article standard image, and matching the enhanced edge image to be detected with the dangerous article standard image by using a curvature contour angular point method to obtain a dangerous article judgment result of a curvature angular point;
(6) and (3) characteristic curve detection: constructing a common dangerous article characteristic curve, and simultaneously carrying out dangerous article detection matching on an object image to be detected by adopting an inorganic matter characteristic curve method to obtain a curved dangerous article judgment result;
the rest is the same as example 1.
In order to utilize the verification characteristic curve to detect the effect of inorganic dangerous goods, firecrackers with different thicknesses are selected in the test, the firecrackers are detected through the established firecracker characteristic curve, and the test detection data are as follows:
example 3
A dangerous goods pattern recognition algorithm comprises the following specific steps:
(1) x-ray detection: obtaining an average effective atomic sequence value of an object image to be detected by an X-ray detector, jumping to the step (2) to perform image wavelet decomposition on the object image to be detected if the average effective atomic sequence value is greater than or equal to 10, and jumping to the step (6) to perform characteristic curve detection on the object image to be detected if the average effective atomic sequence value is less than or equal to 10;
(2) image wavelet decomposition: performing one-layer wavelet decomposition on an object image to be detected by adopting a wavelet decomposition method, wherein each layer of image is decomposed into a low-frequency wavelet coefficient matrix and a high-frequency wavelet coefficient matrix, the low-frequency coefficient represents an approximate part of the image, and the high-frequency wavelet coefficient matrix comprises coefficients in the horizontal direction, the vertical direction and the diagonal direction;
(3) and (3) image wavelet reconstruction: carrying out edge detection on an image approximate part, namely a low-frequency part by using a Canny algorithm to obtain a sub-image of the low-frequency part; simultaneously, utilizing Roberts and Sobel algorithms to carry out edge detection on coefficients in the horizontal direction, the vertical direction and the diagonal direction of the image, namely the high-frequency part, so as to obtain a sub-image of the high-frequency part; performing wavelet reconstruction on the sub-image of the low-frequency part and the sub-image of the high-frequency part to obtain an edge image;
(4) morphological filling: performing morphological filling on the edge image by using a hole filling mode to obtain an enhanced edge image to be detected;
(5) image matching: constructing a dangerous article standard image, and matching the enhanced edge image to be detected with the dangerous article standard image by using a curvature contour angular point method to obtain a dangerous article judgment result of a curvature angular point;
(6) and (3) characteristic curve detection: constructing a common dangerous article characteristic curve, and simultaneously carrying out dangerous article detection matching on an object image to be detected by adopting an inorganic matter characteristic curve method to obtain a curved dangerous article judgment result;
the rest is the same as example 1.
In order to test the effectiveness of the invention, several articles including a cutter, a toy gun, bottled alcohol, gasoline and the like are selected as test samples, the test samples are respectively and independently mixed with other articles, a dangerous article shape image database (28 types) and common dangerous article characteristic curves (15 types) are established as dangerous article judgment standards, a plurality of tests are carried out in different directions and positions, and the detection accuracy rates of different articles are specifically as follows:
article with a cover
|
Number of samples
|
Rate of accuracy
|
False detection rate
|
Rate of missed examination
|
Cutting tool
|
80
|
91.25%
|
7.50%
|
8.13%
|
Toy gun
|
80
|
87.50%
|
5.20%
|
7.50%
|
Gasoline (gasoline)
|
80
|
92.00%
|
6.25%
|
5.00%
|
Bottled alcohol
|
80
|
90.00%
|
5.00%
|
7.13% |
As can be seen from the data tables of the embodiment 1, the embodiment 2 and the embodiment 3, the dangerous goods object detection accuracy of the invention is high, and the false detection rate and the omission factor are both below 10%, so that the invention can comprehensively detect the dangerous goods carried in the luggage, improve the efficiency of dangerous goods detection, and is beneficial to reducing the labor intensity of security personnel.
The above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art should be considered to be within the technical scope of the present invention, and the technical solutions and the inventive concepts thereof according to the present invention should be equivalent or changed within the scope of the present invention.