The inspiration for this was the #HackHarassment topic. Make a project that is built on your interaction with your computers and other internet users, and the emotions these interactions give you.

What it does

The project takes a picture with your webcam every ~3 seconds. The project then uses a REST API from Microsoft called Emotion API to analyze your facial expressions. This returns a list of the emotions shown by your facial expression, and how strong those emotions are.

This information is used to determine if you need a time out. If the emotions are above a determined trigger level, a cute/fun picture is pushed to the front of your computer screen, and you cannot tab away from it until you smile, and the software determines that you are happy. If you need it, a "Super Aggressive Anti-Trigger" mechanism has been built into the system, which simply turns of the computer if you get triggered. This functionality is opt-in.

Next to the software component of the project is a design aspect. This demonstrates a possible future for the software, which is a web based interface where you can set up different "anti-trigger" keywords(cats, puppies etc.). The software will then use these anti-triggers to find random related pictures online, and display these to you.

How I built it

The software was built using Visual Studio(sorry...) and the WPF framework. It started as a simple console test program that could read an image from disk, and print out the top 3 emotions shown in the image. This evolved into being able to take pictures with the webcam and do the same analysis. Finally the project was given a GUI, which for the purpose of the demo has an attached settings window. This settings window simply allows you to set the weights for different emotions, used to calculate the trigger level.

Challenges I ran into

The free version of the Emotion API restricts the amount of requests per minute. This means that the software can not do real-time monitoring of your emotional state. On top of this it was hard to find a decent library that could grab images from the webcam.

Accomplishments that I'm proud of

I'm happy that it was possible to connect to Microsofts Cognitive Services, and somewhat easily get emotional data from a users face. Working with different GUI triggers and events to control the display of windows, and changing different settings(emotional weights etc.)

What I learned

I learned more about how to use a REST API and working with Json data.

What's next for HarrasBlock

Refactor. Refactor. Refactor. Cleaning up the big blob of functionality that is HarrasBlock. Also integrating it with the web interface made alongside the software project.

Built With

  • c#
  • emotion-api
  • emotionapi
  • webcam
  • wpf
  • xaml
Share this project: