43#ifndef OPENCV_STITCHING_SEAM_FINDERS_HPP 
   44#define OPENCV_STITCHING_SEAM_FINDERS_HPP 
   47#include "opencv2/core.hpp" 
   48#include "opencv2/opencv_modules.hpp" 
   62    enum { NO, VORONOI_SEAM, DP_SEAM };
 
   69    CV_WRAP 
virtual void find(
const std::vector<UMat> &src, 
const std::vector<Point> &corners,
 
   70                      CV_IN_OUT std::vector<UMat> &masks) = 0;
 
   79    CV_WRAP 
void find(
const std::vector<UMat>&, 
const std::vector<Point>&, CV_IN_OUT std::vector<UMat>&) CV_OVERRIDE {}
 
   87    CV_WRAP 
virtual void find(
const std::vector<UMat> &src, 
const std::vector<Point> &corners,
 
   88                      CV_IN_OUT std::vector<UMat> &masks) CV_OVERRIDE;
 
  100    std::vector<UMat> images_;
 
  101    std::vector<Size> sizes_;
 
  102    std::vector<Point> corners_;
 
  103    std::vector<UMat> masks_;
 
  111    CV_WRAP 
virtual void find(
const std::vector<UMat> &src, 
const std::vector<Point> &corners,
 
  112                      CV_IN_OUT std::vector<UMat> &masks) CV_OVERRIDE;
 
  113    virtual void find(
const std::vector<Size> &size, 
const std::vector<Point> &corners,
 
  114                      std::vector<UMat> &masks);
 
  116    void findInPair(
size_t first, 
size_t second, 
Rect roi) CV_OVERRIDE;
 
  123    enum CostFunction { COLOR, COLOR_GRAD };
 
  128    CostFunction costFunction()
 const { 
return costFunc_; }
 
  129    void setCostFunction(CostFunction val) { costFunc_ = val; }
 
  130    CV_WRAP 
void setCostFunction(String val);
 
  132    virtual void find(
const std::vector<UMat> &src, 
const std::vector<Point> &corners,
 
  133                      std::vector<UMat> &masks) CV_OVERRIDE;
 
  138        FIRST = 1, SECOND = 2, INTERS = 4,
 
  139        INTERS_FIRST = INTERS | FIRST,
 
  140        INTERS_SECOND = INTERS | SECOND
 
  146        ImagePairLess(
const std::vector<Mat> &images, 
const std::vector<Point> &corners)
 
  147            : src_(&images[0]), corners_(&corners[0]) {}
 
  149        bool operator() (
const std::pair<size_t, size_t> &l, 
const std::pair<size_t, size_t> &r)
 const 
  151            Point c1 = corners_[l.first] + 
Point(src_[l.first].cols / 2, src_[l.first].rows / 2);
 
  152            Point c2 = corners_[l.second] + 
Point(src_[l.second].cols / 2, src_[l.second].rows / 2);
 
  153            int d1 = (c1 - c2).dot(c1 - c2);
 
  155            c1 = corners_[r.first] + 
Point(src_[r.first].cols / 2, src_[r.first].rows / 2);
 
  156            c2 = corners_[r.second] + 
Point(src_[r.second].cols / 2, src_[r.second].rows / 2);
 
  157            int d2 = (c1 - c2).dot(c1 - c2);
 
  164        const Point *corners_;
 
  170        ClosePoints(
int minDist) : minDist_(minDist) {}
 
  172        bool operator() (
const Point &p1, 
const Point &p2)
 const 
  174            int dist2 = (p1.
x-p2.
x) * (p1.
x-p2.
x) + (p1.
y-p2.
y) * (p1.
y-p2.
y);
 
  175            return dist2 < minDist_ * minDist_;
 
  185    void findComponents();
 
  189    void resolveConflicts(
 
  192    void computeGradients(
const Mat &image1, 
const Mat &image2);
 
  194    bool hasOnlyOneNeighbor(
int comp);
 
  196    bool closeToContour(
int y, 
int x, 
const Mat_<uchar> &contourMask);
 
  198    bool getSeamTips(
int comp1, 
int comp2, 
Point &p1, 
Point &p2);
 
  206            Point p1, 
Point p2, std::vector<Point> &seam, 
bool &isHorizontal);
 
  208    void updateLabelsUsingSeam(
 
  209            int comp1, 
int comp2, 
const std::vector<Point> &seam, 
bool isHorizontalSeam);
 
  211    CostFunction costFunc_;
 
  214    Point unionTl_, unionBr_;
 
  224    std::vector<ComponentState> states_;
 
  225    std::vector<Point> tls_, brs_;
 
  226    std::vector<std::vector<Point> > contours_;
 
  227    std::set<std::pair<int, int> > edges_;
 
  235    enum CostType { COST_COLOR, COST_COLOR_GRAD };
 
  244                       float bad_region_penalty = 1000.f);
 
  246        float bad_region_penalty = 1000.f);
 
  250    CV_WRAP 
void find(
const std::vector<UMat> &src, 
const std::vector<Point> &corners,
 
  251              std::vector<UMat> &masks) CV_OVERRIDE;
 
  260#ifdef HAVE_OPENCV_CUDALEGACY 
  264    GraphCutSeamFinderGpu(
int cost_type = COST_COLOR_GRAD, 
float terminal_cost = 10000.f,
 
  265                          float bad_region_penalty = 1000.f)
 
  266                          : cost_type_(cost_type), terminal_cost_(terminal_cost),
 
  267                            bad_region_penalty_(bad_region_penalty) {}
 
  269    void find(
const std::vector<cv::UMat> &src, 
const std::vector<cv::Point> &corners,
 
  270              std::vector<cv::UMat> &masks) CV_OVERRIDE;
 
  271    void findInPair(
size_t first, 
size_t second, 
Rect roi) CV_OVERRIDE;
 
  279    std::vector<Mat> dx_, dy_;
 
  281    float terminal_cost_;
 
  282    float bad_region_penalty_;
 
Template matrix class derived from Mat
Definition: mat.hpp:2199
 
n-dimensional dense array class
Definition: mat.hpp:802
 
_Tp y
y coordinate of the point
Definition: core/types.hpp:187
 
_Tp x
x coordinate of the point
Definition: core/types.hpp:186
 
Template class for 2D rectangles
Definition: core/types.hpp:421
 
Template class for specifying the size of an image or rectangle.
Definition: core/types.hpp:316
 
Definition: seam_finders.hpp:121
 
Base class for all minimum graph-cut-based seam estimators.
Definition: seam_finders.hpp:233
 
Minimum graph cut-based seam estimator. See details in  .
Definition: seam_finders.hpp:241
 
Stub seam estimator which does nothing.
Definition: seam_finders.hpp:77
 
Base class for all pairwise seam estimators.
Definition: seam_finders.hpp:85
 
virtual void findInPair(size_t first, size_t second, Rect roi)=0
Resolves masks intersection of two specified images in the given ROI.
 
Base class for a seam estimator.
Definition: seam_finders.hpp:59
 
Voronoi diagram-based seam estimator.
Definition: seam_finders.hpp:109
 
"black box" representation of the file storage associated with a file on disk.
Definition: aruco.hpp:75
 
Definition: cvstd_wrapper.hpp:74