Design and Experimental Analysis of Touchless Interactive Mirror using Raspberry Pi

A prototype of a smart gesture-controlled mirror with enhanced interactivity is proposed and designed in this paper. With the help of hand gestures, the mirror provides some basic amenities like time, news, weather etc. The designed system uses Pi cam for image acquisition to perform the functions like gesture recognition and an ultrasonic sensor for presence detection. This paper also discusses the experimental analysis of human gesture interaction using parameters like the angle which ranges its horizon from 0 to 37 degree when tilting the forearm up and down and 0 to 15 degrees when the forearm is twisted right to left and otherwise based on yellow, pink and white background colours. Additionally, the range of detection using an ultrasonic sensor is restricted to the active region of 69.6 to 112.5 degrees. Moreover, time delay which takes half a second for a time as retrieve with the system and take 6 to 10 seconds for fetching headlines and weather information from the internet. These analyses are taken into account to subsequently improve the design algorithm of the gesture-controlled smart mirror. The framework developed comprises of three different gesture defects under which mirror will display the mentioned information on its screen. Keywords—Smart Mirror; Raspberry Pi; Pi-camera; Application Programing Interface; Hue Saturation Value; Region of Interest


I. INTRODUCTION
Human beings have always been striving to create new technology to make their life easy, swift and comfortable. Smart devices [1][2][3][4][5] including mobile phones, TVs, refrigerators, etc. are part of that chain. In today's fast-paced life, one is strained to do multitasking. This research involves making the mirror interactive so that a user can not only beautify him or her but can also perform regular chores like checking the weather, accessing inbox or look the to-do list.
Keeping in view the limitations of the voice-controlled devices the interaction is based on gesture-controlled making the proposed design also useful for speech impaired. The framework proposed utilizes finger count gestures to fetch and display the time, weather and news from the specified internet location. The efficiency of the interactive mirror is analyzed by observing the effect of different gestures from different angles using different backgrounds and their timely response to display intended information.
Moreover, relative to other touch or voice control smart mirrors this device is also useful for deaf and dumb. With that, it didn't restrict the user to be in the close vicinity like in conventional touch-based smart mirrors. The framework comprises finger count gestures to fetch and display the time, weather and news from the specified internet location. The paper is organized as follows: The work related to the smart mirrors and gestured controlled hardware and software is provided in Section 2 whereas Section 3 illustrates the design steps and development of the prototype. Section 4 illustrates the software algorithm used in the system. Section 5 describes the analysis of the developed system based on and its interpretation of obtaining different results. The paper is concluded in Section 6.
II. LITERATURE REVIEW Many researchers proposed various methods and interaction techniques for smart mirrors. The intervention of gestures to interact with devices gave a new direction to smart homes and smart devices. The author in [1] proposed Smart Reflect-a software platform for developing smart mirror applications. The authors in [2][3] uses external computers, additional controllers, sensors and Application Program Interface (API) integration to operate and control the smart mirrors. With the use of a spy mirror foil, [4] uses the Wii Balance Board and Kinect to reflect the user's position and their gestures. The author in [5] shows a survey of smart notice board mirror. Most of the smart mirrors developed so far are thoroughly based on displaying the information with less emphasis on the quick and easy way of doing it. Despite using fewer components additional sensors, external computers, controllers and software platforms are used to get it done. The author in [6] uses face recognition authentication to provide access to data feeds on the smart mirror. The devices in [7,8] take the voice commands to control the mirror. By the time, different interaction mechanisms like touch and voice are introduced to provide a better experience.
People do prefer few efforts to interact with the devices. A survey in [9] illustrates the convenient ways of gesture interaction over touch and voice with different algorithms. To formulate the best technique for mid-air interaction, several methods were considered as [10] uses the dollar method with the best trajectory like multi-finger for processing of short command gestures. The author in [11] proposed finger transformation algorithm for controlling the mobile. Moreover, to select the commands on multi-touch display a finger count gesture technique and analysis is introduced in [12]. The main limitation of these methods is related to the fact that the simple point-to-point trajectory comparison works well with short gestures and few features, but would not probably scale well to long single or multiple trajectories, as required by different application domains. Besides that, the external environment has a vital role in mid-air interaction between human and machine. An algorithm in [13] is proposed to overcome the effect of lighting condition on gesture interface using unit-gradient vector (UGV), background subtraction methods and Hue saturation value (HSV) thresholding. To this end, the gestures are also performed using different objects around users. The author in [14] uses experimental results to formulate a method that helps users to interact and tailored gesture profiles for objects existing in the omnipresent environment. However, the omission of environmental interference in interaction is still a challenge. The authors in [15,16] used a tracking device and reveals temporal division and spatial division gesture techniques to interact with the large public display. To formulate the best technique for hand gesture [17] used the object contour method for fast and accurate hand detection and tracking algorithm. The author in [18] improve gesture recognition by focusing spatial channels on hands. The author in [19] uses Raspberry Pi with the external camera to capture finger gesture using colour markers. Likewise, [20] illustrates a remote free approach to control a led using hand gesture. Besides that, [21,22] proposed Patch-Levy-based Bees Algorithm (PLBA) and Median-Average Otsu's thresholding method to overcome the limitation of traditional Otsu's thresholding method. In contrast to these complex algorithms, we have used the traditional Otsu's method and derived better results.
In this paper, we have critically analyzed the responses of gesture on finger count mechanism using techniques like background or foreground segmentation, and colour information of the hand to subtract hand images. Although several robust techniques and algorithm are proposed to optimally execute these techniques we critically use contour convex hull and convexity defects and traditional techniques to design robust algorithms to provide a better interactive experience.

III. IMPLEMENTATION OF THE PROPOSED SYSTEM
This section illustrates the hardware components used to design the interactive mirror. The designed interactive mirror is composed of a Raspberry Pi controller, a display module, a pi-camera and an ultrasonic sensor. The mirror displays the information on its display surface when connected to the internet via WIFI. The system conceptual diagram is shown in Fig. 1(a). The proposed mirror support comfort and additional flexibility by its gesture-controlled mechanism. The detail description of hardware and software is presented as follows.

A. Hardware
The mirror is composed of a LED display module of Samsung upon which a 1mm acrylic sheet is pasted such that it reflects the person when there is no light passing through it and displays information when light passes through it. With such a small thickness of the acrylic sheet as shown in Fig. 1(b), it offers high-quality visualization of the information displayed on its screen as shown in Fig. 2. Furthermore, the Pi camera module v2 is used in the system to capture hand gestures which by computer vision techniques analyze a different set of gestures performed by human fingers and interpret them to display useful information. The system also has the capability of detecting the person with an ultrasonic sensor with a separate processing control based on Arduino microcontroller. The power of the display monitor is controlled by the a passive infrared sensor placed right at the bottom of the device. It takes input from an ultrasonic sensor based on the distance measurement of the person from a mirror, it triggers an LED light transmitter to transmit the ON/OFF code to the built-in receiver of the monitor for making the monitor on/off as shown in Fig. 2. The system with all its components is controlled by a Raspberry Pi microcontroller. Interpretation of Acrylic Two-Way Sheet. www.ijacsa.thesai.org

B. Software
The section describes the software strategy used to operate the system. For this, Raspberry Pi has all the necessary packages and library such as OpenCV, Numpy, and Matplotlib. Besides that, Python interpreter is installed on it. Therefore, we can run the designed code through Python Idle without using a terminal window. The algorithm is implemented using python 3.0 and OpenCV inside Raspbian desktop OS.
 Gesture Algorithm: A basic contour detection method in the Region of Interest (ROI) is implemented for gesture recognition. The program algorithm is depicted in Fig. 3, which at first import necessary packages along with Date &Time, Weather and Newsfeed files. Next to the video frames are captured from which for the Hand Region, the image is segmented by cropping captured frame. This cropped image is our Region of Interest. This ROI is further processed to improve quality by converting ROI in Grayscale which subsequently converts an image into binary i.e. high-intensity pixels are treated as one and low-intensity pixels as zero. Based on binary values it decides whether the pixel is of interest or not. After that, Gaussian Blur is applied to reduce noise to acquire the shape of the tracked objects. Besides, the Otsu's Binarization Thresholding Method using OpenCV is used to highlight the particular colour range and automatically approximate the threshold value of bimodal image from image histogram.
To this end, from the processed image in the ROI, a maximum contour is found in the region and in that contour, convex hull and convexity defects are identified. Convex hull or points are general tips of the fingers and other point and subsequently found the convexity defects, which are the deepest points of deviation on the contour. Later on, cosine rule is applied for finding the angles of all defects (the number of fingers extended). These angles must be greater than 90 degrees as it can't interpret the angles less than 90. Moreover, it examines the maximum contour area in a range between 2000 to 10000 pixels and decides whether the hand is within the specified range. When the hand is with the area of detection it gives the indication and acknowledges the user to make the gesture. Additionally, the system will then count the number of defects and according to the number of defects in Fig. 4, it will fetch different information as summarized in Table I.   Finally, for showing the output window (e.g. Weather Display) in full screen we have used the Tkinter module.

 Presence Detection Algorithm
The presence detection algorithm depicted in Fig. 5 works when a person appears within 18 to 36 inches range of distance in front of the mirror. The custom-designed transmitter transmits the signal code to the receiver of the monitor to turn it on or off. When a person is detected by the ultrasonic sensor the ON or OFF code for Samsung, using the National Electrical Code (NEC) protocol is sent using a builtin IR remote library of Arduino. A check is maintained which is used to resend the code as a result when the object goes away; it automatically turns off the interactive mirror and switches to an ordinary mirror. The presence detection algorithm has separate processing controller which does overlap with the main Raspberry Pi processor. The algorithm works on simple decision-making structures that are based on the distance calculation value from the ultrasonic sensor, with controlling variable declared within the program in C++ that does not let the program enter the same structure repeatedly.

IV. EXPERIMENTAL SETUP FOR ANALYSIS
To analyze the smart mirror functionality with the gesture interaction the mirror is placed on the desk under 500 lux light intensity with sheets of different colours pasted in front of the mirror to examine the gesture interpretations and their efficiency concerning change in background colours as shown in Fig. 6(a) & (b). An Android Smartphone Samsung Galaxy S7 Edge is tied on the forearm with a wrist push band as shown in Fig. 7 having clinometer with a bubble's [22] application installed in it to scrutinize the gesture interaction from different angles. The experiments are conducted keeping the hand at approximately 90 degrees and 60 inches away from the pi camera. 18 trials were conducted with different background colour sheets and for each colour; the light intensity is varied at three different levels. A built-in Ambient light sensor AMIS-74980x in Samsung Galaxy S7 Edge smartphone with the resolution of 0.0152 lux/count is used in experiments for measuring light intensity as perceived by the human eye. Now based on the position of the hand an LED is connected to GPIO pin of the Raspberry Pi is made to blink so that the user is notified that a gesture has been detected. For distance range, calculation HC-SR04 ultrasonic sensor is mounted at the bottom center of the smart mirror to incorporate presence detection. (a)

V. RESULTS AND DISCUSSION
This section discusses the results obtained for the time taken to display information, the effect of finger count gestures on hand recognition accuracy, the effect of deviation of a user from Line of Sight facing the mirror, variation in distance range, variation in ambient light and effects of changing background colours on hand detection accuracy.
From Fig. 8, one can observe the time delay for different information displayed on the surface of the mirror calculated using Time Module in Python. Fig. 8 proposes that the interactive mirror on an average took 0.5 seconds to display date and time to the specified location on the mirror screen, which is the last time as it was taken from the operating date and time. Moreover, it can also be observed that it shows uniformity in different conducted trails. The time is taken to display the headline news from the internet which illustrates that interactive mirror can take around 8-10 seconds to fetch the news feeds from an internet source and display it to the mirror surface, the readings for time consumption in-display depend upon the number of factors viz-à-viz internet speed, network traffic and server activeness. The readings are taken at an internet speed of 250-280 kbps. Fig. 8 suggests that it normally takes 8-10 second to fetch the information and eventually display it to the surface of the mirror.  In order to analyze the gesture interactivity by contour, convex hull and convexity defect a total of 18 readings were taken for each gesture to examine its accuracy. In Fig. 9, 18 readings are taken on six different colour backgrounds (Dark green, Skin colour, White, Pink, Yellow, Light green) with varying light intensity as mentioned in the experimental setup. The accuracy is calculated and plotted against gesture type using equation (1): Accuracy = Number of times gesture recognized easily X 100 / total trials (1) The term easily refers to the best possible defect identification with almost less than 1 second time delay. From Fig. 9, it is deduced that accuracy decreases from 94% to 55% with the requirement of recognizing more fingers or defects. The background colour and light intensity are interlinked with each other as all the backgrounds are vulnerable for some gesture at some value of light intensity especially when the light intensity is greater than 100 lux. The yellow colour background (Fixed for this setup in Fig. 9) compared to other colours yielded better results.  Fig. 10 narrates the minimum distance between two fingers for 2, 3 and 4 finger count gestures detection. Such that, for 2 fingers, which is index and middle the minimum distance should be 25 millimetres (mm) or greater, as per the algorithm the two fingers didn't detect the gesture up to the distance of 21 mm. However, it gives an abrupt reading from 21 mm to 24 mm, which means within this distance it sometimes detects fingers count gesture. Moreover, for the fingers gesture 3 it didn't accept the gesture defect up to 15 mm. Subsequently, it relics abrupt between 16 mm to 18mm and detect the gesture count 3 for 18 mm or higher. Additionally, for the 4-fingers count gesture, the escape of no detection is from 0 to 18 mm and abrupt is from 19 to 21 mm and the detection zone is 21 or higher. The prime reason of difference of distance between each of the finger count gestures is the angle at which each finger is extended; for a normal human being the index and middle fingers are extended at 90 degrees. In contrast, the ring finger is extended at 70 to 80 degrees when the rest of the finger(s) is held by the thumb. In addition, when four fingers are extended the degree of extension of index and middle is 90 degrees and the angle of extension of ring finger ranges 87 to 90 degrees which differ from person to person. Consequently, the angle at which little finger is extended is 88 to 90 degrees. Additionally, one of the concerns for the limitation is that in this paper we critically analyze the basic contour detection algorithm without subtracting the background so it helps the developers to know the findings of the background interference and design robust contour detection algorithm for the gesture defects.
The finger count gesture is also prone to an inclination of the forearm at yellow, white and pink backgrounds. To take it in consideration, we attached the Samsung S7 edge phone at the forearm and took the readings, Fig. 11 gives the forward and backward angles of the forearm lifted at 3.5 feet (usual placing of a mirror) with the light intensity of 100 lux considered as a normal room light. For the yellow background, the range of detection ranges 0-19 degrees backward, as after the backward angle of inclination increases to 19 it didn't detect the gesture defect. Consequently, for the same background, the forward angle ranges 0-37 degrees as after 37 degrees the system doesn't detect the gesture. Moreover, for the pink background, the backward angle of inclination is 0 to 9 degree and the forward angle is 0 to 20 degrees for the gesture to be detected. However, for the white background, the angle of the forearm for gesture detection ranges 0 to 28 degrees backward and 0 to 36 degrees forward.
It is kept in regard from Fig. 12 that the device functionality is also susceptible to the twist of the wrist as the wrist is curled from its actual position the gesture detection possesses the susceptibility and it also differs with backgrounds. To check this, we took 100 trails, for yellow background, the angle of detection ranges 0 to 15 degrees right as after the right twist increases the 15 degrees the camera didn't detect any gesture detection. Similarly, as the wrist twist at the left side, the detection ranges 0 to 10 degree and offers no detection afterwards. Further, for the pink background, the range of twist angle is 0 to 13 degrees and no detection after 13 degrees at the left curl. Furthermore, for the www.ijacsa.thesai.org right curl the range limit to 0 to 6 degrees. Additionally, for the white background, the left twist angle is restricted to 0 to 23 degree and the right twist angle ranges 0 to 15 degrees.
We took only these three backgrounds in consideration as on the sharp red or the combination of Red-Blue-Green (RGB) if red increases the mark of 190 with the hue and saturation increases the point of 220 it exhibits abrupt or no gesture detection. The similar sort of functionality is observed when the light intensity increases the mark of 120 lux as it's a common consideration the sharp light imposes a great impact on the camera's shutter owing to the fact the existing algorithm is prone to light intensity. Similarly, the width of fingers for swift gesture count detection should be at least 1.8 cm to get the gesture detection.   VI. CONCLUSION A touch-free reflective interface is designed in this paper that displays informational data. The designed Interactive Mirror acts as a traditional mirror as well as it provides instant access to information on the mirror surface efficiently and effectively to provide time optimization for the user. With that, we also have carried out an analysis to improve interaction mechanism. In addition, we have used a simple and cost-effective method of interaction. The results show that the mirror performs better with light colour backgrounds and the result go worse as the background colour goes sharp and can further be improved for sharp backgrounds by implementing background refinement algorithms to make it robust. This mechanism accurately works if a user appears at 56.6° (degrees) to 69.5° and 69.6° to 112.5° cone of the ultrasonic sensor. But, when a user turns at 112.6° to 123.75° it can produce false detection. This problem can be overcome by using tunnel propagation sensor or using multiple ultrasonic sensors to cater side poses as well. It is recommended to carry out more study on improving gesture recognition algorithm for continuous inputs from the user with that Artificial intelligence can also be added in this interactive mirror. Moreover, the background subtraction method can be used to overcome the gesture predisposition. Besides, with the help of analysis new techniques can be used to overcome gesture vulnerability. Additionally, swipe gestures and 3D Dressing amenities can be designed in the future device.