gsoc 2013 branch soc-2013-motion_track
Merging r57392 through r57521 from trunk into soc-2013-motion_track
Add constraints for focal length refinement

The user can apply a ranged constraint to the focal length during refinement. When the focal length is selected for refinement in the solve panel, a constraint can be applied by checking "Constrain Focal Length" and entering the appropriate minimum and maximum values. The camera focal length will only be refined within this range. This is useful when an unconstrained refinement gives an incorrect result and a suitable range is known.

This includes the following changes:
- Addition of constraint UI with corresponding RNA properties. The constraint is displayed in the same units chosen for the camera focal length. The values are restricted such that min is no greater than focal length and max is no less than it.
- Data structure modifications to allow passing of constraint values from the UI to libmv.
- Modifications to the libmv simple pipeline API to incorporate constraints.
- Constraining focal length when interfacing with Ceres (which only does unconstrained solving) through a sinusoidal mapping.

Results of tests are given at: http://wiki.blender.org/index.php/User:Sftrabbit/GSoC_2013/Documentation/Constraint_Tests
Merging from trunk r58267 into soc-2013-motion_track
Refactor and tidy up bundle options and interfaces

Non-functional changes to a few data types and interfaces involved in passing bundle options from the UI to libmv. A significant change is that the decision to perform a modal reconstruction or not is moved into the libmv C API and the type of camera movement is passed as an option.
Modify Tracks and libmv C API for multiview reconstruction

Add a view identifier to the Markers that are contained in a Tracks set and the appropriate interface for inserting and fetching from the set according to view. Also modify the libmv C API to allow multiview insertion into Tracks from outside libmv.
Unify libmv C API for solving

The current libmv C API exposes the libmv_solve function which forwards to either libmv_solveReconstruction or libmv_solveModal, depending on whether the user selected Tripod Motion in the UI. These functions contain a fair bit of common code. Unify them into the single libmv_solve function, leading the way to a clean multiview reconstruction solution.
Fix error when compiling with WITH_LIBMV=OFF

Adjust libmv-capi_stub.cc to match recent changes to the C API header, otherwise it won't compile with WITH_LIBMV=OFF.
Refactor bundle refinement in libmv C API

Instead of having libmv_solveRefineIntrinsics, which creates bundle options from reconstruction options and passes them to the libmv bundle adjuster, have a simpler function that just creates and returns the options. This brings all of the solving logic into libmv_solve.
Fix alignment indentation

Although file is tab indented, split lines should be aligned with spaces.
Modify libmv output types to store multiview reconstructions

The libmv_solve function returns a libmv_Reconstruction which contains a EuclideanReconstruction. This class and its brother, ProjectiveReconstruction, store the results of a reconstruction. To make way for multiview reconstruction, modify these classes to store reconstructed camera poses associated with particular views.

All libmv algorithms have been adjusted to meet the new API, temporarily assuming view 0 everywhere until they have also been multiviewified.
Merging from trunk r58769 into soc-2013-motion_track

Mostly to have the cleaned up libmv C API from r58765.
Modify Tracks to multiview only

The Tracks class stores Markers that correspond to tracks across different views and images. There's no need to have an interface for both singleview and multiview reconstruction, so remove the single view interface. For now, all algorithms assume view 0, but should instead be passed the view that they should work on.
Rename CameraForViewImage to CameraForImage

It is uncommon to refer to an image without a particular view, so shorten the function name for simplicity. If a function is needed that references all views at once, suffixing with AllViews will do.
Change from multiview to multicamera terminology

All 3D reconstruction is multiview reconstruction. A better, unambigious term for reconstructing multiple cameras is multicamera reconstruction, so change all references to "views" to "cameras".

Unfortunately, this introduces some confusion in simple_pipeline/reconstruction.h, but I'm currently discussing this with Keir.
Add correct handling of multicamera intrinsics

One argument to libmv_solve is an array of camera intrinsics options. The code now converts all elements of the array to internal CameraIntrinsics, instead of just the first. The output struct, libmv_Reconstruction, now contains a vector of output camera intrinsics (each element corresponding to a different camera).
Use multicamera intrinsics to calculate reprojection error

The reprojection error calculation would only take a single CameraIntrinsics and would apply it to all markers. Adjust it to take a vector of CameraIntrinsics and apply the intrinsics corresponding to the marker's associated camera.
More framework for multicamera reconstruction

All algorithms have been adjusted to take into account multiple cameras and their intrinsics except for the bundle adjustment. This means it will give an incorrect result for multicamera reconstruction at the moment, but single camera reconstruction still functions normally.
Fix invalid returned camera intrinsics

libmv provides a way to get the camera intrinsics from a reconstruction, which may be different to the intrinsics passed to the solver if refinement has taken place. My multicamera changes introduced a bug caused by a pointer cast between incompatible types causing the returned intrinsics to have screwed up values. This patch fixes that cast.
Fix ignored constraint flag

Incorrect flags were being checked for whether a focal lenght constraint should be applied, causing it to always be applied whenever the focal length was chosen for refinement.