OpenCV 4.5.3(日本語機械翻訳)
mapper.hpp
1 /*M///////////////////////////////////////////////////////////////////////////////////////
2 //
3 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4 //
5 // By downloading, copying, installing or using the software you agree to this license.
6 // If you do not agree to this license, do not download, install,
7 // copy or use the software.
8 //
9 // Copyright (C) 2013, Alfonso Sanchez-Beato, all rights reserved.
10 // Third party copyrights are property of their respective owners.
11 //
12 // Redistribution and use in source and binary forms, with or without modification,
13 // are permitted provided that the following conditions are met:
14 //
15 // * Redistribution's of source code must retain the above copyright notice,
16 // this list of conditions and the following disclaimer.
17 //
18 // * Redistribution's in binary form must reproduce the above copyright notice,
19 // this list of conditions and the following disclaimer in the documentation
20 // and/or other materials provided with the distribution.
21 //
22 // * The name of the copyright holders may not be used to endorse or promote products
23 // derived from this software without specific prior written permission.
24 //
25 // This software is provided by the copyright holders and contributors "as is" and
26 // any express or implied warranties, including, but not limited to, the implied
27 // warranties of merchantability and fitness for a particular purpose are disclaimed.
28 // In no event shall the contributors be liable for any direct,
29 // indirect, incidental, special, exemplary, or consequential damages
30 // (including, but not limited to, procurement of substitute goods or services;
31 // loss of use, data, or profits; or business interruption) however caused
32 // and on any theory of liability, whether in contract, strict liability,
33 // or tort (including negligence or otherwise) arising in any way out of
34 // the use of this software, even if advised of the possibility of such damage.
35 //
36 //M*/
37
38 #ifndef MAPPER_H_
39 #define MAPPER_H_
40
41 #include <opencv2/core.hpp> // Basic OpenCV structures (cv::Mat, Scalar)
42 #include "map.hpp"
43
44 namespace cv {
45 namespace reg {
46
49
54 class CV_EXPORTS_W Mapper
55{
56 public:
57 virtual ~Mapper(void) {}
58
59 /*
60 * Calculate mapping between two images
61 * \param[in] img1 Reference image
62 * \param[in] img2 Warped image
63 * \param[in] If present, it is an initial rough estimation that the mapper will try to refine.
64 * \return Map from img1 to img2, stored in a smart pointer.
65 */
66 CV_WRAP virtual cv::Ptr<Map> calculate(InputArray img1, InputArray img2, cv::Ptr<Map> init = cv::Ptr<Map>()) const = 0;
67
68 /*
69 * Returns a map compatible with the Mapper class
70 * \return Pointer to identity Map
71 */
72 CV_WRAP virtual cv::Ptr<Map> getMap() const = 0;
73
74 protected:
75 /*
76 * Calculates gradient and difference between images
77 * \param[in] img1 Image one
78 * \param[in] img2 Image two
79 * \param[out] Ix Gradient x-coordinate
80 * \param[out] Iy Gradient y-coordinate
81 * \param[out] It Difference of images
82 */
83 void gradient(const cv::Mat& img1, const cv::Mat& img2,
84 cv::Mat& Ix, cv::Mat& Iy, cv::Mat& It) const;
85
86 /*
87 * Fills matrices with pixel coordinates of an image
88 * \param[in] img Image
89 * \param[out] grid_r Row (y-coordinate)
90 * \param[out] grid_c Column (x-coordinate)
91 */
92 void grid(const Mat& img, Mat& grid_r, Mat& grid_c) const;
93
94 /*
95 * Per-element square of a matrix
96 * \param[in] mat1 Input matrix
97 * \return mat1[i,j]^2
98 */
99 cv::Mat sqr(const cv::Mat& mat1) const
100 {
101 cv::Mat res;
102 res.create(mat1.size(), mat1.type());
103 res = mat1.mul(mat1);
104 return res;
105 }
106};
107
109
110}} // namespace cv::reg
111
112 #endif // MAPPER_H_
113
n-dimensional dense array class
Definition: mat.hpp:802
MatExpr mul(InputArray m, double scale=1) const
Performs an element-wise multiplication or division of the two matrices.
void create(int rows, int cols, int type)
Allocates new array data if needed.
int type() const
Returns the type of a matrix element.
Base class for modelling an algorithm for calculating a map
Definition: mapper.hpp:55
cv
"black box" representation of the file storage associated with a file on disk.
Definition: aruco.hpp:75
Definition: cvstd_wrapper.hpp:74