Giter Club home page Giter Club logo

of-hand-physics's Introduction

OF-Hand-Physics

This project involves an application of computer vision and image processing, specifically with OpenCv hand tracking and Box2D, a 2D physics game engine. It allows for object tracking with any background using live video from a webcam, which is accomplished using background subtraction with one channel images in combination with contour finding and blob detection. In addition, objects can be created that collide and interact with the tracked bodies within the displayed webcam feed.

Installing

Prerequisites

This project uses OpenFrameworks and some of its addons. If not already installed, download the latest release here:

http://openframeworks.cc/download/

In addition, this project uses Box2D, an extra 2D physics game engine addon that is not listed under the included addons with OpenFrameworks. If not already downloaded, it can be acquired through following the instructions at this repo:

https://github.com/vanderlin/ofxBox2d

Follow the installation instructions and make sure that the installed folder is in the addons folder of the OpenFrameworks directory.

Setup

First, clone the repository:

https://github.com/rgychiu/of-hand-physics.git

Copy the cloned repository into the apps/myApps folder of the OpenFrameworks directory.

Open the Project Generator from the projectGenerator folder of the OpenFrameworks directory and select import.

Navigate to and select the cloned repository in the myApps folder and update the project. Make sure OpenCv and Box2D are recognized addons and included in the project.

Open the project in your IDE, and you should now be able to build and run the project!

Usage

The project includes a basic interface that lists the different commands available when running. Nonetheless, here are some steps to use the features of the project:

When the program runs, a video along with a black and white video will appear in the window. The black and white image is the result of background subtraction between a grayscaled version of the live video and a background image, which defaults to the first frame that was available when the program started and webcam turned on.

To use another background for background subtraction, position the webcam to include the new desired background and press R.

The program will continue to attempt to highlight blobs present in the black and white video. If objects are not recognized, decreasing the threshold using [ or increasing the threshold using ] can help with differentiating the background from other objects that move into the frame.

Even without any bodies being tracked, Box2D shapes can be created and will be contained within the video. To create a circle object, simply click anywhere in the video. To clear all the objects from the video, press -

Note that it is possible that your computer's webcam does not support 640x480. If this is the case, you may need to adjust the size of the window. Otherwise, the layout should adjust based on the new width and height.

of-hand-physics's People

Contributors

rgychiu avatar gcevans avatar

Watchers

James Cloos avatar  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.