Now let's look a bit on
bundler and more particularly on the
osm-bundler which is an open source software based on python.
Object to reconstruct
The goal of this example is to show how to reconstruct a simple object, For the demo, it will be a toy car. You can see here the photos, I used:
What a wonderful car, isn't? The photographs were taken with an iPad 2 main camera: you will see later that it is important to know the model.
Create the point cloud
So, I put all my photos in a folder and can now create the point cloud: to do it, I use: osm-bundler and run the following command:
python /XXX/osm-bundler/RunBundler.py --photos=.
The whole operation took: 1 min 43 seconds and if everything goes well, the output should be something like this:
Working directory created: /tmp/osm-bundler-ip82t8
BundlerMatching executable path: /XXX/osm-bundler/software/bundler/bin/KeyMatchFull
Sift executable path: /XXX/osm-bundler/software/vlfeat/bin/glx/sift
Processing photo 'IMG_0018.JPG':
Extracting features with the SIFT method from VLFeat library...
Found 8609 features
Processing photo 'IMG_0019.JPG':
Extracting features with the SIFT method from VLFeat library...
Found 8505 features
...
Performing feature matching...
[KeyMatchFull] Reading keys took 3.460s
[KeyMatchFull] Matching to image 0
[KeyMatchFull] Matching took 0.010s
[KeyMatchFull] Matching to image 1
[KeyMatchFull] Matching took 0.570s
[KeyMatchFull] Matching to image 2
[KeyMatchFull] Matching took 1.160s
[KeyMatchFull] Matching to image 3
[KeyMatchFull] Matching took 1.890s
[KeyMatchFull] Matching to image 4
[KeyMatchFull] Matching took 2.480s
[KeyMatchFull] Matching to image 5
...
[KeyMatchFull] Matching to image 9
[KeyMatchFull] Matching took 5.760s
Performing bundle adjustment...
Finished!
See the results in the '/tmp/osm-bundler-ip82t8' directory
A few explanations on the output:
- The first step to perform is to analyze the different pictures and understand their features of key points. A feature is an area in the picture which could be "easily" recognized on other pictures. Calculating the features is relatively slow as it can take between 1 and 2 seconds per picture (and my pictures have a very poor quality). For more information about the algorithm used, you can go here. We will see later we could use other algorithms for the feature detection
- When all the features have been determined, the algorithm will match them together, that means it will compare the features of two different images and understand if there are any relationship. This algorithm is the longest one as it O(n^2) where n is the number of images.
- When all the relations have been determined, the bundle adjustment is performed to understand where are the cameras compared to the scene and add the different points in one unique scene.
Point cloud obtaining
If we go in the temporary folder, here is what we can see:
We have many files, but in particular, a folder called bundle, this one will contain the point cloud:
The ply files correspond to the point cloud found after each iteration, the last one is thus the most signification.
By opening it with Meshlab:
we get the following result:
It does not seem very relevant with one screenshot, but you can try by yourself and you will see that we see quite well the car in the middle of the cloud and the carpet around.
PixelStruct
You can then use pixelstruct to make an animation similar to photosynth:
pixelstruct .