This weekend I started exploring aerial photogrammetry using Bundler and Meshlab. The first few Google searches I did while researching aerial photogrammetry discussed KAP (Kite Aerial Photography) enthusiasts who have used free photogrammetry tools like Microsoft PhotoSynth and Synth Export, Autodesk 123D Catch, or the open source program Bundler (SfM) to create surveys of archeological sites.
My goal was to use aerial photos my brother & I captured with our EasyStar model airplane to create DEMs (digital elevation models) of our local scenery. The aerial photos I used to test Bundler were taken at a 400 foot altitude with a model airplane flying at 35 kilometers per hour. I used a Canon Powershot SD780IS camera with CHDK and the countdown intervalometer script to trigger the photos.
After a few hours of tinkering with software, reading manuals, and Google searching I successfully created and textured my first DEM (digital elevation model).
Sample Bundler Aerial Images
I have included a ZIP archive with the three aerial photos from this tutorial. You can use these images to follow along with your copy of the Bundler photogrammetry software.
You can download the aerial photos here:
bundler_cliff_sample_images.zip (14 MB)
How I Created my First Digital Elevation Model
I spent a few hours this weekend compiling my own Mac OS X 10.7 Lion build of Bundler. After a half day spent fighting with gfortran and Lion / Xcode 4.2 issues and modifying countless makefiles I compiled my own build of Bundler. Then I noticed that the standard version of the SIFT keypoint detector (by David Lowe) only works on Linux and Windows.
While searching for a SIFT replacement I came across a precompiled version of Bundler for Mac OS X that also included a modified copy of SiftGPU. Thanks Ivan!
You can download the Mac OS X build of Bundler (SfM) from the thread on the Photogrammetry Forum.
The precompiled version of Bundler for Mac OS X has to be placed in your home directory at:
You then need to edit your ~/.profile and add Bundler to your system path.
Bundler is started from the terminal by navigating to the folder where your images are located and running RunBundler.sh
After RunBundler processes the images you need to edit the file pmvs/prep_pmvs.sh to define the value BUNDLER_BIN_PATH for each image project:
It is important to use a plain text editor like TextWrangler so you don’t add any rich text formatting to the prep_pmvs.sh script. Also make sure there aren’t any spaces between the equals sign and the ~/bundler/bin part of the path or the script will report errors.
Next you need to run the following commands in your terminal from inside your image directory:
Exporting a PLY file
If you have a single view cluster you can export it to a .ply file using:
pmvs2 pmvs/ option-0000
If you have a larger dataset with multiple view clusters you could use this command instead:
After the pmvs2 program finishes the final Bundler PLY point cloud file is output inside the image folder at the path:
Creating the Reconstructed Polygon Mesh Surface
I used Meshlab to convert the Bundler generated point cloud into a 3D triangulated polygon mesh. Then I exported the geometry in the Wavefront .OBJ mesh format.
Meshlab and WebGL
When I started experimenting with a Bundler aerial imaging workflow I did a several tests with WebGL and ascii .ply files using the open source XB PointStream library.
Here is a link to the first interactive aerial mosaic I visualized with WebGL:
The point cloud was generated from a 800 meter long strip of aerial images. If you want to play with the point cloud data in MeshLab you can download the ASCII .ply file here:
http://www.andrewhazelden.com/projects/bundler/bundler.ply (15 MB).
Changing MeshLab Point Sizes
When you are working with point cloud data sets in MeshLab it can be helpful to scale the size of the point cloud dots to make the scene easier to work with. This is most evident when you change from editing point clouds of scanned objects to viewing point clouds of large landscapes.
Deleting Points in Meshlab
When I’m working with point cloud data sets in MeshLab I find it a lot easier to deleted the unwanted points from my project before I create a polygon surface reconstruction. Cleaning the point cloud data up now will save a lot of time later because you won’t have to spend time trying to fix the polygon mesh topology.