mapshift.hpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. #ifndef MAPSHIFT_H_
  38. #define MAPSHIFT_H_
  39. #include "map.hpp"
  40. namespace cv {
  41. namespace reg {
  42. //! @addtogroup reg
  43. //! @{
  44. /*!
  45. * Defines an transformation that consists on a simple displacement
  46. */
  47. class CV_EXPORTS_W MapShift : public Map
  48. {
  49. public:
  50. /*!
  51. * Default constructor builds an identity map
  52. */
  53. CV_WRAP MapShift();
  54. /*!
  55. * Constructor providing explicit values
  56. * \param[in] shift Displacement
  57. */
  58. CV_WRAP MapShift(InputArray shift);
  59. /*!
  60. * Destructor
  61. */
  62. ~MapShift();
  63. CV_WRAP void inverseWarp(InputArray img1, OutputArray img2) const CV_OVERRIDE;
  64. CV_WRAP cv::Ptr<Map> inverseMap() const CV_OVERRIDE;
  65. CV_WRAP void compose(cv::Ptr<Map> map) CV_OVERRIDE;
  66. CV_WRAP void scale(double factor) CV_OVERRIDE;
  67. /*!
  68. * Return displacement
  69. * \return Displacement
  70. */
  71. const cv::Vec<double, 2>& getShift() const {
  72. return shift_;
  73. }
  74. CV_WRAP void getShift(OutputArray shift) const {
  75. Mat(shift_).copyTo(shift);
  76. }
  77. private:
  78. cv::Vec<double, 2> shift_; /*< Displacement */
  79. };
  80. //! @}
  81. }} // namespace cv::reg
  82. #endif // MAPSHIFT_H_