Blender/Bundler Import Tutorial

Abstract

You have a lot of cameras, and you have photographed (or video recorded) a common scene. Now you want to know where exactly the cameras are, and whether you can recognize some points in "world coordinates" xyz (as opposed to "image coordinates" xy). And you probably want to see it.

Bundler by Noah Snavely is a tool that does exactly that (though as of 2013, I would recommend VisualSFM, which includes Bundler). It can be used in the following steps:

  1. Read a lot of JPGs, and try to determine camera intrinsics f, k1, k2 (focal length and lens distortion)
  2. For each JPG, determine a lot of SIFT features (to recognize points in other images).
  3. Match the SIFTs within the images (so you know which image point xy corresponds to which other)
  4. Find out what that means in world coordinates (e.g. the camera extrinsics, and the points in xyz)
  5. Use Blender (here version 2.49) to display the results.

Most of it is pretty well handled by the Bundler package (and I am pretty grateful for it, thanks Noah!). There are only two difficult things: Displaying the results is not really built-in (this is not the main priority in Bundler).

In this tutorial, I will tackle this, and try to give you some useful advice.

Bundler output in Blender

The main output of Bundler is a file bundle.out, which contains 5-line blocks for cameras and 3-line blocks for points. This is not what Blender (2.49 in this case) can read. So I wrote a small Python script (yes, Blender supports that) named bundle_import_ruhl.py that you should put in ~/.blender/scripts (under Linux; see Blender documentation for other OSes).

I presume you already had a successful Bundler run and now have a bundle.out file. In Blender, select the script window and then choose Add->.out Import (Bundler) by K.Ruhl, as shown below.

Blender: Finding the Script window Calling the bundle.out import script

Then select your bundle.out file, remove the Blender default cube in the center and rotate around. You are done! Your Blender window should look like the one below: Cameras are the funny tetraeders, and the point clouds are the recognized points.

Blender: Display a bundle.out file

Unfortunately, in this view the colors and the SIFT keypoints are not considered at all: For this, you have to look into the bundle.out file (and further back, the .key files) to parse it yourself. But the important point is: We have visualised our output!

Alternatively, if you are a Matlab person, over at Ohio university there is a Matlab display routine to do the same - but beware that this is a 2D plot, and xy ratio is skewed, so this is good for getting a rough idea only.

Conclusion

I hope you found something useful! Displaying Bundler results is always nice to have.

EOF (Mar:2011)