Opt. Obj. Type 1 Opt. Obj. Type 3Opt. Obj. Type 2
Meas. Type 1 Meas. Type 2
Figure 1: Optimization objects interact with different mea-
surement types.
such as sparseLM (Lourakis, 2010) or from generat-
ing the derivatives by hand. This step needs to be done
each time small changes are made in the underlying
model. As the cost function usually can be described
in various ways, exploring which modeling of e.g. re-
lations between unknowns and measurements works
best is time consuming. Additionally the convergence
rate highly depends on the chosen model e.g. a con-
vex cost function is most preferable. In OpenOF the
model can be adjusted without further low level pro-
gramming steps, as the necessary code is generated
automatically. The main optimization is designed in
a modular way, enabling developers to easily mod-
ify the optimization algorithm or add new algorithms
while still having the advantage of the high perfor-
mance of a GPU.
An optimization task often comprises thousands
of parameters. Usually several entities have the same
meaning, e.g. (x, y) refer to the coordinate of a point.
Furthermore, these parameters can be grouped to ob-
jects. Within OpenOF all parameters are assigned to
an object. When designing optimization objects, we
distinguish between two different kinds of parame-
ters:
• Variable parameters
• Fixed parameters
The variable parameters will be adjusted within the
optimization. The fixed parameters remain constant
but are necessary to evaluate the cost function. Most
often we end up with a small number of different
types of objects. These objects are linked by so
called measurement types. A measurement represents
a function on which the least squares optimization is
performed. The user defines the function representing
relations between the different objects. Usually, not
all types of objects are necessary to evaluate a certain
measurement (see Figure 1). Sometimes we have a di-
rect but noisy observation X
obs
, e.g. the position given
from a GPS sensor. In this case we define a mea-
surement f (X
est
, X
obs
) = X
est
− X
obs
. It is clear that
the observation X
obs
is not allowed to change. This
function can be modeled in two ways in OpenOF. For
the first option two different object types are defined,
where the first object type has only variable parame-
ters and the second has only fixed parameters. In this
case there are two almost identical object types which
only differ regarding which parameters are allowed to
be changed. It would be more intuitive to have only
one object type which defines a position with vari-
able parameters. To still be able to fix the parameters
of the observation X
obs
, it is possible in OpenOF to
also fix complete object types within a measurement
function. Getting back to the example, one would de-
fine for the function f , X
est
to be variable and X
obs
to be fixed. This enables researchers to incorporate
constraints such that certain parameters stay close to
the initial values without the need to generate a new
type of object with identical parameters. Being able to
define an object as constant in one measurement and
variable in another measurement gives much flexibil-
ity for defining an optimization.
Each measurement forms an equation, which is
transformed to a cost function. This cost function
is designed with SymPy. The Jacobian of the cost
function is computed automatically and transformed
to C++ code. Different measurement types as well as
object types combined, result in a graph similar to the
one presented in (Kummerle et al., 2011) (see Figure
1).
By now only the structure of the optimization has
been defined. Next, the optimization needs to be filled
with actual data. Therefore, a list containing the data
of each type of object is created. A measurement is
defined by the type of measurement as well as the in-
dex pointing to the corresponding data within the data
list.
6 EXAMPLES
We present two examples, first the classic BA and
second an alternative BA parametrization inspired
by (Civera et al., 2008) using inverse distances.
BA contains four kinds of optimization objects.
The first object is a 3D point parametrized by
a name and its coordinates (pt3:[X,Y,Z]). The
second object type defines the external camera
parameters (cam:[CX,CY,CZ,q1,q2,q3,q4]) with
the center point and a quaternion representing the
rotation of the camera. Since the same camera
is repeatedly used within one reconstruction, an
extra object for the internal camera parameters
(cam in:[fx,fy,u0,v0,s,k1,k2,k3]) is defined.
This enables us to constrain the optimization. Several
cameras then share the same internal calibration
(focal length, principle point, skew and distortion pa-
rameters). At last a constant object which contains the
pixel measurements (pt2:[x,y]) is specified. These
parameters remain unchanged within the optimization
OpenOF-FrameworkforSparseNon-linearLeastSquaresOptimizationonaGPU
263