/**
@defgroup SFMBackend_Group SFM Backend

@page Page_SFMBackend The SFM Backend

@section SFMBackend_Intro Introduction

The structure from motion backend contains the actual implementation. All important classes and functions can be seen @ref SFMBackend_Group "here".
The backend was implemented in a seperate library to facilitate it's reuse and allow multiple different frontends to be written for it.
At the time of writing this, however, only a console based frontend exists.

@section SFMBackend_Structure Structure

The central class that manages the entire structure from motion process is the @ref SFM::SFM class. A typical reconstruction usually looks like the following:
@code{.cpp}
    SFM::SFM sfm(sfmConfig);
    sfm.initSingleCameraPath(internalCalibrationMatrix, radialDistortion, imageAspectRatio, imageFilenames);

    std::cout << "Extracting feature points" << std::endl;
    sfm.extractFeaturePoints();

    std::cout << "Building initial pose" << std::endl;
    sfm.buildInitialPose(initialImagePairIndex1, initialImagePairIndex2);

    std::cout << "Running reconstruction" << std::endl;
    while (sfm.getState() != SFM::SFM::OP_STATE_DONE) {
        sfm.operate();
    }

	// Do s.th. with the data
@endcode

The primary entities that constitute the sparse reconstruction are @ref SFM::Frame "frames/cameras",
@ref SFM::InternalCameraCalibration "internal calibrations", @ref SFM::Track "tracks", and
@ref SFM::TrackObservation "track observations". The @ref SFM::SFM class provides access to those
objects through getters. See the following for an example:

@code{.cpp}
	// Do s.th. with the data

    for (const SFM::Track &track : sfm.getTrackList()) {
        std::cout << "Track at " << (std::string) track.getLastWSPositionEstimate() << std::endl;
        for (const SFM::TrackObservation &obs : track.getObservations())
            std::cout << "    is visible in image " << obs.getFrame()->getIndex() << " at " <<
                                (std::string) obs.getScreenSpacePosition() << std::endl;
    }

    for (unsigned i = 0; i < sfm.getFrames().size(); i++) {
        const SFM::Frame &frame = *sfm.getFrames()[i];
        if (frame.active()) {
            std::cout << "Camera " << i << " was sucessfully reconstructed!" << std::endl;
            std::cout << "    " << (std::string) frame.getCamera().getProjectionViewMatrix3x4()[0] << std::endl;
            std::cout << "    " << (std::string) frame.getCamera().getProjectionViewMatrix3x4()[1] << std::endl;
            std::cout << "    " << (std::string) frame.getCamera().getProjectionViewMatrix3x4()[2] << std::endl;
        } else {
            std::cout << "Camera " << i << " could not be reconstructed!" << std::endl;
        }
    }
@endcode

The @ref SFM::Utilities namespace features a couple of functions that can be used to export the results to @ref SFM::Utilities::exportPMVS "PMVS2"
or various other formats. Other functions @ref SFM::Utilities::analyzeMinCut "analyze the camera graph" or 
@ref SFM::Utilities::generateDotFile "export it as a dot file" to be visualized (for example) with the neato tool from the Graphviz package.


The bundle adjustment implementation is isolated from the @ref SFM::SFM class. The @ref SFM::SFM class accesses
the bundle adjustment via the @ref SFM::BundleAdjustment typedef which can be used to switch between different
bundle adjustment implementations at compilation time. The central class of the bundle adjustment implementation
is the @ref SFM::PFBundleAdjustment::PFBundleAdjustment class. It holds a complete duplicate of all relevant entities
(camera, tracks observation), at least of those that participate in bundle adjustment. The bundle adjustment implementation
is heavily templated to facilitate the addition of new camera and distortion models. See the @ref SFM::PFBundleAdjustment::detail
namespace for more details, specifically the @ref SFM::PFBundleAdjustment::detail::BAState class.
Note that the bundle adjustment implementation is unaware of the fact that it performs Subset Bundle Adjustment. It only sees tracks and observations
getting added and removed. The actual implementation behind the subset selection of Subset Bundle Adjustment is in the @ref SFM::SFM and @ref SFM::Frame classes.

@section SFMBackend_Build How to Build the SFM Backend

In addition to a Code::Blocks project file, a Makefile is supplied which can be invoked like this:
@code{.unparsed}
$ cd code/SFMBackend
$ make release -j 8
@endcode
Note that building the @ref Page_CommandLineFrontend "command line frontend" also triggers the build of the %SFM Backend.

@defgroup SFMBackend_Group SFM Backend
@brief Functions and classes that somehow relate to the structure from motion pipeline. See @ref Page_SFMBackend "here" for more information.

@namespace SFM
@brief Contains all the classes and functions that somehow relate to the structure from motion pipeline. See @ref Page_SFMBackend "here" for more information.
@ingroup SFMBackend_Group


*/
