Giter VIP home page Giter VIP logo

machine-vision-prank's Introduction

Dumb Machine Vision Prank

A few weeks ago, my wife came home from sailing:

Image of Stefanie in home

She heard me call out "Hey Stefie, how was sailing?" and she looked around the apartment for a few minutes to find me:

Image of Stefanie in home

But I wasn't home, so she eventually went back to work, and never said anything more about it. A couple weeks later, she came home from work:

Image of Stefanie in home

She, again, heard me ask from my room "Hey Stefie, how are you? How was your meeting at work," but I was nowhere to be found:

Image of Stefanie in home

After I came home, she initially didn't say anything about it, but eventually asked if I had rigged up the computer to greet her when she came home. I couldn't deny it ;)

How I did it:

april.py is the main machine vision script. It has two rectangles -- one corresponding to the door, and one corresponding to everything else. It will trigger if there is more than some amount of motion at the door, and less than some amount of motion everywhere else. The second rectangle is there so the script won't react to e.g. lighting changes. I don't know if the second rectangle is required, but I do know that I had zero false positives or negatives with this algorithm over a fairly long period of time. To use this script, there are a few things to modify:

  • rect1 and rect2 define the region of the door, and the region of not-the-door. test_run and skip_diff should be set to true to allow you to visualize where these regions are. They should both be false otherwise.
  • a and b in the main loop are measures of motion in both regions. The thresholds may need to be changed (in my case, I used 0.2 and 0.1). There was a very large range where there were no false positives or negatives.

dothat.sh runs on the machine in my living room. It runs the machine vision program, waits 2 seconds from the event (to allow my wife to come in), begins video recording, and then notifies the other machines (the IP here needs to be changed).

doit.sh runs on the machine in my bedroom. It plays the greeting, and then record video of my wife looking for me.

The gst-launch command is a beast. All it does is record video for half an hour (so I had proof). You'll need to mess with it to get the right audio/video device, and on some machines, you may need to disable audio. See the examples in the scripts. I had help with this one from the gstreamer IRC channel.

All of this runs under Ubuntu GNU/Linux, and isn't really designed to be used by anyone not computer savvy.

Copyright (c) 2011. Piotr Mitros. All Rights Reserved for photos and text. Scripts and code may be distributed/modified under the terms of the GNU General Public License version 3 or newer.

machine-vision-prank's People

Contributors

pmitros avatar

Stargazers

Mark Saroufim avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.