Identity and body temperature detection system based on image registration

In view of the normalization of epidemic prevention and control work, the low detection efficiency of traditional temperature measurement methods, and the existence of infection risks, an infrared thermal imaging temperature measurement system that can measure and identify the temperature of more than two people is designed. The system uses the Raspberry Pi as the core controller, using visible light and infrared cameras to capture identity and body temperature information. Identity recognition is based on OpenCv, using the Face Recognition face recognition framework to complete the identity recognition; body temperature detection is based on image registration, and the face position is mapped to the infrared image in real time through affine transformation, and finally the temperature of the human face area is obtained and displayed on the screen. The final experimental results show that it can simultaneously identify multiple people and detect body temperature with high accuracy, which can basically meet the requirements of rapid body temperature screening in intensive situations.


Introduction
The novel coronavirus pneumonia is the most widespread global pandemic that has affected humanity in the past century. According to the existing case data, the new coronavirus pneumonia is mainly manifested by fever, dry cough, fatigue, etc. As a result, temperature checks are currently the most widely used health screening method. At present, the human body thermal imaging monitoring temperature measurement in public places mainly adopts two ways: handheld thermometer and online monitoring by staff [1] .
For the exercise crowd in intensive situations, this paper designed a body temperature measurement method based on image registration. The system adopts thermal infrared and visible binocular cameras, real-time multi-person face recognition through visible cameras, and maps the face area into infrared images through image registration technology, and finally realizes identity recognition and body temperature detection to identify whether the identity of pedestrians meets the needs of epidemic prevention.

System hardware design
In order to realize the design scheme of accurate temperature measurement and identification, the system uses Raspberry Pi 4B as the main controller, which is divided into two parts: identification and infrared temperature measurement. The hardware composition of the system is shown in Figure 1.

MLX90640 Temperature acquisition module
The MLX90640 module is a 24×32-pixel infrared array sensor with a total of 768 measurement pixels, small size, and low power consumption [2] . The chip measures a wide temperature range, the normal working temperature range is -40 ~ 300 °C, the temperature measurement range is -40 ~ 85 °C, and the temperature measurement accuracy can reach ±1 °C. For non-contact infrared temperature measurement modules, an important concept is the "field of view (FOV)". The MLX90640 has two field of view (FOV) options, a BAA version with a FOV of 110° ×75° and a BAB version with a FOV of 55° × 35°. The area of the measured object and the measured distance of the module meet the following relationships: (1) The BAA version is more in line with the experimental requirements.

Raspberry Pi V2 Camera module
The Raspberry Pi Camera Module v2 used in this article is a high-quality 8-megapixel Sony IMX219 sensor expansion board customized for the Raspberry Pi with a fixed-focus lens. The module supports 3280 x 2464 pixel still image shooting while supporting 1080p30, 720p60 and 640x480p60/90 camera functions.

Raspberry Pi 4B Main control module
The Raspberry Pi is an open source hardware platform that has a large and rich hardware interface and open source software resources that can be used directly [3] . At the same time, the Raspberry Pi 4B uses the more popular Type-c interface, which supports a larger (5V 3A) current input, improving power supply stability.

Face identification
Face recognition is a technique in which a computer extracts facial features and authenticates them based on the features. With the development of technology, biometric recognition technology based on face recognition has gradually entered people's lives. Compared with the traditional authentication technology, it takes advantage of the characteristics of the person itself, high reliability, good security, and strong practicality, and has been concerned by many researchers for many years [4] .

Image preprocessing
In a face recognition system, it is extremely important to apply a variety of pre-processing techniques to standardize the images to be recognized. After the system reads the data of each frame of the camera through OpenCv, it first needs to resize the image size and convert the color space (from the BGR used by OpenCv to the RGB used by face_recognition).

KNN Classifier
Face_recognition uses a classifier based on the KNN algorithm. The KNN rule classifies each unlabeled sample according to the majority label in the K nearest neighbors in the training set [5] . The idea is that if most of the k most similar (i.e., the closest proximity) samples in the feature space belong to a certain category, then the sample also belongs to that category, where K is usually an integer no greater than 20. In the KNN algorithm, the selected neighbors are objects that have been correctly classified. In the classification decision, this method only determines the category to be subsampled according to the category of one or several samples nearest. After testing, the more pictures of the same person, the higher the accuracy of recognition.

Face detection and recognition
The identity recognition system in this paper uses the Face_Recognition face recognition library. The framework uses the deep learning model in the C++ open source library dlib, tested with the Labeled Faces in the Wild face dataset, and has an accuracy rate of up to 99.38% [6] .
Through the simple command-line tool provided by face recognition, the system is able to encode a given picture of a face (only one per person) and build a list of these different face codes. Coding is actually mapping a face picture into a 128-dimensional feature vector. By calculating the similarity between image vectors, it is determined whether it is the same person according to the threshold or fault tolerance, and the recognition result label is output.

Image registration fusion
Binocular cameras tend to have significant scale, rotation, and translational transformations for two images taken on the same target. An image can be depicted using a two-dimensional matrix of numbers, and each value in this matrix represents the grayscale value on the corresponding coordinate point on the image. Image registration is for two or more images and one statement, assuming that a point on the reference chart is represented by , the registration relationship between the two can be described as [7] ))) , represents a two-dimensional transformation based on coordinates x and y, and the g function represents grayscale processing of the datum image. Spatially match the images by looking for geometric transformation relationships between the two pictures. In practical applications, the affine transformation model is one of the spatial transformation models we most commonly use, and the images and original images that have been affine transformed can still have a large degree of similarity. The model of the affine transformation can be expressed as equation (3) [8] : For the same target, the edge outline obtained by different cameras is often more stable. Therefore, in the registration of infrared and visible light maps, we often use a registration method based on edge features. Image edge detection methods usually include Canny operator, LOG operator, Sobel operator and Laplace operator, etc. Canny is widely used because of its fast algorithm speed, high precision and the quality of image results can be adjusted by adjusting the threshold [9] . In the case of assuming that the visible and infrared images meet the spatial model of the affine transformation, the preprocessed images are extracted using the Canny algorithm to extract the edges of infrared and visible light, and the ORB features are extracted on the edge graph and roughly matched. Finally, the roughly matched pairing results are RANSAC purified to obtain an accurate irred visible image transformation relationship, that is, four spatial parameters.

Temperature information collection
The controller reads the correction parameters for each pixel via the I2C bus protocol and converts the parameter values into actual temperature values based on the register data in °C.
The actual temperature calculation is shown in Equation (4) [10] . (4) In equation (4), X CT is the temperature range of the recovery corner, which can be roughly divided into four temperature ranges according to the formula, is the temperature of the measured object, rangeX corr ALpha is the sensitivity correction coefficient for each range, TOX Ks is the sensitivity slope of each range, and γ α-T is the influence parameter of the reflected infrared signal of the measured target.

Face recognition test
In order to test the accuracy and speed of the face recognition module, the experiment tested a specific group of people multiple times, the video frame rate was 60 fps, and the image size of each frame was 640×480, and table 1 shows the influence on the recognition distance, the maximum number of people to be recognized, the recognition time, and the accuracy rate when only the frame rate of the captured video is changed. In Table 1, f is the frequency of capturing video frames during face recognition. From Table 1, we can see that reducing the frame rate of the captured video can effectively improve the time required for face recognition, but the recognition distance and the number of people to be recognized are reduced to varying degrees. Excessive recognition time often affects the recognition efficiency of face recognition in high-density situations, resulting in the problem of poor flow of people. At the same time, if the recognition time is too short, the recognition distance will be too short, and face recognition cannot be performed at a certain distance. Without affecting the accuracy, in order to balance the influence of various parameters, we choose a capture frame rate of 15fps. The picture shows the recognition effect of face recognition.  Figure 2: Face recognition

Temperature accuracy experiments
After completing the experimental test of face recognition, the experiment selected two people to record the temperature data of the two people at different positions from left to right at a distance of 0.5m from the camera, as shown in Table 2. Through multiple sets of experiments, we can see that the standard deviation of the average body temperature of A and B is 36.3 °C, and the temperature measurement error is 0.2 °C, indicating that the temperature measurement system can fully meet the temperature measurement needs of high-density people and achieve the purpose of body temperature screening. At the same time, the infrared thermometer can only measure the body surface temperature of the human body, so the measured temperature data is different from the actual temperature of the human body. Later, a black body can be added for temperature measurement correction and temperature compensation.

Conclusion
This paper designs a non-contact body temperature detection and identification system based on image registration, which realizes the temperature extraction of the area of interest and the multi-person face detection and face recognition through debugging, and finally realizes the mapping of infrared images to visible images on the basis of affine transformation, which effectively solves the problems of low detection efficiency and limited detection range of traditional temperature measurement systems, and has strong engineering significance and application prospects.