IMPLEMENTATION OF TEMPLATE MATCHING METHOD FOR DOOR LOCK SECURITY SYSTEM USING RASPBERRY PI

In several location, security system is becoming priority. One of the location is laboratory. There are many valuable research tools and equipment in the laboratory, so to improve the security system. Generally, the access to entry the laboratory is equipped with digital safety system. Computer Control System Laboratory at Information Technology Department of Jember State Polytechnic uses RFID-Card as access right for entrance to the laboratory. RFID-Card also function as ID-Card (printed with photo and biodata), and packaged to fit in user clothes pocket. However, using RFID gives less of flexibility. The user must remove the ID-Card and attach the card in the RFID reader box. Therefore, in this study will designed a door lock security system based on the image processing to replace the use of RFID. Later, user simply position themselves in the Pi Camera work area. Processed data from camera, the matched with image data which stored in the database. The database contains photo of laboratory members which listed on the employee IDCard. Template matching method is used as image matching method which stored in Raspberry Pi database. If the image which captured by camera is matched with the image data in the database, the controller will give entry access to the user. Based on the experimental results, template matching method has a success rate of 96%.


INTRODUCTION
Image matching is one of the most developed research topics.Some research topics about digital image processing are face recogni-tion (Huang, Gao, Qian, Yang, & Yang, 2017) stereo vision (Ttofis, Christor, 2015), and object tracking (Curetti, Maria, 2013).Face recognition is a face recognition method which mostly included in smartphone application.Several digital image processing algorithm require high computing systems.However, this is not a problem because many compact computer devices with high-capacity processor with small size are created.One of them is Raspberry Pi.
Raspberry Pi is a mini-PC with ARM processor which sold in low-cost price categories.Raspberry Pi supports the Python programming language.The variety of 2D image processing operations can performed using various features which available in the OpenCV-Python Library.With 1.2 GHz and 1GB RAM capacity, image processing can processed quickly.
In this study, develop a entrance door access system based on image processing.Previously, the entrance access laboratory of Computer Control System (SKK laboratory) -Information Technology Department of Jember State Polytechnic using RFID technology.To access the entrance door, user must attach the card in the RFID reader box.This becomes less efficient because the user has to remove the ID-Card first.Therefore, in this study will designed a door lock security system based on the image processing to replace the door lock system which using RFID.
Template matching is a technique in digital image processing to find the small parts from the image that match with template image (Brunelli, 2009, Hidayatno, 2006).This method can be used in manufacturing as part of the quality control (Aksoy, Torkul, & Cedimoglu, 2004), navigating the mobile robot (Kyriacou, Bugmann, & Lauria, 2005), or as detecting the vehicle types in main road (Thiang, 2001).Used 4 template matching techniques, namely:

METHOD
Implementation of template matching method divided into some stage.First stage is design of hardware.Image processing is fully processed on Raspberry Pi using Pi Camera.When, detected image data is matched with database, the raspberry will send serial data to slave-controller.Slave controller using AT-Mega32u4 microcontroller.Figure 1 is a block diagram system on door lock security device.The next process, taken image data to be stored in database.In this study, using 5 sample ID-Card from employee at Information Technology Department of Jember State Polytechnic as the user data to door lock access.In order to the system can work robustly, taken 10 image data for each ID with various position.Each image sample is cutting into 2 parts.In the data matching process, if 2 detected image sample are not close each other, then the controller will reject the template-matching processing result.This is to minimize the detection image error from user ID-Card. Figure 2 is an example of image processing sample which stored in a database.

RASPBERRY
The last stage is creating the software on Raspberry devices.Raspy will scan every 100 milliseconds.The workflow on Raspberry devices is described in Figure 3.

Send data to slave controller
Correct ID?If there are successful image data matched with database, then Raspberry Pi will send serial data to the ATMega32u4 microcontroller.The serial data is 10 value which match to RFID-Card value read by the RFID reader.Figure 4 is a data format that is transmitted to the slave-controller.

RESULT AND DISCUSSION
Testing done for 10 times on each ID which stored in the database for each matching technique in template matching method.User just stand in front of Pi Camera work area to access the room door.Figure 5 is a display condition of using cross correlation matching technique.Raspberry detected a template which close each other.However, because the template location is not in the detection area, then the controller will consider it as an error, so the access of the door is denied.

Figure 5. Implementation cross correlation technique result
Figure 6 is a display condition for the normalized cross correlation matching technique.Raspberry detected a template which close each other and it is in the detection area so door access is accepted.ID number which detected is ID 1 according to the stored data in database.

Figure 6. Implementation normalized cross correlation technique result
Figure 7 is a display condition of using coefficient correlation matching technique.Raspberry detected a template which close each other but it is not in the detection area so door access is denied.In addition testing with ID-Card which used as user access, also done testing with ID-Card in outside of database.Figure 10 is a display condition when testing using an ID-Card other than user ID-Card.From 3 ID-Card which used for testing, controller does not give permissions (access denied) with a 100% success rate.

CONCLUSION
Based on the experiment result, template matching method can implemented in door lock security system.Normalized Cross Correlation matching technique give the highest detection accuracy rate of 96%.However, template matching method has deficiency for matching image with rotational and translational changes.For further research, we will experiment by using feature matching method for improve the accuracy.

Figure 1 .
Figure 1.Block Diagram System of Door lock security Device Figure 3. Programming Flowchart

Figure 4 .
Figure 4. Serial data format transmitted to the slave-controller

Figure 7 .
Figure 7. Implementation coefficient correlation technique result

Figure 10 .
Figure 10.Testing result with ID-Card non-user

Table 1
is success data rate of each matching technique based on image data in database.Normalized Cross Correlation method has the highest success rate of 96%, then normalized correlation coefficient method has success rate of 92%.According to Figure9, cross correlation method and coefficient correlation method have low success rate of 20% and 16% respectively.

Table 1 .
Testing result of template matching