ITSI Transactions on Electrical and Electronics Engineering (ITSI-TEEE) ______

Closed Circuit Television in Raspberry PI Using Open CV & Python

1Rajatha B, 2L Swarna Jyothi, 3UmaShankar Shetty C 1,2Dept of ECE, RRCE Bengaluru-74, India 3Manager-Services, Tenet Technetronics, Bengaluru, India

Abstract- Designing an efficient and foolproof surveillance the type of background subtraction that will be used in system is a challenging task. The cost of sophisticated the system, the researchers considered the place where surveillance systems is very high. These factors made the system will be placed and also the processing speed researchers to think alternative for the existing system. of the RPI. According to one comparative study, the Raspberry Pi, a low cost, single board credit card sized basic background subtraction has the lowest processing computer is the heart of this work. The system is built on Open CV and the coding language used is Python. The speed requirement but it can't be implemented in a Open CV is released under BSD license. The BSD license complex background environment [3]. The researchers makes the Open CV software free for both academic and finally choose the basic background subtraction for commercial purpose. The Python is a script language. Face motion detection due to its low computational detection algorithm is used to precisely identify the human requirement. beings. The proposed surveillance system can be used in public places like Hotels, Coffee Shops, Malls, Offices etc. Moreover, in recent years, Motion Detection has attracted a great interest from computer vision Keywords- Raspberry Pi, Open CV, Python, Surveillance, researchers due to its promising applications in many BSD license areas, such as video surveillance, traffic monitoring or I. INTRODUCTION sign language recognition. To overcome storage spaces issue, we apply the Motion Detection algorithm for live Closed-circuit television [1] monitoring system has now camera streaming, this allows the system to analyze become indispensable in day to day life of human incoming images from cameras, and recognize when society. Supermarkets, factories, hospitals, hotels, movement occurs. The video system can collect and schools, and companies are having their own CCTV store images for the administrators review. Effective use system for 24/7 monitoring. Instead of using the of Motion Detection promotes an automated approach to traditional wireless CCTV surveillance cameras, video system reaction, and does not require an customers can now own their inexpensive security individual to start and stop recording sessions. So we systems with the tiny super computer called Raspberry can significantly decrease storage usage and save Pi. IP cameras can serve better as they can send and investment costs. receive data via computer network and internet based on internet protocol. Also resolution clarity of IP cameras is II. THEORETICAL FRAMEWORK far better than CCTV cameras. A camera module Figure 1 shows the block diagram of the whole system. connected to the Raspberry Pi will records all the The heart of the system is a single board credit card size happenings in the monitored area and live streaming can computer known as RPI (Raspberry Pi) . It is the central be viewed from any web browser, even from mobile in platform for image processing and signal alerting. An real-time. There are many problems in the video ordinary webcam captures the scene to be processed by surveillance system, such as: picture is indistinct, the RPI. The system has the capability of detecting anomalies cannot be identified automatically and a lot of motion of an object. When the moving object is storage spaces are needed to save the surveillance detected, the system can classify it as human. If there is information. detection, the system sends out alerting signal in the A. Background Subtraction form of sound and email to indicate fire or unauthorized invasion. Since the camera used is monitoring at a fixed location, background subtraction [3] algorithm can be used in In the block diagram there are components like detecting motion by the concept of frame differencing. Raspberry pi, Keyboard, Mouse, Webcam and monitor. Moving objects within a given background can be The peripherals connected to the Raspberry Pi will deduced from the difference of the current frame and a detect the motion using webcam and thus acts as a reference frame, often called the “background image”. surveillance system. There are several algorithms that can be used for motion detection like optical flow and edge analysis. One of the simplest forms of motion detection is using background subtraction. There are different types of background subtraction based from the different journals. The challenges in most of these algorithms are the illumination changes and processing speed. In choosing ______ISSN (PRINT) : 2320 – 8945, Volume -4, Issue -3, 2016 19 ITSI Transactions on Electrical and Electronics Engineering (ITSI-TEEE) ______

Keyboard Webcam IV.OPEN CV The Open CV [2] (Open Source Computer Vision Library) is a Computer Vision library written in C and Monitor R Pi Mouse C++ compatible with Linux. The purpose of this library is that it provides a simple computer vision Fig.1. Block Diagram infrastructure to prototype quickly for sophisticated applications. It has over 2500 optimized algorithms, III. RASPBERRY PI includes both a set of classical algorithms and the state of the art algorithms in Computer Vision, which is used RPI [5] Model B was utilized in the researcher's project for image processing. The library is used extensively by and it has 512MHz SDRAM, and 700MHz CPU which companies like Google, Yahoo, Microsoft, Intel, IBM, allows a typical computing environment. The external Sony, Honda, Toyota, and startups area as Applied ports of RPI being used in this research are the GPIO Minds, Video Surf and Zeitera, and research groups and port, audio port and Ethernet port. GPIO and audio ports government. It provides better portability. Open Source are used for alarming system and Ethernet port was used Computer Vision Library, Open CV for short, is a cross- to connect RPI to the monitoring device or to the platform library computer vision based on open source networking device. Shown in Figure 2 is the picture of distribution. It can run on Linux, Windows and Mac OS RPI. operating system. It's lightweight and efficient-makes up of a series of C function and a small amount of C + + class, at the same time provides the Python, Ruby, MATLAB language interface. V. PYTHON Python is a high-level, interpreted, interactive and object-oriented scripting language. Python is designed to be highly readable. It uses English keywords frequently where as other languages use punctuation, and it has fewer syntactical constructions than other languages.

 Python is interpreted: Python is processed at Fig. 2. Raspberry Pi runtime by the interpreter. You do not need to The proposed system uses Raspberry Pi Model B+ compile your program before executing it. This is single board computer and offers these key features: similar to PERL and PHP. • Broadcom BCM2835 SoC processor with 700  Python is Interactive: You can actually sit at a MHz ARM1176JZF-S cores Python prompt and interact with the interpreter directly to write your programs. • 512MB RAM  Python is Object-Oriented: Python supports • Video core 4 GPU supports up to 1920 x1200 Object-Oriented style or technique of programming resolution that encapsulates code within objects. • 5Mpix Camera module capable of full HD video @  Python is a Beginner's Language: Python is a great 30fps language for the beginner-level programmers and • Micro SD card slot, 10/100Mbps Ethernet port, 4 x supports the development of a wide range of USB applications from simple text processing to WWW browsers to games. • 2.0 ports, HDMI, audio/video jack, GPIO header, micro USB power port, DSI and CSI ports VI. FACE DETECTION • Dual step-down (buck) power supply for 3.3V and Face detection [4] is a computer technology being used 1.8V in a variety of applications that identifies human faces in During initial setup Raspberry Pi was configured as a digital images. Face detection also refers to the miniature desktop with USB configured camera module psychological process by which humans locate and and an external monitor or mobile for viewing the attend to faces in a visual scene. captured video. The Raspberry Pi runs Raspbian OS and Face detection can be regarded as a specific case of is programmed using GNU Octave and Python, which is object class detection. In object-class detection, the task an open source. The Dynamic host Protocol is obtained is to find the locations and sizes of all objects in an for Raspberry Pi, addressed IP is fetched. After image that belong to a given class. Examples include obtaining this the system can be configured and upper torsos, pedestrians, and cars. Face-detection controlled remotely. algorithms focus on the detection of frontal human ______ISSN (PRINT) : 2320 – 8945, Volume -4, Issue -3, 2016 20 ITSI Transactions on Electrical and Electronics Engineering (ITSI-TEEE) ______faces. It is analogous to image detection in which the  Sound (microphones and acoustic sensors) image of a person is matched bit by bit. Image matches with the image stores in database. Any facial feature  Vibration (tribo electric, seismic, and inertia-switch changes in the database will invalidate the matching sensors) process. A reliable face-detection approach based on the  Magnetism (magnetic sensors and magnetometers) genetic algorithm and the eigen-face technique: Firstly, the possible human eye regions are detected by testing IX. REMOTELY ACCESSING all the valley regions in the gray-level image. Then the RASPBERRY PI genetic algorithm is used to generate all the possible face regions which include the eyebrows, the iris, the There is a provision that Raspberry Pi can be accessed nostril and the mouth corners. Each possible face remotely. The peripherals cannot be connected to candidates is normalized to reduce lightning effect Raspberry Pi in all places. The accessing of Raspberry caused due to uneven illumination and the shirring effect Pi remotely can be done using VNC server and Putty. due to head movement. The fitness value of each 1. Tight VNC Viewer candidate is measured based on its projection on the eigen-faces. After a number of iterations, all the face  Tight VNC is a free remote control software candidates with a high fitness value are selected for package. further verification. At this stage, the face symmetry is  With Tight VNC, you can see the desktop of a measured and the existence of the different facial remote machine and control it with your local mouse features is verified for each face candidate. and keyboard, just like you would do it sitting in the VII. VIDEO FACE DETECTION front of that computer. Video content analysis [6] (also Video content analytics, Tight VNC is: VCA) is the capability of automatically analyzing video  Free for both personal and commercial usage, to detect and determine temporal and spatial events. This with full source code available. technical capability is used in a wide range of domains including entertainment, health-care, retail, automotive,  Useful in administration, tech support, transport, home automation safety and security. The education, and for many other purposes. algorithms can be implemented as software on general  Cross-platform, available for Windows and purpose machines, or as hardware in specialized video Unix, with Java client included, processing units. Much different functionality can be implemented in VCA. Video Motion Detection is one of  Compatible with standard VNC software, the simpler forms where motion is detected with regard conforming to RFB protocol specifications. to a fixed background scene. More advanced  Can cut expenses and save time on traveling, functionalities include video tracking and ego motion estimation. Based on the internal representation that  Helps friends and family to solve problems VCA generates in the machine, it is possible to build with computers placed remotely. other functionalities, such as identification, behavior analysis or other forms of situation awareness. VCA X. PUTTY relies on good input video, so it is often combined with Putty is a free and open-source , serial video enhancement technologies such as video de console and network file transfer application. It supports noising, image stabilization, un sharp masking and several network protocols, including SCP, SSH, Telnet, super-resolution. rlogin, and raw socket connection. It can also connect to VIII. MOTION DETECTION a serial port. The name has no definitive meaning. Putty was originally written for , but Motion detection is the process of detecting a change in it has been ported to various other operating systems. the position of an object relative to its surroundings or a Official ports are available for some Unix-like change in the surroundings relative to an object. Motion platforms, with work-in-progress ports to Classic Mac detection can be achieved by either mechanical or OS and Mac OS X, and unofficial ports have been electronic methods. When motion detection is contributed to platforms such as Windows accomplished by natural organisms, it is called motion Mobile and Windows Phone. Putty was written and is perception. maintained primarily by Simon Tatham and is currently Motion can be detected by: beta software.  Infrared (passive and active sensors) XI. TOOLS USED  Optics (video and camera systems) Hardware requirements:  Raspberry Pi  Radio Frequency Energy (radar, microwave and  Monitor tomo graphic motion detection)  Keyboard ______ISSN (PRINT) : 2320 – 8945, Volume -4, Issue -3, 2016 21 ITSI Transactions on Electrical and Electronics Engineering (ITSI-TEEE) ______

 Mouse XIV. CONCLUSION  Webcam The proposed surveillance system that is economical and  Ethernet cable portable. The performance is better than the existing Software requirements: systems. The motion detection done in this paper uses  Open CV the webcam connected to the Raspberry Pi which is  Motion Detection analogous to the closed circuit television. Face detection Coding Language Used: helps in precisely identifying the humans. The proposed  Python work has an added advantage of using open hardware XII. PROPOSED METHOD and software for the design of surveillance system. Raspberry Pi will process the real time images captured REFERENCES by webcam. The images are captured by webcam [1] Huu-Quoc Nguyen, Ton Thi Kim Loan, Bui Dinh connected to the Raspberry Pi. Thus the surveillance Mao and Eui-Nam Huh “Low Cost Real-Time system is built. For the images captured various System Monitoring Using Raspberry Pi” IEEE techniques like face detection and motion detection is ICUFN 2015 done. The Raspberry Pi is accessed remotely using VNC server and putty. Thus the Closed Circuit Television is [2] S.Sivaranjani, Dr. S.Sumathi. “Implementation of built using Raspberry Pi. Fingerprint and New born Footprint Feature Extraction on Raspberry Pi” IEEE Sponsored 2nd Algorithm International Conference on Innovations in Step 1: Initialize peripherals. Information Embedded and Communication Systems ICIIECS’15 Step 2: Install motion detection software. [3] Wilson Feipeng Abaya, Jimmy Basa, Michael Sy Step 3: Import packages necessary for video face Electronics and Communications Engineering detection and check whether open CV is present by Department Gokongwei College of Engineering importing open CV. De La Salle University, Alexander C. Abad and Step 4: Give cascade path in the program to detect the Elmer P. Dadios Electronics and face in the live video. Communications Engineering Department Gokongwei College of Engineering De La Salle Step 5: Initialize the camera. University “Low Cost Smart Security Camera Step 6: Capture the image frame by frame. with Night Vision Capability Using Raspberry Pi and Open CV” 7th IEEE International Step 7: Face detection procedure is done for the Conference Humanoid, Nanotechnology, captured image. Information Technology Communication and Step 8: The face detection is indicated by drawing the Control, Environment and Management rectangle around the face. (HNICEM) The Institute of Electrical and Electronics Engineers Inc. (IEEE) – Philippine Step 9: Finally the image is displayed. Section 12-16 November 2014 XIII. RESULTS [4] S.Sivaranjani M.E Embedded System Technologies Sri Sai Ram Engineering College The video is captured by the webcam connected to the Chennai, India. “A Review on Implementation of Raspberry Pi. The motion detection is also carried on. Bimodal Newborn Authentication using The motion detection is carried on by installing the Raspberry Pi” Global Conference on motion software in the Raspberry Pi. The following Communication Technologies(GCCT 2015) images show the face detection of images captured in video. The image obtained is of high clarity. [5] Ms. Sejal V. Gawande*, Dr. Prashant R. Deshmukh Student, Computer Science and Engineering, Sipna C.O.E.T.,“Raspberry Pi Technology” International Journal of Advanced Research in Computer Science and Software Engineering April 2015 [6] Sneha Singh, PradnyaAnap, YogeshBhaigade, Prof.J.P.Chavan B.E Dept., of Computer Engg., Sinhgad Institute of Technology, Lonavala, Pune university Assistant professor, Computer dept, Fig. 3 Face detection in Live Video Sinhgad Institute of Technology, Lonavala “IP Camera Video Surveillance using Raspberry Pi”

International Journal of Advanced Research in

______ISSN (PRINT) : 2320 – 8945, Volume -4, Issue -3, 2016 22 ITSI Transactions on Electrical and Electronics Engineering (ITSI-TEEE) ______

Computer and Communication Engineering, [8] Sanjana Prasad, P.Mahalakshmi, A.John Clement February 2015 Sunder, R.Swathi Final Year M.E Communication Systems , BIT “Smart [7] Kil-sung Park and Sun-Hyung Kim “ A Research Surveillance Monitoring System Using Using Private Cloud with IP Camera and Raspberry PI and PIR Sensor” International Smartphone Video Retrieval” International Journal of Computer Science and Information Journal of Smart Home, Vol.8, No.1 (2014), Technologies, 2014 pp.175-186.



______ISSN (PRINT) : 2320 – 8945, Volume -4, Issue -3, 2016 23