chili-epfl/chilitags — pull request #7 by severin-lemaignan (2013-09-28 13:29:16+00:00)
Title: Add 3D localization of markers/set of markers

This pull-request introduces 3D (actually, 6D) localization
of markers. It also introduces a simple YAML-based configuration file
that allows users to define 'objects' as a set of markers.

-------------------
Sample usage (extracted from samples/objects/objects.cpp):

//...

cv::Mat tInputImage;
chilitags::DetectChilitags detector(&tInputImage);

chilitags::Objects objects(cameraMatrix, distCoeffs, configFilename);

while(true) {

// [update input image]

detector.update();

for (auto& kv : objects.all()) {
// name of the object
cout << kv.first;
// 4x4 transformation matrix in camera's frame
cout << " at " << kv.second << endl;
}

}
---------------

The constructor takes (optionally) the name of the YAML configuration file.
Here a sample:

-----------
myobject:
- marker: 0
size: 27
translation: [-72.75, -112.5, 0.]
keep: true
- marker: 1
size: 27
translation: [72.75, -112.5, 0.]
rotation: [0., 0., 90.]
------------

This sample defines an object 'myobject' that contains 2 markers (id 0
and 1). You can specify the size, translation and rotation of each
markers, relative to the object origin.

Refer to `share/markers_configuration_sample.yml for the full
documentation.

The algorithm computes the position of the object with as many markers
as possible, but some may be missing. By specifying several markers for
a single object, robust (and stable) localization can be achieved.

The 6D localization relies on OpenCV's 'solvePnP' implementation.
The commit also provides an estimator to smooth the localization. The
gain of the estimator (from 1.0 -> no filtering, to 0.0 -> strong
damping) can be set when calling the chilitags::Objects constructor.

Note that:
- this commit introduces a requirement on C++11 to compile chilitags.
- it also adds a dependency on yaml-cpp. However, this dependency is
optional. If yaml-cpp is not found, only the 6D position of markers is
returned (no support for objects).