class cv::detail::BundleAdjusterBase

Overview

Base class for all camera parameters refinement methods. Moreā€¦

#include <motion_estimators.hpp>

class BundleAdjusterBase: public cv::detail::Estimator
{
public:
    // methods

    double
    confThresh() const;

    const Mat
    refinementMask() const;

    void
    setConfThresh(double conf_thresh);

    void
    setRefinementMask(const Mat& mask);

    void
    setTermCriteria(const TermCriteria& term_criteria);

    TermCriteria
    termCriteria();

protected:
    // fields

    Mat cam_params_;
    double conf_thresh_;
    std::vector<std::pair<int, int>> edges_;
    const ImageFeatures* features_;
    int num_errs_per_measurement_;
    int num_images_;
    int num_params_per_cam_;
    const MatchesInfo* pairwise_matches_;
    Mat refinement_mask_;
    TermCriteria term_criteria_;
    int total_num_matches_;

    // construction

    BundleAdjusterBase(
        int num_params_per_cam,
        int num_errs_per_measurement
        );

    // methods

    virtual
    void
    calcError(Mat& err) = 0;

    virtual
    void
    calcJacobian(Mat& jac) = 0;

    virtual
    bool
    estimate(
        const std::vector<ImageFeatures>& features,
        const std::vector<MatchesInfo>& pairwise_matches,
        std::vector<CameraParams>& cameras
        );

    virtual
    void
    obtainRefinedCameraParams(std::vector<CameraParams>& cameras) const = 0;

    virtual
    void
    setUpInitialCameraParams(const std::vector<CameraParams>& cameras) = 0;
};

// direct descendants

class BundleAdjusterAffine;
class BundleAdjusterAffinePartial;
class BundleAdjusterRay;
class BundleAdjusterReproj;
class NoBundleAdjuster;

Inherited Members

public:
    // methods

    bool
    operator()(
        const std::vector<ImageFeatures>& features,
        const std::vector<MatchesInfo>& pairwise_matches,
        std::vector<CameraParams>& cameras
        );

protected:
    // methods

    virtual
    bool
    estimate(
        const std::vector<ImageFeatures>& features,
        const std::vector<MatchesInfo>& pairwise_matches,
        std::vector<CameraParams>& cameras
        ) = 0;

Detailed Documentation

Base class for all camera parameters refinement methods.

Construction

BundleAdjusterBase(
    int num_params_per_cam,
    int num_errs_per_measurement
    )

Construct a bundle adjuster base instance.

Parameters:

num_params_per_cam Number of parameters per camera
num_errs_per_measurement Number of error terms (components) per match

Methods

virtual
void
calcError(Mat& err) = 0

Calculates error vector.

Parameters:

err Error column-vector of length total_num_matches * num_errs_per_measurement
virtual
void
calcJacobian(Mat& jac) = 0

Calculates the cost function jacobian.

Parameters:

jac Jacobian matrix of dimensions (total_num_matches * num_errs_per_measurement) x (num_images * num_params_per_cam)
virtual
bool
estimate(
    const std::vector<ImageFeatures>& features,
    const std::vector<MatchesInfo>& pairwise_matches,
    std::vector<CameraParams>& cameras
    )

This method must implement camera parameters estimation logic in order to make the wrapper detail::Estimator::operator()_ work.

Parameters:

features Features of images
pairwise_matches Pairwise matches of images
cameras Estimated camera parameters

Returns:

True in case of success, false otherwise

virtual
void
obtainRefinedCameraParams(std::vector<CameraParams>& cameras) const = 0

Gets the refined camera parameters.

Parameters:

cameras Refined camera parameters
virtual
void
setUpInitialCameraParams(const std::vector<CameraParams>& cameras) = 0

Sets initial camera parameter to refine.

Parameters:

cameras Camera parameters