There was a period of time during which one of our "jokester" co-workers sent messages from unlocked PCs inviting everyone for free drinks (past tense is more of a wish). Every time someone went to the kitchen they had to double-check if they locked their screen. While not really a problem, it's the little things that get to you. As with everything, there had to be a way to automate locking the screen (yes, it was that hard to press Win+L).
The idea was to lock the screen if someone unknown came in front of it and I wasn't there. In far less time then expected I made a program that could distinguish if I was in front of the screen or someone else. Following a great guide, it was no problem making it into a simple Applet. I could pretend that I needed the GUI to help me debug, but it was for the fun of it.
The program (and icon) had three states: OK, EMPTY and WARNING. An image was taken twice a second to make sure there were almost no effects on performance. Everything was ready to go.
Intruder alert, intruder alert
The next day, after some testing - during which it worked with no problems - I decided to leave it on. Indeed, the screen locked immediately when a colleague passed in front of my PC and I was across the room discussing something. This repeated on several occasions, making me believe that it actually works.
Of course, the timings had to be adjusted a bit, after the screen locked as I looked away and someone passed by and got detected. After fixing that I put the locker back online and kept working as usual, with no accidental locks for a couple of hours, until the screen suddenly locked with me right in front of it. Whatever idea I had at the time was gone, the flow of thoughts interrupted by a lock screen.
First time I ignored it, dismissing it as a random error, but it became harder calling it random after I could reproduce it. The problem was that my face got detected from a sharp angle as I turned to talk to someone. An image of me from that angle was no more similar to me than a random stranger. This problem, and its solution, will be better explained as part of an incoming blog post. As soon as it's out I will add a link here.
The second time it failed miserably was after my PC was left unlocked and I was on the other end of the office. A co-worker came in and went to see something on the screen, and it didn't lock. I told her to try using the keyboard. Nothing. She was standing and looking down. Standing. Her face was out of the camera's field of view. The great facial recognition based screen locker was defeated by standing up.
Obviously this "safety measure" is useless now that everyone knows about it. It is really not that hard to cover a webcam... or to stand up. To be honest, it's nice to have a drink and relax with the people you work with from time to time, so paying for a round of drinks is not the end of the world. On the other hand, there is no excuse to stop making ridiculously complex additions to mundane things.