43#ifndef OPENCV_STITCHING_MOTION_ESTIMATORS_HPP 
   44#define OPENCV_STITCHING_MOTION_ESTIMATORS_HPP 
   46#include "opencv2/core.hpp" 
   47#include "matchers.hpp" 
   77    CV_WRAP_AS(apply) 
bool operator ()(
const std::vector<ImageFeatures> &features,
 
   78        const std::vector<MatchesInfo> &pairwise_matches,
 
   79        CV_OUT CV_IN_OUT std::vector<CameraParams> &cameras)
 
   81        return estimate(features, pairwise_matches, cameras);
 
   93    virtual bool estimate(
const std::vector<ImageFeatures> &features,
 
   94                          const std::vector<MatchesInfo> &pairwise_matches,
 
   95                          CV_OUT std::vector<CameraParams> &cameras) = 0;
 
  104        : is_focals_estimated_(is_focals_estimated) {}
 
  107    virtual bool estimate(
const std::vector<ImageFeatures> &features,
 
  108                          const std::vector<MatchesInfo> &pairwise_matches,
 
  109                          std::vector<CameraParams> &cameras) CV_OVERRIDE;
 
  111    bool is_focals_estimated_;
 
  126    virtual bool estimate(
const std::vector<ImageFeatures> &features,
 
  127                          const std::vector<MatchesInfo> &pairwise_matches,
 
  128                          std::vector<CameraParams> &cameras) CV_OVERRIDE;
 
  136    CV_WRAP 
const Mat refinementMask()
 const { 
return refinement_mask_.
clone(); }
 
  137    CV_WRAP 
void setRefinementMask(
const Mat &mask)
 
  139        CV_Assert(mask.type() == CV_8U && mask.size() == 
Size(3, 3));
 
  140        refinement_mask_ = mask.clone();
 
  143    CV_WRAP 
double confThresh()
 const { 
return conf_thresh_; }
 
  144    CV_WRAP 
void setConfThresh(
double conf_thresh) { conf_thresh_ = conf_thresh; }
 
  146    CV_WRAP 
TermCriteria termCriteria() { 
return term_criteria_; }
 
  147    CV_WRAP 
void setTermCriteria(
const TermCriteria& term_criteria) { term_criteria_ = term_criteria; }
 
  156        : num_images_(0), total_num_matches_(0),
 
  157          num_params_per_cam_(num_params_per_cam),
 
  158          num_errs_per_measurement_(num_errs_per_measurement),
 
  159          features_(0), pairwise_matches_(0), conf_thresh_(0)
 
  161        setRefinementMask(
Mat::ones(3, 3, CV_8U));
 
  167    virtual bool estimate(
const std::vector<ImageFeatures> &features,
 
  168                          const std::vector<MatchesInfo> &pairwise_matches,
 
  169                          std::vector<CameraParams> &cameras) CV_OVERRIDE;
 
  194    Mat refinement_mask_;
 
  197    int total_num_matches_;
 
  199    int num_params_per_cam_;
 
  200    int num_errs_per_measurement_;
 
  215    std::vector<std::pair<int,int> > edges_;
 
  227    bool estimate(
const std::vector<ImageFeatures> &, 
const std::vector<MatchesInfo> &,
 
  228                  std::vector<CameraParams> &) CV_OVERRIDE
 
  232    void setUpInitialCameraParams(
const std::vector<CameraParams> &) CV_OVERRIDE {}
 
  233    void obtainRefinedCameraParams(std::vector<CameraParams> &) 
const CV_OVERRIDE {}
 
  234    void calcError(
Mat &) CV_OVERRIDE {}
 
  235    void calcJacobian(
Mat &) CV_OVERRIDE {}
 
  251    void setUpInitialCameraParams(
const std::vector<CameraParams> &cameras) CV_OVERRIDE;
 
  252    void obtainRefinedCameraParams(std::vector<CameraParams> &cameras) 
const CV_OVERRIDE;
 
  253    void calcError(
Mat &err) CV_OVERRIDE;
 
  254    void calcJacobian(
Mat &jac) CV_OVERRIDE;
 
  271    void setUpInitialCameraParams(
const std::vector<CameraParams> &cameras) CV_OVERRIDE;
 
  272    void obtainRefinedCameraParams(std::vector<CameraParams> &cameras) 
const CV_OVERRIDE;
 
  273    void calcError(
Mat &err) CV_OVERRIDE;
 
  274    void calcJacobian(
Mat &jac) CV_OVERRIDE;
 
  295    void setUpInitialCameraParams(
const std::vector<CameraParams> &cameras) CV_OVERRIDE;
 
  296    void obtainRefinedCameraParams(std::vector<CameraParams> &cameras) 
const CV_OVERRIDE;
 
  297    void calcError(
Mat &err) CV_OVERRIDE;
 
  298    void calcJacobian(
Mat &jac) CV_OVERRIDE;
 
  319    void setUpInitialCameraParams(
const std::vector<CameraParams> &cameras) CV_OVERRIDE;
 
  320    void obtainRefinedCameraParams(std::vector<CameraParams> &cameras) 
const CV_OVERRIDE;
 
  321    void calcError(
Mat &err) CV_OVERRIDE;
 
  322    void calcJacobian(
Mat &jac) CV_OVERRIDE;
 
  349void CV_EXPORTS_W 
waveCorrect(CV_IN_OUT std::vector<Mat> &rmats, WaveCorrectKind kind);
 
  356String CV_EXPORTS_W matchesGraphAsString(std::vector<String> &pathes, std::vector<MatchesInfo> &pairwise_matches,
 
  357                                            float conf_threshold);
 
  359CV_EXPORTS_W std::vector<int>  leaveBiggestComponent(
 
  360        std::vector<ImageFeatures> &features,
 
  361        std::vector<MatchesInfo> &pairwise_matches,
 
  362        float conf_threshold);
 
  364void CV_EXPORTS findMaxSpanningTree(
 
  365        int num_images, 
const std::vector<MatchesInfo> &pairwise_matches,
 
  366        Graph &span_tree, std::vector<int> ¢ers);
 
n-dimensional dense array class
Definition: mat.hpp:802
 
static MatExpr ones(int rows, int cols, int type)
Returns an array of all 1's of the specified size and type.
 
Mat clone() const CV_NODISCARD
Creates a full copy of the array and the underlying data.
 
Template class for specifying the size of an image or rectangle.
Definition: core/types.hpp:316
 
The class defining termination criteria for iterative algorithms.
Definition: core/types.hpp:853
 
@ EPS
the desired accuracy or change in parameters at which the iterative algorithm stops
Definition: core/types.hpp:862
 
@ COUNT
the maximum number of iterations or elements to compute
Definition: core/types.hpp:860
 
Affine transformation based estimator.
Definition: motion_estimators.hpp:122
 
Bundle adjuster that expects affine transformation represented in homogeneous coordinates in R for ea...
Definition: motion_estimators.hpp:290
 
Bundle adjuster that expects affine transformation with 4 DOF represented in homogeneous coordinates ...
Definition: motion_estimators.hpp:314
 
Base class for all camera parameters refinement methods.
Definition: motion_estimators.hpp:134
 
virtual void calcJacobian(Mat &jac)=0
Calculates the cost function jacobian.
 
BundleAdjusterBase(int num_params_per_cam, int num_errs_per_measurement)
Construct a bundle adjuster base instance.
Definition: motion_estimators.hpp:155
 
virtual void setUpInitialCameraParams(const std::vector< CameraParams > &cameras)=0
Sets initial camera parameter to refine.
 
virtual void calcError(Mat &err)=0
Calculates error vector.
 
virtual void obtainRefinedCameraParams(std::vector< CameraParams > &cameras) const =0
Gets the refined camera parameters.
 
Implementation of the camera parameters refinement algorithm which minimizes sum of the distances bet...
Definition: motion_estimators.hpp:266
 
Implementation of the camera parameters refinement algorithm which minimizes sum of the reprojection ...
Definition: motion_estimators.hpp:246
 
Rotation estimator base class.
Definition: motion_estimators.hpp:66
 
virtual bool estimate(const std::vector< ImageFeatures > &features, const std::vector< MatchesInfo > &pairwise_matches, CV_OUT std::vector< CameraParams > &cameras)=0
This method must implement camera parameters estimation logic in order to make the wrapper detail::Es...
 
CV_WRAP_AS(apply) bool operator()(const std
Estimates camera parameters.
Definition: motion_estimators.hpp:77
 
Homography based rotation estimator.
Definition: motion_estimators.hpp:101
 
Stub bundle adjuster that does nothing.
Definition: motion_estimators.hpp:222
 
#define CV_Assert(expr)
Checks a condition at runtime and throws exception if it fails
Definition: base.hpp:342
 
CV_EXPORTS WaveCorrectKind autoDetectWaveCorrectKind(const std::vector< Mat > &rmats)
Tries to detect the wave correction kind depending on whether a panorama spans horizontally or vertic...
 
void CV_EXPORTS_W waveCorrect(CV_IN_OUT std::vector< Mat > &rmats, WaveCorrectKind kind)
Tries to make panorama more horizontal (or vertical).
 
"black box" representation of the file storage associated with a file on disk.
Definition: aruco.hpp:75
 
Structure containing image keypoints and descriptors.
Definition: matchers.hpp:59
 
Structure containing information about matches between two images.
Definition: matchers.hpp:100