summaryrefslogtreecommitdiff
path: root/thirdparty/linux/include/opencv2/reg
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/linux/include/opencv2/reg')
-rw-r--r--thirdparty/linux/include/opencv2/reg/map.hpp175
-rw-r--r--thirdparty/linux/include/opencv2/reg/mapaffine.hpp105
-rw-r--r--thirdparty/linux/include/opencv2/reg/mapper.hpp113
-rw-r--r--thirdparty/linux/include/opencv2/reg/mappergradaffine.hpp67
-rw-r--r--thirdparty/linux/include/opencv2/reg/mappergradeuclid.hpp67
-rw-r--r--thirdparty/linux/include/opencv2/reg/mappergradproj.hpp67
-rw-r--r--thirdparty/linux/include/opencv2/reg/mappergradshift.hpp67
-rw-r--r--thirdparty/linux/include/opencv2/reg/mappergradsimilar.hpp67
-rw-r--r--thirdparty/linux/include/opencv2/reg/mapperpyramid.hpp78
-rw-r--r--thirdparty/linux/include/opencv2/reg/mapprojec.hpp105
-rw-r--r--thirdparty/linux/include/opencv2/reg/mapshift.hpp96
11 files changed, 1007 insertions, 0 deletions
diff --git a/thirdparty/linux/include/opencv2/reg/map.hpp b/thirdparty/linux/include/opencv2/reg/map.hpp
new file mode 100644
index 0000000..26b29e3
--- /dev/null
+++ b/thirdparty/linux/include/opencv2/reg/map.hpp
@@ -0,0 +1,175 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+// By downloading, copying, installing or using the software you agree to this license.
+// If you do not agree to this license, do not download, install,
+// copy or use the software.
+//
+// Copyright (C) 2013, Alfonso Sanchez-Beato, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// are permitted provided that the following conditions are met:
+//
+// * Redistribution's of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// * Redistribution's in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// * The name of the copyright holders may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// This software is provided by the copyright holders and contributors "as is" and
+// any express or implied warranties, including, but not limited to, the implied
+// warranties of merchantability and fitness for a particular purpose are disclaimed.
+// In no event shall the contributors be liable for any direct,
+// indirect, incidental, special, exemplary, or consequential damages
+// (including, but not limited to, procurement of substitute goods or services;
+// loss of use, data, or profits; or business interruption) however caused
+// and on any theory of liability, whether in contract, strict liability,
+// or tort (including negligence or otherwise) arising in any way out of
+// the use of this software, even if advised of the possibility of such damage.
+//
+//M*/
+
+#ifndef MAP_H_
+#define MAP_H_
+
+#include <opencv2/core.hpp> // Basic OpenCV structures (cv::Mat, Scalar)
+
+/** @defgroup reg Image Registration
+
+The Registration module implements parametric image registration. The implemented method is direct
+alignment, that is, it uses directly the pixel values for calculating the registration between a
+pair of images, as opposed to feature-based registration. The implementation follows essentially the
+corresponding part of @cite Szeliski06 .
+
+Feature based methods have some advantages over pixel based methods when we are trying to register
+pictures that have been shoot under different lighting conditions or exposition times, or when the
+images overlap only partially. On the other hand, the main advantage of pixel-based methods when
+compared to feature based methods is their better precision for some pictures (those shoot under
+similar lighting conditions and that have a significative overlap), due to the fact that we are
+using all the information available in the image, which allows us to achieve subpixel accuracy. This
+is particularly important for certain applications like multi-frame denoising or super-resolution.
+
+In fact, pixel and feature registration methods can complement each other: an application could
+first obtain a coarse registration using features and then refine the registration using a pixel
+based method on the overlapping area of the images. The code developed allows this use case.
+
+The module implements classes derived from the abstract classes cv::reg::Map or cv::reg::Mapper. The
+former models a coordinate transformation between two reference frames, while the later encapsulates
+a way of invoking a method that calculates a Map between two images. Although the objective has been
+to implement pixel based methods, the module can be extended to support other methods that can
+calculate transformations between images (feature methods, optical flow, etc.).
+
+Each class derived from Map implements a motion model, as follows:
+
+- MapShift: Models a simple translation
+- MapAffine: Models an affine transformation
+- MapProjec: Models a projective transformation
+
+MapProject can also be used to model affine motion or translations, but some operations on it are
+more costly, and that is the reason for defining the other two classes.
+
+The classes derived from Mapper are
+
+- MapperGradShift: Gradient based alignment for calculating translations. It produces a MapShift
+ (two parameters that correspond to the shift vector).
+- MapperGradEuclid: Gradient based alignment for euclidean motions, that is, rotations and
+ translations. It calculates three parameters (angle and shift vector), although the result is
+ stored in a MapAffine object for convenience.
+- MapperGradSimilar: Gradient based alignment for calculating similarities, which adds scaling to
+ the euclidean motion. It calculates four parameters (two for the anti-symmetric matrix and two
+ for the shift vector), although the result is stored in a MapAffine object for better
+ convenience.
+- MapperGradAffine: Gradient based alignment for an affine motion model. The number of parameters
+ is six and the result is stored in a MapAffine object.
+- MapperGradProj: Gradient based alignment for calculating projective transformations. The number
+ of parameters is eight and the result is stored in a MapProject object.
+- MapperPyramid: It implements hyerarchical motion estimation using a Gaussian pyramid. Its
+ constructor accepts as argument any other object that implements the Mapper interface, and it is
+ that mapper the one called by MapperPyramid for each scale of the pyramid.
+
+If the motion between the images is not very small, the normal way of using these classes is to
+create a MapperGrad\* object and use it as input to create a MapperPyramid, which in turn is called
+to perform the calculation. However, if the motion between the images is small enough, we can use
+directly the MapperGrad\* classes. Another possibility is to use first a feature based method to
+perform a coarse registration and then do a refinement through MapperPyramid or directly a
+MapperGrad\* object. The "calculate" method of the mappers accepts an initial estimation of the
+motion as input.
+
+When deciding which MapperGrad to use we must take into account that mappers with more parameters
+can handle more complex motions, but involve more calculations and are therefore slower. Also, if we
+are confident on the motion model that is followed by the sequence, increasing the number of
+parameters beyond what we need will decrease the accuracy: it is better to use the least number of
+degrees of freedom that we can.
+
+In the module tests there are examples that show how to register a pair of images using any of the
+implemented mappers.
+*/
+
+namespace cv {
+namespace reg {
+
+//! @addtogroup reg
+//! @{
+
+/** @brief Base class for modelling a Map between two images.
+
+The class is only used to define the common interface for any possible map.
+ */
+class CV_EXPORTS Map
+{
+public:
+ /*!
+ * Virtual destructor
+ */
+ virtual ~Map(void);
+
+ /*!
+ * Warps image to a new coordinate frame. The calculation is img2(x)=img1(T^{-1}(x)), as we
+ * have to apply the inverse transformation to the points to move them to were the values
+ * of img2 are.
+ * \param[in] img1 Original image
+ * \param[out] img2 Warped image
+ */
+ virtual void warp(const cv::Mat& img1, cv::Mat& img2) const;
+
+ /*!
+ * Warps image to a new coordinate frame. The calculation is img2(x)=img1(T(x)), so in fact
+ * this is the inverse warping as we are taking the value of img1 with the forward
+ * transformation of the points.
+ * \param[in] img1 Original image
+ * \param[out] img2 Warped image
+ */
+ virtual void inverseWarp(const cv::Mat& img1, cv::Mat& img2) const = 0;
+
+ /*!
+ * Calculates the inverse map
+ * \return Inverse map
+ */
+ virtual cv::Ptr<Map> inverseMap(void) const = 0;
+
+ /*!
+ * Changes the map composing the current transformation with the one provided in the call.
+ * The order is first the current transformation, then the input argument.
+ * \param[in] map Transformation to compose with.
+ */
+ virtual void compose(const Map& map) = 0;
+
+ /*!
+ * Scales the map by a given factor as if the coordinates system is expanded/compressed
+ * by that factor.
+ * \param[in] factor Expansion if bigger than one, compression if smaller than one
+ */
+ virtual void scale(double factor) = 0;
+};
+
+//! @}
+
+}} // namespace cv::reg
+
+#endif // MAP_H_
diff --git a/thirdparty/linux/include/opencv2/reg/mapaffine.hpp b/thirdparty/linux/include/opencv2/reg/mapaffine.hpp
new file mode 100644
index 0000000..1c91326
--- /dev/null
+++ b/thirdparty/linux/include/opencv2/reg/mapaffine.hpp
@@ -0,0 +1,105 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+// By downloading, copying, installing or using the software you agree to this license.
+// If you do not agree to this license, do not download, install,
+// copy or use the software.
+//
+// Copyright (C) 2013, Alfonso Sanchez-Beato, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// are permitted provided that the following conditions are met:
+//
+// * Redistribution's of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// * Redistribution's in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// * The name of the copyright holders may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// This software is provided by the copyright holders and contributors "as is" and
+// any express or implied warranties, including, but not limited to, the implied
+// warranties of merchantability and fitness for a particular purpose are disclaimed.
+// In no event shall the contributors be liable for any direct,
+// indirect, incidental, special, exemplary, or consequential damages
+// (including, but not limited to, procurement of substitute goods or services;
+// loss of use, data, or profits; or business interruption) however caused
+// and on any theory of liability, whether in contract, strict liability,
+// or tort (including negligence or otherwise) arising in any way out of
+// the use of this software, even if advised of the possibility of such damage.
+//
+//M*/
+
+#ifndef MAPAFFINE_H_
+#define MAPAFFINE_H_
+
+#include "map.hpp"
+
+namespace cv {
+namespace reg {
+
+//! @addtogroup reg
+//! @{
+
+/*!
+ * Defines an affine transformation
+ */
+class CV_EXPORTS MapAffine : public Map
+{
+public:
+ /*!
+ * Default constructor builds an identity map
+ */
+ MapAffine(void);
+
+ /*!
+ * Constructor providing explicit values
+ * \param[in] linTr Linear part of the affine transformation
+ * \param[in] shift Displacement part of the affine transformation
+ */
+ MapAffine(const cv::Matx<double, 2, 2>& linTr, const cv::Vec<double, 2>& shift);
+
+ /*!
+ * Destructor
+ */
+ ~MapAffine(void);
+
+ void inverseWarp(const cv::Mat& img1, cv::Mat& img2) const;
+
+ cv::Ptr<Map> inverseMap(void) const;
+
+ void compose(const Map& map);
+
+ void scale(double factor);
+
+ /*!
+ * Return linear part of the affine transformation
+ * \return Linear part of the affine transformation
+ */
+ const cv::Matx<double, 2, 2>& getLinTr() const {
+ return linTr_;
+ }
+
+ /*!
+ * Return displacement part of the affine transformation
+ * \return Displacement part of the affine transformation
+ */
+ const cv::Vec<double, 2>& getShift() const {
+ return shift_;
+ }
+
+private:
+ cv::Matx<double, 2, 2> linTr_;
+ cv::Vec<double, 2> shift_;
+};
+
+//! @}
+
+}} // namespace cv::reg
+
+#endif // MAPAFFINE_H_
diff --git a/thirdparty/linux/include/opencv2/reg/mapper.hpp b/thirdparty/linux/include/opencv2/reg/mapper.hpp
new file mode 100644
index 0000000..8abadd1
--- /dev/null
+++ b/thirdparty/linux/include/opencv2/reg/mapper.hpp
@@ -0,0 +1,113 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+// By downloading, copying, installing or using the software you agree to this license.
+// If you do not agree to this license, do not download, install,
+// copy or use the software.
+//
+// Copyright (C) 2013, Alfonso Sanchez-Beato, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// are permitted provided that the following conditions are met:
+//
+// * Redistribution's of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// * Redistribution's in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// * The name of the copyright holders may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// This software is provided by the copyright holders and contributors "as is" and
+// any express or implied warranties, including, but not limited to, the implied
+// warranties of merchantability and fitness for a particular purpose are disclaimed.
+// In no event shall the contributors be liable for any direct,
+// indirect, incidental, special, exemplary, or consequential damages
+// (including, but not limited to, procurement of substitute goods or services;
+// loss of use, data, or profits; or business interruption) however caused
+// and on any theory of liability, whether in contract, strict liability,
+// or tort (including negligence or otherwise) arising in any way out of
+// the use of this software, even if advised of the possibility of such damage.
+//
+//M*/
+
+#ifndef MAPPER_H_
+#define MAPPER_H_
+
+#include <opencv2/core.hpp> // Basic OpenCV structures (cv::Mat, Scalar)
+#include "map.hpp"
+
+namespace cv {
+namespace reg {
+
+//! @addtogroup reg
+//! @{
+
+/** @brief Base class for modelling an algorithm for calculating a
+
+The class is only used to define the common interface for any possible mapping algorithm.
+ */
+class CV_EXPORTS Mapper
+{
+public:
+ virtual ~Mapper(void) {}
+
+ /*
+ * Calculate mapping between two images
+ * \param[in] img1 Reference image
+ * \param[in] img2 Warped image
+ * \param[in,out] res Map from img1 to img2, stored in a smart pointer. If present as input,
+ * it is an initial rough estimation that the mapper will try to refine.
+ */
+ virtual void calculate(const cv::Mat& img1, const cv::Mat& img2, cv::Ptr<Map>& res) const = 0;
+
+ /*
+ * Returns a map compatible with the Mapper class
+ * \return Pointer to identity Map
+ */
+ virtual cv::Ptr<Map> getMap(void) const = 0;
+
+protected:
+ /*
+ * Calculates gradient and difference between images
+ * \param[in] img1 Image one
+ * \param[in] img2 Image two
+ * \param[out] Ix Gradient x-coordinate
+ * \param[out] Iy Gradient y-coordinate
+ * \param[out] It Difference of images
+ */
+ void gradient(const cv::Mat& img1, const cv::Mat& img2,
+ cv::Mat& Ix, cv::Mat& Iy, cv::Mat& It) const;
+
+ /*
+ * Fills matrices with pixel coordinates of an image
+ * \param[in] img Image
+ * \param[out] grid_r Row (y-coordinate)
+ * \param[out] grid_c Column (x-coordinate)
+ */
+ void grid(const Mat& img, Mat& grid_r, Mat& grid_c) const;
+
+ /*
+ * Per-element square of a matrix
+ * \param[in] mat1 Input matrix
+ * \return mat1[i,j]^2
+ */
+ cv::Mat sqr(const cv::Mat& mat1) const
+ {
+ cv::Mat res;
+ res.create(mat1.size(), mat1.type());
+ res = mat1.mul(mat1);
+ return res;
+ }
+};
+
+//! @}
+
+}} // namespace cv::reg
+
+#endif // MAPPER_H_
+
diff --git a/thirdparty/linux/include/opencv2/reg/mappergradaffine.hpp b/thirdparty/linux/include/opencv2/reg/mappergradaffine.hpp
new file mode 100644
index 0000000..08d5397
--- /dev/null
+++ b/thirdparty/linux/include/opencv2/reg/mappergradaffine.hpp
@@ -0,0 +1,67 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+// By downloading, copying, installing or using the software you agree to this license.
+// If you do not agree to this license, do not download, install,
+// copy or use the software.
+//
+// Copyright (C) 2013, Alfonso Sanchez-Beato, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// are permitted provided that the following conditions are met:
+//
+// * Redistribution's of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// * Redistribution's in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// * The name of the copyright holders may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// This software is provided by the copyright holders and contributors "as is" and
+// any express or implied warranties, including, but not limited to, the implied
+// warranties of merchantability and fitness for a particular purpose are disclaimed.
+// In no event shall the contributors be liable for any direct,
+// indirect, incidental, special, exemplary, or consequential damages
+// (including, but not limited to, procurement of substitute goods or services;
+// loss of use, data, or profits; or business interruption) however caused
+// and on any theory of liability, whether in contract, strict liability,
+// or tort (including negligence or otherwise) arising in any way out of
+// the use of this software, even if advised of the possibility of such damage.
+//
+//M*/
+
+#ifndef MAPPERGRADAFFINE_H_
+#define MAPPERGRADAFFINE_H_
+
+#include "mapper.hpp"
+
+namespace cv {
+namespace reg {
+
+//! @addtogroup reg
+//! @{
+
+/*!
+ * Mapper for affine motion
+ */
+class CV_EXPORTS MapperGradAffine: public Mapper
+{
+public:
+ MapperGradAffine(void);
+ ~MapperGradAffine(void);
+
+ virtual void calculate(const cv::Mat& img1, const cv::Mat& img2, cv::Ptr<Map>& res) const;
+
+ cv::Ptr<Map> getMap(void) const;
+};
+
+//! @}
+
+}} // namespace cv::reg
+
+#endif // MAPPERGRADAFFINE_H_
diff --git a/thirdparty/linux/include/opencv2/reg/mappergradeuclid.hpp b/thirdparty/linux/include/opencv2/reg/mappergradeuclid.hpp
new file mode 100644
index 0000000..29c49cb
--- /dev/null
+++ b/thirdparty/linux/include/opencv2/reg/mappergradeuclid.hpp
@@ -0,0 +1,67 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+// By downloading, copying, installing or using the software you agree to this license.
+// If you do not agree to this license, do not download, install,
+// copy or use the software.
+//
+// Copyright (C) 2013, Alfonso Sanchez-Beato, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// are permitted provided that the following conditions are met:
+//
+// * Redistribution's of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// * Redistribution's in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// * The name of the copyright holders may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// This software is provided by the copyright holders and contributors "as is" and
+// any express or implied warranties, including, but not limited to, the implied
+// warranties of merchantability and fitness for a particular purpose are disclaimed.
+// In no event shall the contributors be liable for any direct,
+// indirect, incidental, special, exemplary, or consequential damages
+// (including, but not limited to, procurement of substitute goods or services;
+// loss of use, data, or profits; or business interruption) however caused
+// and on any theory of liability, whether in contract, strict liability,
+// or tort (including negligence or otherwise) arising in any way out of
+// the use of this software, even if advised of the possibility of such damage.
+//
+//M*/
+
+#ifndef MAPPERGRADEUCLID_H_
+#define MAPPERGRADEUCLID_H_
+
+#include "mapper.hpp"
+
+namespace cv {
+namespace reg {
+
+//! @addtogroup reg
+//! @{
+
+/*!
+ * Mapper for euclidean motion: rotation plus shift
+ */
+class CV_EXPORTS MapperGradEuclid: public Mapper
+{
+public:
+ MapperGradEuclid(void);
+ ~MapperGradEuclid(void);
+
+ virtual void calculate(const cv::Mat& img1, const cv::Mat& img2, cv::Ptr<Map>& res) const;
+
+ cv::Ptr<Map> getMap(void) const;
+};
+
+//! @}
+
+}} // namespace cv::reg
+
+#endif // MAPPERGRADEUCLID_H_
diff --git a/thirdparty/linux/include/opencv2/reg/mappergradproj.hpp b/thirdparty/linux/include/opencv2/reg/mappergradproj.hpp
new file mode 100644
index 0000000..f1721e8
--- /dev/null
+++ b/thirdparty/linux/include/opencv2/reg/mappergradproj.hpp
@@ -0,0 +1,67 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+// By downloading, copying, installing or using the software you agree to this license.
+// If you do not agree to this license, do not download, install,
+// copy or use the software.
+//
+// Copyright (C) 2013, Alfonso Sanchez-Beato, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// are permitted provided that the following conditions are met:
+//
+// * Redistribution's of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// * Redistribution's in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// * The name of the copyright holders may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// This software is provided by the copyright holders and contributors "as is" and
+// any express or implied warranties, including, but not limited to, the implied
+// warranties of merchantability and fitness for a particular purpose are disclaimed.
+// In no event shall the contributors be liable for any direct,
+// indirect, incidental, special, exemplary, or consequential damages
+// (including, but not limited to, procurement of substitute goods or services;
+// loss of use, data, or profits; or business interruption) however caused
+// and on any theory of liability, whether in contract, strict liability,
+// or tort (including negligence or otherwise) arising in any way out of
+// the use of this software, even if advised of the possibility of such damage.
+//
+//M*/
+
+#ifndef MAPPERGRADPROJ_H_
+#define MAPPERGRADPROJ_H_
+
+#include "mapper.hpp"
+
+namespace cv {
+namespace reg {
+
+//! @addtogroup reg
+//! @{
+
+/*!
+ * Gradient mapper for a projective transformation
+ */
+class CV_EXPORTS MapperGradProj: public Mapper
+{
+public:
+ MapperGradProj(void);
+ ~MapperGradProj(void);
+
+ virtual void calculate(const cv::Mat& img1, const cv::Mat& img2, cv::Ptr<Map>& res) const;
+
+ cv::Ptr<Map> getMap(void) const;
+};
+
+//! @}
+
+}} // namespace cv::reg
+
+#endif // MAPPERGRADPROJ_H_
diff --git a/thirdparty/linux/include/opencv2/reg/mappergradshift.hpp b/thirdparty/linux/include/opencv2/reg/mappergradshift.hpp
new file mode 100644
index 0000000..a9f75b3
--- /dev/null
+++ b/thirdparty/linux/include/opencv2/reg/mappergradshift.hpp
@@ -0,0 +1,67 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+// By downloading, copying, installing or using the software you agree to this license.
+// If you do not agree to this license, do not download, install,
+// copy or use the software.
+//
+// Copyright (C) 2013, Alfonso Sanchez-Beato, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// are permitted provided that the following conditions are met:
+//
+// * Redistribution's of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// * Redistribution's in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// * The name of the copyright holders may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// This software is provided by the copyright holders and contributors "as is" and
+// any express or implied warranties, including, but not limited to, the implied
+// warranties of merchantability and fitness for a particular purpose are disclaimed.
+// In no event shall the contributors be liable for any direct,
+// indirect, incidental, special, exemplary, or consequential damages
+// (including, but not limited to, procurement of substitute goods or services;
+// loss of use, data, or profits; or business interruption) however caused
+// and on any theory of liability, whether in contract, strict liability,
+// or tort (including negligence or otherwise) arising in any way out of
+// the use of this software, even if advised of the possibility of such damage.
+//
+//M*/
+
+#ifndef MAPPERGRADSHIFT_H_
+#define MAPPERGRADSHIFT_H_
+
+#include "mapper.hpp"
+
+namespace cv {
+namespace reg {
+
+//! @addtogroup reg
+//! @{
+
+/*!
+ * Gradient mapper for a translation
+ */
+class CV_EXPORTS MapperGradShift: public Mapper
+{
+public:
+ MapperGradShift(void);
+ virtual ~MapperGradShift(void);
+
+ virtual void calculate(const cv::Mat& img1, const cv::Mat& img2, cv::Ptr<Map>& res) const;
+
+ cv::Ptr<Map> getMap(void) const;
+};
+
+//! @}
+
+}} // namespace cv::reg
+
+#endif // MAPPERGRADSHIFT_H_
diff --git a/thirdparty/linux/include/opencv2/reg/mappergradsimilar.hpp b/thirdparty/linux/include/opencv2/reg/mappergradsimilar.hpp
new file mode 100644
index 0000000..ea45ab9
--- /dev/null
+++ b/thirdparty/linux/include/opencv2/reg/mappergradsimilar.hpp
@@ -0,0 +1,67 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+// By downloading, copying, installing or using the software you agree to this license.
+// If you do not agree to this license, do not download, install,
+// copy or use the software.
+//
+// Copyright (C) 2013, Alfonso Sanchez-Beato, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// are permitted provided that the following conditions are met:
+//
+// * Redistribution's of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// * Redistribution's in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// * The name of the copyright holders may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// This software is provided by the copyright holders and contributors "as is" and
+// any express or implied warranties, including, but not limited to, the implied
+// warranties of merchantability and fitness for a particular purpose are disclaimed.
+// In no event shall the contributors be liable for any direct,
+// indirect, incidental, special, exemplary, or consequential damages
+// (including, but not limited to, procurement of substitute goods or services;
+// loss of use, data, or profits; or business interruption) however caused
+// and on any theory of liability, whether in contract, strict liability,
+// or tort (including negligence or otherwise) arising in any way out of
+// the use of this software, even if advised of the possibility of such damage.
+//
+//M*/
+
+#ifndef MAPPERGRADSIMILAR_H_
+#define MAPPERGRADSIMILAR_H_
+
+#include "mapper.hpp"
+
+namespace cv {
+namespace reg {
+
+//! @addtogroup reg
+//! @{
+
+/*!
+ * Calculates a similarity transformation between to images (scale, rotation, and shift)
+ */
+class CV_EXPORTS MapperGradSimilar: public Mapper
+{
+public:
+ MapperGradSimilar(void);
+ ~MapperGradSimilar(void);
+
+ virtual void calculate(const cv::Mat& img1, const cv::Mat& img2, cv::Ptr<Map>& res) const;
+
+ cv::Ptr<Map> getMap(void) const;
+};
+
+//! @}
+
+}} // namespace cv::reg
+
+#endif // MAPPERGRADSIMILAR_H_
diff --git a/thirdparty/linux/include/opencv2/reg/mapperpyramid.hpp b/thirdparty/linux/include/opencv2/reg/mapperpyramid.hpp
new file mode 100644
index 0000000..33440bd
--- /dev/null
+++ b/thirdparty/linux/include/opencv2/reg/mapperpyramid.hpp
@@ -0,0 +1,78 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+// By downloading, copying, installing or using the software you agree to this license.
+// If you do not agree to this license, do not download, install,
+// copy or use the software.
+//
+// Copyright (C) 2013, Alfonso Sanchez-Beato, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// are permitted provided that the following conditions are met:
+//
+// * Redistribution's of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// * Redistribution's in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// * The name of the copyright holders may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// This software is provided by the copyright holders and contributors "as is" and
+// any express or implied warranties, including, but not limited to, the implied
+// warranties of merchantability and fitness for a particular purpose are disclaimed.
+// In no event shall the contributors be liable for any direct,
+// indirect, incidental, special, exemplary, or consequential damages
+// (including, but not limited to, procurement of substitute goods or services;
+// loss of use, data, or profits; or business interruption) however caused
+// and on any theory of liability, whether in contract, strict liability,
+// or tort (including negligence or otherwise) arising in any way out of
+// the use of this software, even if advised of the possibility of such damage.
+//
+//M*/
+
+#ifndef MAPPERPYRAMID_H_
+#define MAPPERPYRAMID_H_
+
+#include "mapper.hpp"
+
+
+namespace cv {
+namespace reg {
+
+//! @addtogroup reg
+//! @{
+
+/*!
+ * Calculates a map using a gaussian pyramid
+ */
+class CV_EXPORTS MapperPyramid: public Mapper
+{
+public:
+ /*
+ * Constructor
+ * \param[in] baseMapper Base mapper used for the refinements
+ */
+ MapperPyramid(const Mapper& baseMapper);
+
+ void calculate(const cv::Mat& img1, const cv::Mat& img2, cv::Ptr<Map>& res) const;
+
+ cv::Ptr<Map> getMap(void) const;
+
+ unsigned numLev_; /*!< Number of levels of the pyramid */
+ unsigned numIterPerScale_; /*!< Number of iterations at a given scale of the pyramid */
+
+private:
+ MapperPyramid& operator=(const MapperPyramid&);
+ const Mapper& baseMapper_; /*!< Mapper used in inner level */
+};
+
+//! @}
+
+}} // namespace cv::reg
+
+#endif // MAPPERPYRAMID_H_
diff --git a/thirdparty/linux/include/opencv2/reg/mapprojec.hpp b/thirdparty/linux/include/opencv2/reg/mapprojec.hpp
new file mode 100644
index 0000000..57ef146
--- /dev/null
+++ b/thirdparty/linux/include/opencv2/reg/mapprojec.hpp
@@ -0,0 +1,105 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+// By downloading, copying, installing or using the software you agree to this license.
+// If you do not agree to this license, do not download, install,
+// copy or use the software.
+//
+// Copyright (C) 2013, Alfonso Sanchez-Beato, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// are permitted provided that the following conditions are met:
+//
+// * Redistribution's of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// * Redistribution's in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// * The name of the copyright holders may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// This software is provided by the copyright holders and contributors "as is" and
+// any express or implied warranties, including, but not limited to, the implied
+// warranties of merchantability and fitness for a particular purpose are disclaimed.
+// In no event shall the contributors be liable for any direct,
+// indirect, incidental, special, exemplary, or consequential damages
+// (including, but not limited to, procurement of substitute goods or services;
+// loss of use, data, or profits; or business interruption) however caused
+// and on any theory of liability, whether in contract, strict liability,
+// or tort (including negligence or otherwise) arising in any way out of
+// the use of this software, even if advised of the possibility of such damage.
+//
+//M*/
+
+#ifndef MAPPROJEC_H_
+#define MAPPROJEC_H_
+
+#include "map.hpp"
+
+
+namespace cv {
+namespace reg {
+
+//! @addtogroup reg
+//! @{
+
+/*!
+ * Defines an transformation that consists on a projective transformation
+ */
+class CV_EXPORTS MapProjec : public Map
+{
+public:
+ /*!
+ * Default constructor builds an identity map
+ */
+ MapProjec(void);
+
+ /*!
+ * Constructor providing explicit values
+ * \param[in] projTr Projective transformation
+ */
+ MapProjec(const cv::Matx<double, 3, 3>& projTr);
+
+ /*!
+ * Destructor
+ */
+ ~MapProjec(void);
+
+ void inverseWarp(const cv::Mat& img1, cv::Mat& img2) const;
+
+ cv::Ptr<Map> inverseMap(void) const;
+
+ void compose(const Map& map);
+
+ void scale(double factor);
+
+ /*!
+ * Returns projection matrix
+ * \return Projection matrix
+ */
+ const cv::Matx<double, 3, 3>& getProjTr() const {
+ return projTr_;
+ }
+
+ /*!
+ * Normalizes object's homography
+ */
+ void normalize(void) {
+ double z = 1./projTr_(2, 2);
+ for(size_t v_i = 0; v_i < sizeof(projTr_.val)/sizeof(projTr_.val[0]); ++v_i)
+ projTr_.val[v_i] *= z;
+ }
+
+private:
+ cv::Matx<double, 3, 3> projTr_; /*< Projection matrix */
+};
+
+//! @}
+
+}} // namespace cv::reg
+
+#endif // MAPPROJEC_H_
diff --git a/thirdparty/linux/include/opencv2/reg/mapshift.hpp b/thirdparty/linux/include/opencv2/reg/mapshift.hpp
new file mode 100644
index 0000000..e5f54a4
--- /dev/null
+++ b/thirdparty/linux/include/opencv2/reg/mapshift.hpp
@@ -0,0 +1,96 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+// By downloading, copying, installing or using the software you agree to this license.
+// If you do not agree to this license, do not download, install,
+// copy or use the software.
+//
+// Copyright (C) 2013, Alfonso Sanchez-Beato, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// are permitted provided that the following conditions are met:
+//
+// * Redistribution's of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// * Redistribution's in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// * The name of the copyright holders may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// This software is provided by the copyright holders and contributors "as is" and
+// any express or implied warranties, including, but not limited to, the implied
+// warranties of merchantability and fitness for a particular purpose are disclaimed.
+// In no event shall the contributors be liable for any direct,
+// indirect, incidental, special, exemplary, or consequential damages
+// (including, but not limited to, procurement of substitute goods or services;
+// loss of use, data, or profits; or business interruption) however caused
+// and on any theory of liability, whether in contract, strict liability,
+// or tort (including negligence or otherwise) arising in any way out of
+// the use of this software, even if advised of the possibility of such damage.
+//
+//M*/
+
+#ifndef MAPSHIFT_H_
+#define MAPSHIFT_H_
+
+#include "map.hpp"
+
+
+namespace cv {
+namespace reg {
+
+//! @addtogroup reg
+//! @{
+
+/*!
+ * Defines an transformation that consists on a simple displacement
+ */
+class CV_EXPORTS MapShift : public Map
+{
+public:
+ /*!
+ * Default constructor builds an identity map
+ */
+ MapShift(void);
+
+ /*!
+ * Constructor providing explicit values
+ * \param[in] shift Displacement
+ */
+ MapShift(const cv::Vec<double, 2>& shift);
+
+ /*!
+ * Destructor
+ */
+ ~MapShift(void);
+
+ void inverseWarp(const cv::Mat& img1, cv::Mat& img2) const;
+
+ cv::Ptr<Map> inverseMap(void) const;
+
+ void compose(const Map& map);
+
+ void scale(double factor);
+
+ /*!
+ * Return displacement
+ * \return Displacement
+ */
+ const cv::Vec<double, 2>& getShift() const {
+ return shift_;
+ }
+
+private:
+ cv::Vec<double, 2> shift_; /*< Displacement */
+};
+
+//! @}
+
+}} // namespace cv::reg
+
+#endif // MAPSHIFT_H_