Disclosure of Invention
In order to solve the defects of the prior art, the invention provides a human body foreign matter detection method based on millimeter wave images, which solves the problems.
In order to achieve the above object, the present invention adopts the following technical solutions:
a human body foreign body detection method based on millimeter wave images comprises the following steps: acquiring a human body image through a millimeter wave imaging system; identifying a head region and a hand region of the acquired human body image; adjusting gray values of the identified head area and the identified hand area; carrying out noise reduction processing on the processed human body image; and identifying the category of the processed human body image.
Further, identifying a head region and a hand region of the acquired human body image, specifically, automatically positioning the head region and the hand region in the human body image through an image identification algorithm;
further, the head area and the hand area of the collected human body image are identified, specifically, a shooting device is used for shooting a human body, the head area and the hand area in the human body image shot by the shooting device are automatically positioned through an image identification algorithm, and the positioned head area and the positioned hand area in the human body image are mapped to the human body image collected by the millimeter wave imaging system so as to identify the head area and the hand area on the human body image.
Further, adjusting the gray values of the identified head region and hand region, specifically setting the gray values of the head region and hand region of the acquired human body image to be 0.
Further, the noise reduction processing is carried out on the processed human body image, and the noise reduction processing method comprises the following steps: carrying out thresholding segmentation on the processed human body image to obtain a binary image of the human body image; performing morphological operation on the thresholded and segmented binary image; and replacing the region with the larger threshold value in the processed binary image with the corresponding gray value of the originally acquired human body image.
Further, performing thresholding segmentation on the processed human body image to obtain a binary image of the image, specifically setting the gray value of a region in the processed image, where the gray value is smaller than a preset threshold value, to be 255, and setting the gray value of a region in the processed image, where the gray value is larger than the preset threshold value, to be 0, so that the binary image of the image obtained by performing thresholding segmentation on the processed image is a black-and-white image.
Further, performing morphological operation on the thresholded and segmented binary image, specifically closing image defects through closing operation, disconnecting weak and small connections among different connected regions through opening operation, enabling noise to form an isolated small region, and removing the noise through setting an area threshold.
Further, identifying the category of the processed human body image, specifically, dividing the human body image subjected to noise reduction processing into a plurality of sub-images; extracting a two-dimensional frequency spectrum of each subimage; extracting a feature vector of a two-dimensional frequency spectrum of the subimage; and classifying the extracted feature vectors.
Further, extracting a feature vector of the two-dimensional frequency spectrum of the sub-image, specifically, dividing the two-dimensional frequency spectrum into a plurality of sectors, and extracting a feature number from each sector to form the feature vector.
Further, a feature vector of the left half of the two-dimensional spectrum of the sub-image is extracted.
The millimeter wave image-based human body foreign matter detection method has the advantages that the head area and the hand area of the collected human body image are identified in advance, the identified head area and the identified hand area are preprocessed, so that the difficulty of subsequent image identification is reduced, and the identification speed and accuracy are improved.
Detailed Description
The invention is described in detail below with reference to the figures and the embodiments.
As shown in fig. 1 to 4, a method for detecting a human body foreign object based on a millimeter wave image includes the following steps: s1, acquiring a human body image through a millimeter wave imaging system; s2 identifying a head region and a hand region of the acquired human body image; s3, adjusting the gray values of the identified head area and the hand area; s4, carrying out noise reduction processing on the processed human body image; s5 identifies the category of the processed human body image.
For step S1, acquiring a human body image by the millimeter wave imaging system:
a large number of human target images are acquired using a millimeter wave imaging system, as shown in fig. 1.
For step S2, the head region and hand region of the captured human body image are identified:
in the embodiment of the present invention, the head region and the hand region of the acquired human body image are identified, specifically, the head region and the hand region in the human body image are automatically located by an image recognition algorithm, as shown in fig. 2.
Compared with a picture directly acquired by a shooting device (such as a CCD (charge coupled device) and the like), important information of the head and the hand of a human body can be lost, so that the information of the head and the hand of the human body can not be favorably identified by an image identification algorithm.
Adjusting the gray values of the recognized head region and hand region for step S3;
after the head region and the hand region in the human body image are identified, adjusting the gray value of the region to match the noise reduction processing in the following step, wherein the gray value of the head region and the gray value of the hand region of the collected human body image are set to be 0.
The noise reduction processing is performed on the processed human body image in step S4:
in order to obtain good effects of subsequent image enhancement, feature extraction and automatic target identification, noise needs to be removed through an image enhancement algorithm, and image quality needs to be improved. The main objective of denoising is to remove background noise and keep the integrity of the human body image to the maximum extent. The noise reduction processing is performed on the image processed in step S3, and includes the following steps: and performing thresholding segmentation on the processed image to obtain a binary image of the image, performing morphological operation on the thresholded segmented binary image, and replacing a region with a larger gray value in the processed binary image with a gray value of a corresponding region of the originally acquired image.
The threshold segmentation method is a commonly used image segmentation method, and can achieve a good effect when the gray values of the foreground object and the background object are distributed uniformly. In order to obtain good segmentation effect on different terahertz images, the embodiment of the invention adopts a soft threshold value, and the soft threshold value is obtained by an OTSU method so as to realize global optimization.
The thresholding and segmenting the processed image to obtain the binary image of the image is specifically to set the gray value of the region in the processed image, in which the gray value is smaller than the preset threshold value, to be 255 and set the gray value of the region in the processed image, in which the gray value is greater than the preset threshold value, to be 0, so that the thresholding and segmenting the processed image to obtain the binary image of the image is a black-and-white image, as shown in fig. 2.
Obtaining a binary image after threshold segmentation. Background noise cannot be completely removed due to the fact that pixels with high gray values exist in background pixels, and human body images are defective due to the fact that pixels with low gray values exist in the human body images, so that the noise needs to be further removed and the defective parts of the human bodies need to be filled through morphological processing.
Performing morphological operation on the thresholded and segmented binary image, specifically closing image defects through closing operation, disconnecting weak and small connections among different connected regions through opening operation to enable noise to form isolated small regions, and then removing the noise through setting an area threshold.
Due to the complexity of background noise, in the actual project implementation, in order to achieve the optimal denoising effect, different structural elements need to be continuously tried, and morphological operations such as opening, closing, corrosion, expansion and the like can be performed for multiple times.
In the embodiment of the invention, the collected human body image is a human body image, and the morphological operation can be respectively carried out on the upper half body and the lower half body aiming at the characteristic that two legs of the human body are in long strip shapes, wherein the upper half body adopts a square structural element, the lower half body adopts a rectangular structural element, and the morphological operation is processed as shown in fig. 3.
In the embodiment of the present invention, specifically, a white region with a gray value of 255 in the processed binary image is replaced with a gray value of a corresponding region of the originally acquired image.
In order to make the denoised image look more natural, the original noisy image is subjected to contrast stretching, and then the gray value is restored. Contrast stretching is performed by top-hat and bottom-hat transformation:
im'=im+tophat(im,se)-bothat(im,se),
where se denotes a structuring element, the structuring element used here is a square with a side length of 60. The final denoising result is shown in fig. 4.
For the category of the human body image after the identification processing at step S5:
the category of the processed human body image is identified, specifically, the human body image after noise reduction processing is divided into a plurality of sub-images by S51, a two-dimensional frequency spectrum of each sub-image is extracted by S51, a feature vector of the two-dimensional frequency spectrum of the sub-image is extracted by S53, and the extracted feature vector is classified by S54.
The noise-reduced image is divided into a plurality of sub-images for step S51:
since the target only occupies a small area of the whole image, the image can be divided into a plurality of sub-images, and whether the target exists in each sub-image or not can be respectively judged. Therefore, on one hand, the difficulty of identification is reduced, and on the other hand, the target can be positioned.
Extracting the two-dimensional spectrum for each sub-image for step S52:
for each sub-graph, its two-dimensional spectrum can be extracted as a feature of recognition. The natural human body surface is gently changed, the corresponding two-dimensional frequency spectrum amplitude is concentrated on a low-frequency part, and the amplitude approximately follows 1/f distribution; when other objects exist on the surface of the human body, the gray value of the corresponding gray image jumps, and the distribution of the corresponding two-dimensional frequency spectrum changes.
For step S53, extracting feature vectors of the two-dimensional spectrum of the sub-image:
specifically, the two-dimensional frequency spectrum is divided into a plurality of sectors, and each sector extracts a feature number to form a feature vector. In the embodiment of the invention, the two-dimensional frequency spectrum is divided into 8 rings, each fan-shaped opening angle is 45 degrees, and the feature vector corresponding to the two-dimensional frequency spectrum has only 64 dimensions. The sector division method can reflect the difference between high frequency and low frequency and the difference in different directions of the frequency spectrum, so that the distribution characteristic of the frequency spectrum can be well reflected, and the frequency spectrum feature extraction method has the advantages of small operand and high speed.
Because the two-dimensional spectrum has the central symmetry property, the complete two-dimensional spectrum can be reflected by only taking the characteristics of half of the two-dimensional spectrum, so that the left half of the two-dimensional spectrum can be selected, and the characteristic vector corresponding to the two-dimensional spectrum is only 32-dimensional.
The extracted feature vectors are classified for step S54:
and classifying the extracted feature vectors, specifically, the feature vectors extracted by the automatic target identifier, wherein one type is 1 and indicates that a target exists, and the other type is 0 and indicates that no target exists. The embodiment of the invention is to use a multi-layer perceptron which is classified and identified through a network and trained through a reverse error propagation method. Generally, 10 to 20 hidden layers are required to recognize image data. And outputting the result by adopting a Sigmoid function to obtain the probability of the target existing in each sub-graph.
In the collected human body data, the subgraphs with the targets only occupy a small part of all the subgraphs, and generally, the number of the subgraphs occupied by one target is not more than 4. Overall, only about no more than 10% of the subgraphs can be used for training and recognition of neural network classifiers. In order to make the training result more reliable, the training result is neither biased towards the result with the target, nor biased towards the result without the target, the number of sub-graphs with the target and the number of sub-graphs without the target in the training should be equal. Therefore, in order to have enough sub-figures available, the human pictures collected should be sufficient.
For the scheme of the invention, the method can also select to perform noise reduction processing on the acquired image and then perform head and hand region identification and gray level adjustment on the image after the noise reduction processing.
The foregoing illustrates and describes the principles, general features, and advantages of the present invention. It should be understood by those skilled in the art that the above embodiments do not limit the present invention in any way, and all technical solutions obtained by using equivalent alternatives or equivalent variations fall within the scope of the present invention.