Code Monkey home page Code Monkey logo

ofxkinectprojectortoolkit's Introduction

ofxKinectProjectorToolkit

This is an openFrameworks addon for calibrating a projector to a Kinect, allowing for automated projection mapping aligned to the Kinect.

This toolkit is also implemented as a Processing library. It is based on the method described by Jan Hrdlička. ofxKinectProjectorToolkit is similar in aim to ofxCamaraLucida, ofxReprojection, and ofxProjectorKinectCalibration.

Dependencies

This library and the included calibration app can be coupled with either ofxKinect or ofxOpenNI, and have several dependencies

If using ofxOpenNi, make sure to copy the openni config/lib folders into the data path as described in its README, or you will get compilation errors (they are not included in the example files found here).

Instructions

Calibration

Set your display settings to dual-screen so the projector has its own display, and launch the calibration example (or calibration_openni if using ofxOpenNi).

Make note of the screen resolution of the projector's display (e.g. 1280x800) and copy to PROJECTOR_RESOLUTION_X and PROJECTOR_RESOLUTION_Y.

Follow the instructions in the calibration app to collect a series of point pairs by moving the chessboard to various positions and recording point pairs, and save the calibration file.

Mapping

The post-calibration example_contourMap and example_contourMap_openni demonstrate how to apply the calibration. They reproject solid colors onto the objects found and tracked from the kinect using ofxCv's contourFinder, which tracks blobs frame to frame, though persistent identification is not 100% reliable.

Make sure you load the calibration file you saved in the previous step in the line:

kpt.loadCalibration(PATH_TO_YOUR_CALIBRTION_FILE);

The key function for mapping is getProjectedPoint(ofVec3f worldPoint). This function takes any 3d world point from the Kinect and converts it to a pixel point. For example, using ofxKinect, the pixel point associated with the world point inside the depth image at (x, y) is found:

ofVec3f worldPoint = kinect.getWorldCoordinateAt(x, y);
ofVec2f projectorPoint = kpt.getProjectedPoint(worldPoint);

Using ofxOpenNi, the world point is acquired slightly differently, directly from the raw depth pixels.

ofShortPixels depthPixels = kinect.getDepthRawPixels();
ofPoint depthPoint = ofPoint(x, y, depthPixels[x +y * kinect.getWidth()]);
ofVec3f worldPoint = kinect.projectiveToWorld(depthPoint);
ofVec2f projectedPoint = kpt.getProjectedPoint(worldPoint);

ofxkinectprojectortoolkit's People

Contributors

genekogan avatar mat-loz avatar

Watchers

James Cloos avatar Qiuyi (Chewy) Wu 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.