Facial Recognition on the Smart Mirror
One of the things I wanted to do was have the mirror's display change depending on who was looking at it. While both my wife and I want to see things like calendar events and the forecasted weather, her commute time doesn't concern me, nor does she care when my next streetcar is arriving at the end of our street.
Given that I don't want my mirror covered in fingerprints, touch control is not something I'm going to incorporate. In my research I came across a module for MagicMirror that incorporates facial recognition using a connected camera to switch between configured display profiles. So I thought I'd give it a shot.
But first, to figure out what camera to use... The obvious choice is to use the camera made for the Raspberry Pi. In fact the facial recognition is designed to work with the Pi camera. But it comes as a bare square circuit board, with few choices for an enclosure. The last thing I wanted was for my mirror to look like a high school electronics project. So I looked for other options...
At Best Buy, I found a USB webcam for about the same price as the Pi camera. While not the most attractive of designs, it looks markedly better than a bare circuit board. I thought I'd give it a shot.
The one I got was the Logitech C170. It was the least expensive camera Best Buy offered. Specs say it is capable of 720p video, so I thought that should have been more than capable of what I needed. Plus, given that is a webcam, it also has a microphone built-in. Doubly useful for adding voice control later!
Given that I don't want my mirror covered in fingerprints, touch control is not something I'm going to incorporate. In my research I came across a module for MagicMirror that incorporates facial recognition using a connected camera to switch between configured display profiles. So I thought I'd give it a shot.
But first, to figure out what camera to use... The obvious choice is to use the camera made for the Raspberry Pi. In fact the facial recognition is designed to work with the Pi camera. But it comes as a bare square circuit board, with few choices for an enclosure. The last thing I wanted was for my mirror to look like a high school electronics project. So I looked for other options...
At Best Buy, I found a USB webcam for about the same price as the Pi camera. While not the most attractive of designs, it looks markedly better than a bare circuit board. I thought I'd give it a shot.
The one I got was the Logitech C170. It was the least expensive camera Best Buy offered. Specs say it is capable of 720p video, so I thought that should have been more than capable of what I needed. Plus, given that is a webcam, it also has a microphone built-in. Doubly useful for adding voice control later!
The facial recognition module comes with a training tool that you use to take a bunch of pictures of a person that in turn teach the software to recognize a certain person. I set up the camera at generally the same position that it will eventually be when installed on the mirror -- same lightning conditions, same height and angle -- and proceeded to take a bunch of training pictures of both myself and my wife.
The good news is that after training software, facial recognition worked When I stood in front of the mirror, I'd see my profile, my wife would see hers, and when nobody was in front of the mirror, a generic profile was displayed. The bad news is that it was incredibly slow... it would take a good 30 seconds or so before the software would recognize the person standing in front of the mirror, and if it did, it was usually after several failed attempts at recognition. It turns out that the video quality of this camera is EXTREMELY poor. I would later discover that while Logitech claims the this camera can capture video at 720p, the picture is interpolated using the included software -- which of course does not run on a Raspberry Pi. Natively the camera only captures at 640x480 resolution and the resulting images are so low in contrast that there is generally very little detail for the facial recognition to work with. No surprise that performance was unacceptable.
I ended up returning the camera, and have since ordered a camera designed specifically for Raspberry Pi. We'll see if facial recognition works any better as a result. The plus side to this story is that I thought getting facial recognition to work at all was going to be time consuming and difficult. In reality I had it working in just a couple of hours. Leads me to believe that with a better camera I should be able to get this working well. Stay tuned!
Comments
Post a Comment