Process Description
Initial printing
Initially, we worked on getting the python script to actually be able to print to the thermal printer. Since printing to a thermal printer is not natively supported in python through raspberry pi, we had to use a library called escpos. This library allowed us to communicate directly with the thermal printer through python code, as well as allowing us to print images as well as text.
Detecting faces and printing images
Setup
The next step was to get our raspberry pi to be able to interact with the webcam that we were using to capture images. Since USB webcams are also not native to raspbian OS, we used a python library called fswebcam. This not only allowed us to capture images with the webcam but also alter the resolution so that they could print nicely on the thermal printer.
Image detection
To detect images we used the python library OpenCV. The python script was set up so that an image was constantly being taken, then the image is scanned with OpenCV to detect if a face is present in the image. The image was then printed from the thermal printer.
Data collection and analysis
Once we were able to successfully detect and print faces when detected we looked for ways to extract data from this image. A public API called Hydra AI was one of the more affordable options we found in our searches. This API allowed us to detect age, gender, mask presence, and emotions. After implementing this we ended up with the result shown above.
Creating a story
Our final revision of the printout included comments based on the person's emotions as well as a randomly chosen feedback sentence. If any of the person's emotions were above 20%, our printout would have a small comment below the portion of the receipt with said emotion. Also, we created 5 different possible responses which would be printed at the bottom of the receipt. This made the receipt feel more personal and more like the machine was talking to the person, rather than just giving them information.
Hiding the camera
The final step was to find a way to hide the camera so that the person looking into the mirror didn’t know they were being photographed. To do this we had a small border of black fabric that wrapped around the front of the mirror. We then cut a small hole in the middle top of the fabric, just enough so that the camera could see through. Since the camera had a black plastic front it blended in very well with the fabric and was almost completely hidden.
Final product
The magic mirror
Our final product included side lighting as well as a “sink” to make the environment seem more like a bathroom. We reduced the black fabric to only be on the top and bottom of the mirror to give space for the side lighting. We also changed the material to white foamcore to better match the environment as well as reflect light onto the person better. We chose to use small, bright lights for the side lighting to imitate a vanity mirror that people get dressed up or do makeup in front of. This encouraged the person to lean in and get closer to the mirror, allowing us to take a better image of them.
The magic printer
To better conceal the thermal printer we enclosed it within a small foamcore box that was on a table outside of the bathroom. This helped us hide the battery pack and well as all the wires connected to it, while also giving it a mysterious allure.
Content Rating
Is this a good/useful/informative piece of content to include in the project? Have your say!
You must login before you can post a comment. .