Little projection-mapping tool

a little proj-map tool for use in our office, my first code ever with C++ and OF.
It’s based on quad warping math gently provided on this forum.
thanks to people on this forum that provided code snippets, tips and examples.

**UPDATE: I’ve set-up a simple web site for this little tool at
http://www.hv-a.com/lpmt
where you can find the latest news and the more recent code.

NEW 14/03/11: on the lpmt site we’ve added a first experimental binary build for Microsoft Windows.**

http://www.youtube.com/watch?v=3h918L0HA0Y

Main features:

  • up to 36 independent projection surfaces

  • possible content: solid color, images, video, live-cam, slideshows, smoothly changing solid colors, and more

  • customizable green-screen (chromakey) for video and live-cam sources

  • horizontal and vertical flipping for image, video and live-cam content

  • independent opacity settings for each content element

  • customizable tint for each content element

  • several blending-modes for projection surfaces

  • on-screen editable masks

  • bezier-warping for projection on curved surfaces

  • synced multi-projectors shows with adjustable edge-blending

  • control and setup through a rich set of OSC messages

  • customizable video speed and volume

  • save/load project set to/from xml file

  • syncronized start for video elements

  • vertex snap function for adjacent quads

  • customizable image background for rough positioning of projection surfaces

  • customizable speed for slideshows and color transitions

source code:

up-to-date code (git repository):
http://gitorious.org/projection-mapping

for the github fans, the repository is mirrored here:
https://github.com/hvfrancesco/ProjectionMapping

not often updated zip file:
http://www.hv-a.com/projectTiles/projection-mapping.zip

key commands

’s’ – saves settings to xml (projection_settings.xml in data folder)
‘l’ – loads settings from xml file

‘a’ – adds new quad
‘>’ – go to next quad
‘<’ – go to previous quad
‘+’ - raise active quad position in layers pile
‘-’ - lower active quad position in layers pile
‘z’ – selects first gui page for active quad settings
‘x’ – selects second gui page for active quad settings
‘c’ – selects gui page for active quad corner position fine-tuning
‘q’ – fills window with active quad

‘spacebar’ – toggles projection/setup modes
‘g’ – toggles gui (for quad warping with mouse gui must be switched off)
‘f’ – toggles fullscreen mode
‘w’ – toggles cam snapshot window background
‘r’ – resyncs all videos and slideshows in all quads to starting point
‘1’ – shows general settings page of gui

3 Likes

I’ve added a slideshow feature to possible quad content, with customizable speed and colorization.
set up a git repository at gitorious:
http://gitorious.org/projection-mapping

here is a small video showing slideshow feature:
http://www.youtube.com/watch?v=M-lWkokpoNs

and another one showing a simple test setup with different features:
http://www.youtube.com/watch?v=SRyNj-HufUU

nice,thank you for the code,here’s the vs2010 version with of0062
http://rapidshare.com/files/436647538/mapping.rar
seems i can’t attach files in the forum :frowning:

[quote author=“liquid”]nice,thank you for the code,here’s the vs2010 version with of0062
http://rapidshare.com/files/436647538/mapping.rar
seems i can’t attach files in the forum :([/quote]

cool, thanks.
I would like to integrate this in main source tree in git repo, but I’m not sure about the best way to do it as I don’t know anything about developing on windows.
can you give me any hint?
best, francesco

hi, thank you for this cool tool for drawing the world with our computers. We have a small problem with these two methods from testApp.cpp:

gui.addComboBox(“image bg”, quads[i].bgImg, imgFiles.size(), images);
gui.addComboBox(“video bg”, quads[i].bgVideo, videoFiles.size(), videos);

we’ve compiled it under OSX and latest oF verion from github.
when compiled without those methods commented, the application freezes.
when compiled with those methods commented, the application runs fine but we can’t load video nor images to the quads.

is there anyway around this other than invoking textures separatly in the draw method from quads.h?

thank you in advance!

[quote author=“httpdospuntos”]hi, thank you for this cool tool for drawing the world with our computers. We have a small problem with these two methods from testApp.cpp:

gui.addComboBox(“image bg”, quads[i].bgImg, imgFiles.size(), images);
gui.addComboBox(“video bg”, quads[i].bgVideo, videoFiles.size(), videos);

we’ve compiled it under OSX and latest oF verion from github.
when compiled without those methods commented, the application freezes.
when compiled with those methods commented, the application runs fine but we can’t load video nor images to the quads.

is there anyway around this other than invoking textures separatly in the draw method from quads.h?

thank you in advance![/quote]

Unfortunately I have not much experience with openframeworks, and besides I just can try it out on a linux system. Maybe it has something to do with paths on different systems? I’m afraid my approach to dir listing actually is a bit dirty. In the slideshow stuff I’ve added a sort of minimal filtering for the directory listing, sort of:

if (slideshowName != “.” && slideshowName != “…”)

does the slideshow feature works for you? if it is the case we could try to see if that is the problem.
At present I’m traveling through south-america and will not be able to access my computer for a couple of weeks, but I will try to investigate this as soon as I get back.
Maybe someone else with access to an OSX system could try it out and see if we can understand better what’s going wrong?
hope I can be more helpful soon.
best, francesco

Hi Francesco,

really interesting project. how about projecting with a beamer onto something? Did you made any testings? that would be nice. If you could create textures on the fly.

Added basic layers-style management for quads.
before quads were just rendered in creation order, higher numbers quads on top.
Now you can re-arrange the order of quads by raising/lowering the active quad in layers pile using ‘+’ and ‘-’ keys.
Up to date code is in git repository.
(the layers implementation is, I’m afraid, a bit messy. my coding skills are showing their limits)

added a helper-grid in setup mode to active quad, for better alignment of quads to real world objects

hi httpdospuntos, could you try the last version from git repo and see if the problem still exists?

Having upgraded my graphic card, I discovered that upgrading NVIDIA drivers on my Ubuntu Lucid system strangely triggered some problem with libstdc++ and strings that was leading to a segfault of my projection mapping tool.
It is very likely due to some dumb thing in my code that I wasn’t able to debug at all, but downgrading to previous Nvidia driver solved the problem.

newest driver was
270.18-0ubuntu1~lucid~xup1
and came from this ppa
ppa:ubuntu-x-swat/x-updates

reverting to 195.36.15-0ubuntu2 apparently fixed the problem

I’m reporting this just to see if there’s someone else that experienced similar problems, and I’m curious to see if there’s someone that has tested successfully the code on more recent Ubuntu systems (e.g. 10.10 aka Maverick).

best, francesco

added green-screen (chromakey) feature to both video and live-cam content.
screen color is configurable.
This implementation is rather CPU intensive on large source videos, and if you’re greenscreening many large stuff at the same time it could cause slowdowns, but it’s ok in normal conditions.

btw.: if anyone has tips and examples on how to do greenscreening through OpenGL magic or in a more efficient way it would be nice.

experimenting with double-window version, keeping GUI in its own window thanks to ofxFenster addon

http://bit.ly/dQnJP9[attachment=0:1r3428bd]Schermata.png[/attachment:1r3428bd]

Hey Francesco,

Thx for sharing the code for this great piece of software.
Just did a Git Fork and added a XCode project for OSX
https://github.com/lab101/ProjectionMapping

Also changed the search path for assets

  
string imgDir = ofToDataPath("img",true);  

Now it’s working great on my Mac.

Thx

That’s great! I had no acces to an apple system, I’m really glad it worked. thanks for your contribution!
francesco

I’m testing integration with Most Pixels Ever to use this little projection mapping tool on several synced machines, but I’m not sure it could be useful, what do you think?

https://github.com/Flightphase/Most-Pixels-Ever :wink:

made a new repository for 007 branch

https://github.com/hvfrancesco/lpmt

added keys for stopping/starting projection, can be useful for a real projection show

I have something that’s beginning to work using the flightphase addon.
I was able to decently syncronize two sessions of lpmt running as clients of MPE server on the same machine, not tried on different machines yet, and have to solve an issue with fullscreen (and a bunch of other stuff), but it’s promising: I could be able to use a setup with several synced projectors with lpmt, getting interesting :wink:

great to hear!