mercredi 9 mai 2012

osm-bundler

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:


  1. 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
  2. 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.
  3. 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:

meshlab points010.ply

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 .

1 commentaire:

  1. i have trouble with the osm bundler, i hope you can help me.

    the thing is that i use my smatphone camera to take pictures of an object and it doesnt seems to get better when i get the CCD width in the camera data base and i try to take more pictures so if you can help me with how you took your pictures or what camera you are using so i trya other thing...i have several days trying all kynd of stuff to make a 3D model but nothing seems to work...not even a little

    RépondreSupprimer