File: high_level.rst

package info (click to toggle)
opencv 2.4.9.1%2Bdfsg-1%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 126,800 kB
  • ctags: 62,729
  • sloc: xml: 509,055; cpp: 490,794; lisp: 23,208; python: 21,174; java: 19,317; ansic: 1,038; sh: 128; makefile: 72
file content (210 lines) | stat: -rw-r--r-- 7,726 bytes parent folder | download | duplicates (3)
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
High Level Functionality
========================

.. highlight:: cpp

Stitcher
--------
.. ocv:class:: Stitcher

High level image stitcher. It's possible to use this class without being aware of the entire stitching pipeline. However, to be able to achieve higher stitching stability and quality of the final images at least being familiar with the theory is recommended (see :ref:`stitching-pipeline`). ::

    class CV_EXPORTS Stitcher
    {
    public:
        enum { ORIG_RESOL = -1 };
        enum Status { OK, ERR_NEED_MORE_IMGS };

        // Creates stitcher with default parameters
        static Stitcher createDefault(bool try_use_gpu = false);

        Status estimateTransform(InputArray images);
        Status estimateTransform(InputArray images, const std::vector<std::vector<Rect> > &rois);

        Status composePanorama(OutputArray pano);
        Status composePanorama(InputArray images, OutputArray pano);

        Status stitch(InputArray images, OutputArray pano);
        Status stitch(InputArray images, const std::vector<std::vector<Rect> > &rois, OutputArray pano);

        double registrationResol() const { return registr_resol_; }
        void setRegistrationResol(double resol_mpx) { registr_resol_ = resol_mpx; }

        double seamEstimationResol() const { return seam_est_resol_; }
        void setSeamEstimationResol(double resol_mpx) { seam_est_resol_ = resol_mpx; }

        double compositingResol() const { return compose_resol_; }
        void setCompositingResol(double resol_mpx) { compose_resol_ = resol_mpx; }

        double panoConfidenceThresh() const { return conf_thresh_; }
        void setPanoConfidenceThresh(double conf_thresh) { conf_thresh_ = conf_thresh; }

        bool waveCorrection() const { return do_wave_correct_; }
        void setWaveCorrection(bool flag) { do_wave_correct_ = flag; }

        detail::WaveCorrectKind waveCorrectKind() const { return wave_correct_kind_; }
        void setWaveCorrectKind(detail::WaveCorrectKind kind) { wave_correct_kind_ = kind; }

        Ptr<detail::FeaturesFinder> featuresFinder() { return features_finder_; }
        const Ptr<detail::FeaturesFinder> featuresFinder() const { return features_finder_; }
        void setFeaturesFinder(Ptr<detail::FeaturesFinder> features_finder)
            { features_finder_ = features_finder; }

        Ptr<detail::FeaturesMatcher> featuresMatcher() { return features_matcher_; }
        const Ptr<detail::FeaturesMatcher> featuresMatcher() const { return features_matcher_; }
        void setFeaturesMatcher(Ptr<detail::FeaturesMatcher> features_matcher)
            { features_matcher_ = features_matcher; }

        const cv::Mat& matchingMask() const { return matching_mask_; }
        void setMatchingMask(const cv::Mat &mask)
        {
            CV_Assert(mask.type() == CV_8U && mask.cols == mask.rows);
            matching_mask_ = mask.clone();
        }

        Ptr<detail::BundleAdjusterBase> bundleAdjuster() { return bundle_adjuster_; }
        const Ptr<detail::BundleAdjusterBase> bundleAdjuster() const { return bundle_adjuster_; }
        void setBundleAdjuster(Ptr<detail::BundleAdjusterBase> bundle_adjuster)
            { bundle_adjuster_ = bundle_adjuster; }

        Ptr<WarperCreator> warper() { return warper_; }
        const Ptr<WarperCreator> warper() const { return warper_; }
        void setWarper(Ptr<WarperCreator> warper) { warper_ = warper; }

        Ptr<detail::ExposureCompensator> exposureCompensator() { return exposure_comp_; }
        const Ptr<detail::ExposureCompensator> exposureCompensator() const { return exposure_comp_; }
        void setExposureCompensator(Ptr<detail::ExposureCompensator> exposure_comp)
            { exposure_comp_ = exposure_comp; }

        Ptr<detail::SeamFinder> seamFinder() { return seam_finder_; }
        const Ptr<detail::SeamFinder> seamFinder() const { return seam_finder_; }
        void setSeamFinder(Ptr<detail::SeamFinder> seam_finder) { seam_finder_ = seam_finder; }

        Ptr<detail::Blender> blender() { return blender_; }
        const Ptr<detail::Blender> blender() const { return blender_; }
        void setBlender(Ptr<detail::Blender> blender) { blender_ = blender; }

    private:
        /* hidden */
    };

.. note::

   * A basic example on image stitching can be found at opencv_source_code/samples/cpp/stitching.cpp
   * A detailed example on image stitching can be found at opencv_source_code/samples/cpp/stitching_detailed.cpp

Stitcher::createDefault
-----------------------
Creates a stitcher with the default parameters.

.. ocv:function:: Stitcher Stitcher::createDefault(bool try_use_gpu = false)

    :param try_use_gpu: Flag indicating whether GPU should be used whenever it's possible.

    :return: Stitcher class instance.

Stitcher::estimateTransform
---------------------------

These functions try to match the given images and to estimate rotations of each camera.

.. note:: Use the functions only if you're aware of the stitching pipeline, otherwise use :ocv:func:`Stitcher::stitch`.

.. ocv:function:: Status Stitcher::estimateTransform(InputArray images)

.. ocv:function:: Status Stitcher::estimateTransform(InputArray images, const std::vector<std::vector<Rect> > &rois)

    :param images: Input images.

    :param rois: Region of interest rectangles.

    :return: Status code.

Stitcher::composePanorama
-------------------------

These functions try to compose the given images (or images stored internally from the other function calls) into the final pano under the assumption that the image transformations were estimated before.

.. note:: Use the functions only if you're aware of the stitching pipeline, otherwise use :ocv:func:`Stitcher::stitch`.

.. ocv:function:: Status Stitcher::composePanorama(OutputArray pano)

.. ocv:function:: Status Stitcher::composePanorama(InputArray images, OutputArray pano)

    :param images: Input images.

    :param pano: Final pano.

    :return: Status code.

Stitcher::stitch
----------------

These functions try to stitch the given images.

.. ocv:function:: Status Stitcher::stitch(InputArray images, OutputArray pano)

.. ocv:function:: Status Stitcher::stitch(InputArray images, const std::vector<std::vector<Rect> > &rois, OutputArray pano)

    :param images: Input images.

    :param rois: Region of interest rectangles.

    :param pano: Final pano.

    :return: Status code.

WarperCreator
-------------
.. ocv:class:: WarperCreator

Image warper factories base class. ::

    class WarperCreator
    {
    public:
        virtual ~WarperCreator() {}
        virtual Ptr<detail::RotationWarper> create(float scale) const = 0;
    };

PlaneWarper
-----------
.. ocv:class:: PlaneWarper : public WarperCreator

Plane warper factory class. ::

    class PlaneWarper : public WarperCreator
    {
    public:
        Ptr<detail::RotationWarper> create(float scale) const { return new detail::PlaneWarper(scale); }
    };

.. seealso:: :ocv:class:`detail::PlaneWarper`

CylindricalWarper
-----------------
.. ocv:class:: CylindricalWarper : public WarperCreator

Cylindrical warper factory class. ::

    class CylindricalWarper: public WarperCreator
    {
    public:
        Ptr<detail::RotationWarper> create(float scale) const { return new detail::CylindricalWarper(scale); }
    };

.. seealso:: :ocv:class:`detail::CylindricalWarper`

SphericalWarper
---------------
.. ocv:class:: SphericalWarper : public WarperCreator

Spherical warper factory class. ::

    class SphericalWarper: public WarperCreator
    {
    public:
        Ptr<detail::RotationWarper> create(float scale) const { return new detail::SphericalWarper(scale); }
    };

.. seealso:: :ocv:class:`detail::SphericalWarper`