seam_estimation.rst 3.67 KB
Newer Older
wester committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
Seam Estimation
===============

.. highlight:: cpp

detail::SeamFinder
------------------
.. ocv:class:: detail::SeamFinder

Base class for a seam estimator. ::

    class CV_EXPORTS SeamFinder
    {
    public:
        virtual ~SeamFinder() {}
        virtual void find(const std::vector<Mat> &src, const std::vector<Point> &corners,
                          std::vector<Mat> &masks) = 0;
    };

detail::SeamFinder::find
------------------------

Estimates seams.

.. ocv:function:: void detail::SeamFinder::find(const std::vector<Mat> &src, const std::vector<Point> &corners, std::vector<Mat> &masks)

    :param src: Source images

    :param corners: Source image top-left corners

    :param masks: Source image masks to update


detail::NoSeamFinder
--------------------
.. ocv:class:: detail::NoSeamFinder : public detail::SeamFinder

Stub seam estimator which does nothing. ::

    class CV_EXPORTS NoSeamFinder : public SeamFinder
    {
    public:
        void find(const std::vector<Mat>&, const std::vector<Point>&, std::vector<Mat>&) {}
    };

.. seealso:: :ocv:class:`detail::SeamFinder`

detail::PairwiseSeamFinder
--------------------------
.. ocv:class:: detail::PairwiseSeamFinder : public detail::SeamFinder

Base class for all pairwise seam estimators. ::

    class CV_EXPORTS PairwiseSeamFinder : public SeamFinder
    {
    public:
        virtual void find(const std::vector<Mat> &src, const std::vector<Point> &corners,
                          std::vector<Mat> &masks);

    protected:
        void run();
        virtual void findInPair(size_t first, size_t second, Rect roi) = 0;

        std::vector<Mat> images_;
        std::vector<Size> sizes_;
        std::vector<Point> corners_;
        std::vector<Mat> masks_;
    };

.. seealso:: :ocv:class:`detail::SeamFinder`

detail::PairwiseSeamFinder::findInPair
--------------------------------------

Resolves masks intersection of two specified images in the given ROI.

.. ocv:function:: void detail::PairwiseSeamFinder::findInPair(size_t first, size_t second, Rect roi)

    :param first: First image index

    :param second: Second image index

    :param roi: Region of interest

detail::VoronoiSeamFinder
-------------------------
.. ocv:class:: detail::VoronoiSeamFinder : public detail::PairwiseSeamFinder

Voronoi diagram-based seam estimator. ::

    class CV_EXPORTS VoronoiSeamFinder : public PairwiseSeamFinder
    {
    public:
        virtual void find(const std::vector<Size> &size, const std::vector<Point> &corners,
                          std::vector<Mat> &masks);
    private:
        void findInPair(size_t first, size_t second, Rect roi);
    };

.. seealso:: :ocv:class:`detail::PairwiseSeamFinder`

detail::GraphCutSeamFinderBase
------------------------------
.. ocv:class:: detail::GraphCutSeamFinderBase

Base class for all minimum graph-cut-based seam estimators. ::

    class CV_EXPORTS GraphCutSeamFinderBase
    {
    public:
        enum { COST_COLOR, COST_COLOR_GRAD };
    };

detail::GraphCutSeamFinder
--------------------------
.. ocv:class:: detail::GraphCutSeamFinder : public detail::GraphCutSeamFinderBase, public detail::SeamFinder

Minimum graph cut-based seam estimator. See details in [V03]_. ::

    class CV_EXPORTS GraphCutSeamFinder : public GraphCutSeamFinderBase, public SeamFinder
    {
    public:
        GraphCutSeamFinder(int cost_type = COST_COLOR_GRAD, float terminal_cost = 10000.f,
                           float bad_region_penalty = 1000.f);

        void find(const std::vector<Mat> &src, const std::vector<Point> &corners,
                  std::vector<Mat> &masks);

    private:
        /* hidden */
    };

.. seealso::
    :ocv:class:`detail::GraphCutSeamFinderBase`,
    :ocv:class:`detail::SeamFinder`