Notes from Art&&Code : Calibrating Projectors and Cameras: Practical Tools
The Kinect device inputs a realtime 3D scan of a world scene.
A projector outputs a realtime 2D projection onto a 3D world scene.
Using OpenCV’s CalibrateCamera function, we are able to calculate the intrinsics (focal length, lens offset) and extrinsics (projector position, rotation) of a projector relative the 3D scan of the Kinect.
We project a 3D virtual world scene onto a 3D real world scene by presuming that they are geometrically consistent (thanks to the Kinect) and knowing the intrinsics and extrinsics of the projector.
We can think of this as either:
- Calibrating a virtual camera inside the computer against the scanned 3D scene, such that the virtual camera exactly aligns with the real projector or
- Calibrating a real projector in the real world against a real 3D scene using the Kinect to take measurements
Patches and plugins are available at http://www.kimchiandchips.com/files/workshops/artandcode/ArtAndCode-CalibrateProjector.zip
(the old link went to github, but there seems to be some bugs with their download system at the moment
Inside is a plugin which wraps EmguCV and OpenNI (you’ll need to have a recent version of OpenNI installed).
Also there are 2 patches:
CalibrateProjector (WARNING : Renderer will open fullscreen on 'second' screen to right of main screen e.g. projector)
Workshop notes are available here
openFrameworks code here (will be adding / amending / breaking / creating in that repo. You might want to checkout the artandcode-end tag).