This document describes the steps needed to process images with photoPopup, a project created and maintained by Derek Hoiem of Carnegie Mellon University. From the webpage:
Our system automatically constructs simple "pop-up" 3D models, like those one would find in a children's book, out of a single outdoor image. The system labels each region of an outdoor image as ground, vertical, or sky. Line segments fitted to the ground-vertical boundary in the image and an estimate of the horizon's position provide the necessary information to determine where to "cut" and "fold" in the image. The model is then popped up, and the image is texture mapped onto the model.
The theoretical and inner workings of the system are not described in this document -- merely, how to apply the system to an image of your choosing. This procedure was used under a combination of Fedora Core 5 and Mac OS X (the latter for using Photoshop and viewing the final product in a VRML-enabled browser).
NOTE: A reader of this howto has reported errors with segment under Cygwin. We're looking into it.
Steps:
export LD_LIBRARY_PATH="/home/mbates/v73/runtime/glnx86:\ /home/mbates/v73/sys/os/glnx86:\ /home/mbates/v73/sys/java/jre/glnx86/jre1.5.0/lib/i386/native_threads:\ /home/mbates/v73/sys/java/jre/glnx86/jre1.5.0/lib/i386/client:\ /home/mbates/v73/sys/java/jre/glnx86/jre1.5.0/lib/i386:\ /home/mbates/v73/bin/glnx86" export XAPPLRESDIR="/home/mbates/v73/X11/app-defaults"and don't exit the shell until you're through with all these steps.
make
./segment 0.8 100 100 /path/to/image.pbm /output/path/image.pnmalways using those three numbers -- the author of photoPopup determined those to be the ideal settings. (Though experimentation is always an option -- consult the segment docs for more info.) "image.pnm" will be created under the path you specify as the last argument to segment.
It is strongly recommended that you make a dedicated directory for each project, since the process generates a lot of files in that directory. E.g. make a "results" directory as suggested by the author. Put your original image.jpg in that directory, along with the image.pnm that you just made with segment. You can throw away the pbm version now, you don't need it anymore.
./photoPopup ./classifiers_08_22_200.mat /path/to/image.jpg pnm /same/path
Walkthrough, with a real image:
./segment 0.8 100 100 ../florence.pbm ../florence.pnm (output:) loading input image. processing got 205 components done! uff...thats hard work.This generated a .pnm file which I can view in Photoshop, and it looked like this:
like, far out, man!
./photoPopup ./classifiers_08_22_2005.mat ../florence/florence.jpg pnm ../florence
florence.pnm florence.l.jpg florence.h135.pgm florence.h090.pgm florence.jpg florence.hpor.pgm florence.v000.pgm florence.g.png florence.vsky.pgm florence.v090.pgm florence.wrl florence.v.png florence.hsol.pgm florence.h045.pgmThe .wrl file is the VRML data, that's what you would open in a viewer/browser (see below). But it needs the rest of the files in that directory too, so keep 'em all together.
Viewing the result:
Linux:
gcc (duhhhhh) gcc-c++ mozilla mozilla-devel mesa-libGL mesa-libGL-devel mesa-libGLU mesa-libGLU-devel SDL-devel gtk+ gtk+-devel gtk2 gtk2-devel boost boost-devel libjpeg libjpeg-devel libpng libpng-devel doxygenand libjs and libjs-devel from here (which may have been an unnecessary step, try with just the above list first).
Viewing VRML on Mac OS X:
Windows:
References: