mapperpyramid.hpp 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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 MAPPERPYRAMID_H_
  38. #define MAPPERPYRAMID_H_
  39. #include "mapper.hpp"
  40. #include "mapaffine.hpp"
  41. #include "mapprojec.hpp"
  42. #include "mapshift.hpp"
  43. namespace cv {
  44. namespace reg {
  45. //! @addtogroup reg
  46. //! @{
  47. /*!
  48. * Calculates a map using a gaussian pyramid
  49. */
  50. class CV_EXPORTS_W MapperPyramid: public Mapper
  51. {
  52. public:
  53. /*
  54. * Constructor
  55. * \param[in] baseMapper Base mapper used for the refinements
  56. */
  57. CV_WRAP MapperPyramid(Ptr<Mapper> baseMapper);
  58. CV_WRAP virtual cv::Ptr<Map> calculate(InputArray img1, InputArray img2, cv::Ptr<Map> init = cv::Ptr<Map>()) const CV_OVERRIDE;
  59. CV_WRAP cv::Ptr<Map> getMap() const CV_OVERRIDE;
  60. CV_PROP_RW int numLev_; /*!< Number of levels of the pyramid */
  61. CV_PROP_RW int numIterPerScale_; /*!< Number of iterations at a given scale of the pyramid */
  62. private:
  63. MapperPyramid& operator=(const MapperPyramid&);
  64. const Mapper& baseMapper_; /*!< Mapper used in inner level */
  65. };
  66. /*!
  67. * Converts a pointer to a Map returned by MapperPyramid::calculate into the specified Map pointer type
  68. */
  69. class CV_EXPORTS_W MapTypeCaster
  70. {
  71. public:
  72. CV_WRAP static Ptr<MapAffine> toAffine(Ptr<Map> sourceMap)
  73. {
  74. MapAffine& affineMap = dynamic_cast<MapAffine&>(*sourceMap);
  75. return Ptr<MapAffine>(new MapAffine(affineMap));
  76. }
  77. CV_WRAP static Ptr<MapShift> toShift(Ptr<Map> sourceMap)
  78. {
  79. MapShift& shiftMap = dynamic_cast<MapShift&>(*sourceMap);
  80. return Ptr<MapShift>(new MapShift(shiftMap));
  81. }
  82. CV_WRAP static Ptr<MapProjec> toProjec(Ptr<Map> sourceMap)
  83. {
  84. MapProjec& projecMap = dynamic_cast<MapProjec&>(*sourceMap);
  85. return Ptr<MapProjec>(new MapProjec(projecMap));
  86. }
  87. };
  88. //! @}
  89. }} // namespace cv::reg
  90. #endif // MAPPERPYRAMID_H_