warpers.hpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  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. //
  10. // License Agreement
  11. // For Open Source Computer Vision Library
  12. //
  13. // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
  14. // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
  15. // Third party copyrights are property of their respective owners.
  16. //
  17. // Redistribution and use in source and binary forms, with or without modification,
  18. // are permitted provided that the following conditions are met:
  19. //
  20. // * Redistribution's of source code must retain the above copyright notice,
  21. // this list of conditions and the following disclaimer.
  22. //
  23. // * Redistribution's in binary form must reproduce the above copyright notice,
  24. // this list of conditions and the following disclaimer in the documentation
  25. // and/or other materials provided with the distribution.
  26. //
  27. // * The name of the copyright holders may not be used to endorse or promote products
  28. // derived from this software without specific prior written permission.
  29. //
  30. // This software is provided by the copyright holders and contributors "as is" and
  31. // any express or implied warranties, including, but not limited to, the implied
  32. // warranties of merchantability and fitness for a particular purpose are disclaimed.
  33. // In no event shall the Intel Corporation or contributors be liable for any direct,
  34. // indirect, incidental, special, exemplary, or consequential damages
  35. // (including, but not limited to, procurement of substitute goods or services;
  36. // loss of use, data, or profits; or business interruption) however caused
  37. // and on any theory of liability, whether in contract, strict liability,
  38. // or tort (including negligence or otherwise) arising in any way out of
  39. // the use of this software, even if advised of the possibility of such damage.
  40. //
  41. //M*/
  42. #ifndef OPENCV_STITCHING_WARPERS_HPP
  43. #define OPENCV_STITCHING_WARPERS_HPP
  44. #include "opencv2/core.hpp"
  45. #include "opencv2/core/cuda.hpp"
  46. #include "opencv2/imgproc.hpp"
  47. #include "opencv2/opencv_modules.hpp"
  48. namespace cv {
  49. namespace detail {
  50. //! @addtogroup stitching_warp
  51. //! @{
  52. /** @brief Rotation-only model image warper interface.
  53. */
  54. class CV_EXPORTS RotationWarper
  55. {
  56. public:
  57. virtual ~RotationWarper() {}
  58. /** @brief Projects the image point.
  59. @param pt Source point
  60. @param K Camera intrinsic parameters
  61. @param R Camera rotation matrix
  62. @return Projected point
  63. */
  64. virtual Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R) = 0;
  65. /** @brief Builds the projection maps according to the given camera data.
  66. @param src_size Source image size
  67. @param K Camera intrinsic parameters
  68. @param R Camera rotation matrix
  69. @param xmap Projection map for the x axis
  70. @param ymap Projection map for the y axis
  71. @return Projected image minimum bounding box
  72. */
  73. virtual Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) = 0;
  74. /** @brief Projects the image.
  75. @param src Source image
  76. @param K Camera intrinsic parameters
  77. @param R Camera rotation matrix
  78. @param interp_mode Interpolation mode
  79. @param border_mode Border extrapolation mode
  80. @param dst Projected image
  81. @return Project image top-left corner
  82. */
  83. virtual Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
  84. CV_OUT OutputArray dst) = 0;
  85. /** @brief Projects the image backward.
  86. @param src Projected image
  87. @param K Camera intrinsic parameters
  88. @param R Camera rotation matrix
  89. @param interp_mode Interpolation mode
  90. @param border_mode Border extrapolation mode
  91. @param dst_size Backward-projected image size
  92. @param dst Backward-projected image
  93. */
  94. virtual void warpBackward(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
  95. Size dst_size, CV_OUT OutputArray dst) = 0;
  96. /**
  97. @param src_size Source image bounding box
  98. @param K Camera intrinsic parameters
  99. @param R Camera rotation matrix
  100. @return Projected image minimum bounding box
  101. */
  102. virtual Rect warpRoi(Size src_size, InputArray K, InputArray R) = 0;
  103. virtual float getScale() const { return 1.f; }
  104. virtual void setScale(float) {}
  105. };
  106. /** @brief Base class for warping logic implementation.
  107. */
  108. struct CV_EXPORTS_W_SIMPLE ProjectorBase
  109. {
  110. void setCameraParams(InputArray K = Mat::eye(3, 3, CV_32F),
  111. InputArray R = Mat::eye(3, 3, CV_32F),
  112. InputArray T = Mat::zeros(3, 1, CV_32F));
  113. float scale;
  114. float k[9];
  115. float rinv[9];
  116. float r_kinv[9];
  117. float k_rinv[9];
  118. float t[3];
  119. };
  120. /** @brief Base class for rotation-based warper using a detail::ProjectorBase_ derived class.
  121. */
  122. template <class P>
  123. class CV_EXPORTS_TEMPLATE RotationWarperBase : public RotationWarper
  124. {
  125. public:
  126. Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R) CV_OVERRIDE;
  127. Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) CV_OVERRIDE;
  128. Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
  129. OutputArray dst) CV_OVERRIDE;
  130. void warpBackward(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
  131. Size dst_size, OutputArray dst) CV_OVERRIDE;
  132. Rect warpRoi(Size src_size, InputArray K, InputArray R) CV_OVERRIDE;
  133. float getScale() const CV_OVERRIDE{ return projector_.scale; }
  134. void setScale(float val) CV_OVERRIDE { projector_.scale = val; }
  135. protected:
  136. // Detects ROI of the destination image. It's correct for any projection.
  137. virtual void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br);
  138. // Detects ROI of the destination image by walking over image border.
  139. // Correctness for any projection isn't guaranteed.
  140. void detectResultRoiByBorder(Size src_size, Point &dst_tl, Point &dst_br);
  141. P projector_;
  142. };
  143. struct CV_EXPORTS PlaneProjector : ProjectorBase
  144. {
  145. void mapForward(float x, float y, float &u, float &v);
  146. void mapBackward(float u, float v, float &x, float &y);
  147. };
  148. /** @brief Warper that maps an image onto the z = 1 plane.
  149. */
  150. class CV_EXPORTS PlaneWarper : public RotationWarperBase<PlaneProjector>
  151. {
  152. public:
  153. /** @brief Construct an instance of the plane warper class.
  154. @param scale Projected image scale multiplier
  155. */
  156. PlaneWarper(float scale = 1.f) { projector_.scale = scale; }
  157. Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R) CV_OVERRIDE;
  158. Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R, InputArray T);
  159. virtual Rect buildMaps(Size src_size, InputArray K, InputArray R, InputArray T, CV_OUT OutputArray xmap, CV_OUT OutputArray ymap);
  160. Rect buildMaps(Size src_size, InputArray K, InputArray R, CV_OUT OutputArray xmap, CV_OUT OutputArray ymap) CV_OVERRIDE;
  161. Point warp(InputArray src, InputArray K, InputArray R,
  162. int interp_mode, int border_mode, CV_OUT OutputArray dst) CV_OVERRIDE;
  163. virtual Point warp(InputArray src, InputArray K, InputArray R, InputArray T, int interp_mode, int border_mode,
  164. CV_OUT OutputArray dst);
  165. Rect warpRoi(Size src_size, InputArray K, InputArray R) CV_OVERRIDE;
  166. Rect warpRoi(Size src_size, InputArray K, InputArray R, InputArray T);
  167. protected:
  168. void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br) CV_OVERRIDE;
  169. };
  170. /** @brief Affine warper that uses rotations and translations
  171. Uses affine transformation in homogeneous coordinates to represent both rotation and
  172. translation in camera rotation matrix.
  173. */
  174. class CV_EXPORTS AffineWarper : public PlaneWarper
  175. {
  176. public:
  177. /** @brief Construct an instance of the affine warper class.
  178. @param scale Projected image scale multiplier
  179. */
  180. AffineWarper(float scale = 1.f) : PlaneWarper(scale) {}
  181. Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R) CV_OVERRIDE;
  182. Rect buildMaps(Size src_size, InputArray K, InputArray R, CV_OUT OutputArray xmap, CV_OUT OutputArray ymap) CV_OVERRIDE;
  183. Point warp(InputArray src, InputArray K, InputArray R,
  184. int interp_mode, int border_mode, CV_OUT OutputArray dst) CV_OVERRIDE;
  185. Rect warpRoi(Size src_size, InputArray K, InputArray R) CV_OVERRIDE;
  186. protected:
  187. /** @brief Extracts rotation and translation matrices from matrix H representing
  188. affine transformation in homogeneous coordinates
  189. */
  190. void getRTfromHomogeneous(InputArray H, Mat &R, Mat &T);
  191. };
  192. struct CV_EXPORTS_W_SIMPLE SphericalProjector : ProjectorBase
  193. {
  194. CV_WRAP void mapForward(float x, float y, float &u, float &v);
  195. CV_WRAP void mapBackward(float u, float v, float &x, float &y);
  196. };
  197. /** @brief Warper that maps an image onto the unit sphere located at the origin.
  198. Projects image onto unit sphere with origin at (0, 0, 0) and radius scale, measured in pixels.
  199. A 360 panorama would therefore have a resulting width of 2 * scale * PI pixels.
  200. Poles are located at (0, -1, 0) and (0, 1, 0) points.
  201. */
  202. class CV_EXPORTS SphericalWarper : public RotationWarperBase<SphericalProjector>
  203. {
  204. public:
  205. /** @brief Construct an instance of the spherical warper class.
  206. @param scale Radius of the projected sphere, in pixels. An image spanning the
  207. whole sphere will have a width of 2 * scale * PI pixels.
  208. */
  209. SphericalWarper(float scale) { projector_.scale = scale; }
  210. Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) CV_OVERRIDE;
  211. Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, OutputArray dst) CV_OVERRIDE;
  212. protected:
  213. void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br) CV_OVERRIDE;
  214. };
  215. struct CV_EXPORTS CylindricalProjector : ProjectorBase
  216. {
  217. void mapForward(float x, float y, float &u, float &v);
  218. void mapBackward(float u, float v, float &x, float &y);
  219. };
  220. /** @brief Warper that maps an image onto the x\*x + z\*z = 1 cylinder.
  221. */
  222. class CV_EXPORTS CylindricalWarper : public RotationWarperBase<CylindricalProjector>
  223. {
  224. public:
  225. /** @brief Construct an instance of the cylindrical warper class.
  226. @param scale Projected image scale multiplier
  227. */
  228. CylindricalWarper(float scale) { projector_.scale = scale; }
  229. Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) CV_OVERRIDE;
  230. Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, OutputArray dst) CV_OVERRIDE;
  231. protected:
  232. void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br) CV_OVERRIDE
  233. {
  234. RotationWarperBase<CylindricalProjector>::detectResultRoiByBorder(src_size, dst_tl, dst_br);
  235. }
  236. };
  237. struct CV_EXPORTS FisheyeProjector : ProjectorBase
  238. {
  239. void mapForward(float x, float y, float &u, float &v);
  240. void mapBackward(float u, float v, float &x, float &y);
  241. };
  242. class CV_EXPORTS FisheyeWarper : public RotationWarperBase<FisheyeProjector>
  243. {
  244. public:
  245. FisheyeWarper(float scale) { projector_.scale = scale; }
  246. };
  247. struct CV_EXPORTS StereographicProjector : ProjectorBase
  248. {
  249. void mapForward(float x, float y, float &u, float &v);
  250. void mapBackward(float u, float v, float &x, float &y);
  251. };
  252. class CV_EXPORTS StereographicWarper : public RotationWarperBase<StereographicProjector>
  253. {
  254. public:
  255. StereographicWarper(float scale) { projector_.scale = scale; }
  256. };
  257. struct CV_EXPORTS CompressedRectilinearProjector : ProjectorBase
  258. {
  259. float a, b;
  260. void mapForward(float x, float y, float &u, float &v);
  261. void mapBackward(float u, float v, float &x, float &y);
  262. };
  263. class CV_EXPORTS CompressedRectilinearWarper : public RotationWarperBase<CompressedRectilinearProjector>
  264. {
  265. public:
  266. CompressedRectilinearWarper(float scale, float A = 1, float B = 1)
  267. {
  268. projector_.a = A;
  269. projector_.b = B;
  270. projector_.scale = scale;
  271. }
  272. };
  273. struct CV_EXPORTS CompressedRectilinearPortraitProjector : ProjectorBase
  274. {
  275. float a, b;
  276. void mapForward(float x, float y, float &u, float &v);
  277. void mapBackward(float u, float v, float &x, float &y);
  278. };
  279. class CV_EXPORTS CompressedRectilinearPortraitWarper : public RotationWarperBase<CompressedRectilinearPortraitProjector>
  280. {
  281. public:
  282. CompressedRectilinearPortraitWarper(float scale, float A = 1, float B = 1)
  283. {
  284. projector_.a = A;
  285. projector_.b = B;
  286. projector_.scale = scale;
  287. }
  288. };
  289. struct CV_EXPORTS PaniniProjector : ProjectorBase
  290. {
  291. float a, b;
  292. void mapForward(float x, float y, float &u, float &v);
  293. void mapBackward(float u, float v, float &x, float &y);
  294. };
  295. class CV_EXPORTS PaniniWarper : public RotationWarperBase<PaniniProjector>
  296. {
  297. public:
  298. PaniniWarper(float scale, float A = 1, float B = 1)
  299. {
  300. projector_.a = A;
  301. projector_.b = B;
  302. projector_.scale = scale;
  303. }
  304. };
  305. struct CV_EXPORTS PaniniPortraitProjector : ProjectorBase
  306. {
  307. float a, b;
  308. void mapForward(float x, float y, float &u, float &v);
  309. void mapBackward(float u, float v, float &x, float &y);
  310. };
  311. class CV_EXPORTS PaniniPortraitWarper : public RotationWarperBase<PaniniPortraitProjector>
  312. {
  313. public:
  314. PaniniPortraitWarper(float scale, float A = 1, float B = 1)
  315. {
  316. projector_.a = A;
  317. projector_.b = B;
  318. projector_.scale = scale;
  319. }
  320. };
  321. struct CV_EXPORTS MercatorProjector : ProjectorBase
  322. {
  323. void mapForward(float x, float y, float &u, float &v);
  324. void mapBackward(float u, float v, float &x, float &y);
  325. };
  326. class CV_EXPORTS MercatorWarper : public RotationWarperBase<MercatorProjector>
  327. {
  328. public:
  329. MercatorWarper(float scale) { projector_.scale = scale; }
  330. };
  331. struct CV_EXPORTS TransverseMercatorProjector : ProjectorBase
  332. {
  333. void mapForward(float x, float y, float &u, float &v);
  334. void mapBackward(float u, float v, float &x, float &y);
  335. };
  336. class CV_EXPORTS TransverseMercatorWarper : public RotationWarperBase<TransverseMercatorProjector>
  337. {
  338. public:
  339. TransverseMercatorWarper(float scale) { projector_.scale = scale; }
  340. };
  341. class CV_EXPORTS PlaneWarperGpu : public PlaneWarper
  342. {
  343. public:
  344. PlaneWarperGpu(float scale = 1.f) : PlaneWarper(scale) {}
  345. Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) CV_OVERRIDE
  346. {
  347. Rect result = buildMaps(src_size, K, R, d_xmap_, d_ymap_);
  348. d_xmap_.download(xmap);
  349. d_ymap_.download(ymap);
  350. return result;
  351. }
  352. Rect buildMaps(Size src_size, InputArray K, InputArray R, InputArray T, OutputArray xmap, OutputArray ymap) CV_OVERRIDE
  353. {
  354. Rect result = buildMaps(src_size, K, R, T, d_xmap_, d_ymap_);
  355. d_xmap_.download(xmap);
  356. d_ymap_.download(ymap);
  357. return result;
  358. }
  359. Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
  360. OutputArray dst) CV_OVERRIDE
  361. {
  362. d_src_.upload(src);
  363. Point result = warp(d_src_, K, R, interp_mode, border_mode, d_dst_);
  364. d_dst_.download(dst);
  365. return result;
  366. }
  367. Point warp(InputArray src, InputArray K, InputArray R, InputArray T, int interp_mode, int border_mode,
  368. OutputArray dst) CV_OVERRIDE
  369. {
  370. d_src_.upload(src);
  371. Point result = warp(d_src_, K, R, T, interp_mode, border_mode, d_dst_);
  372. d_dst_.download(dst);
  373. return result;
  374. }
  375. Rect buildMaps(Size src_size, InputArray K, InputArray R, cuda::GpuMat & xmap, cuda::GpuMat & ymap);
  376. Rect buildMaps(Size src_size, InputArray K, InputArray R, InputArray T, cuda::GpuMat & xmap, cuda::GpuMat & ymap);
  377. Point warp(const cuda::GpuMat & src, InputArray K, InputArray R, int interp_mode, int border_mode,
  378. cuda::GpuMat & dst);
  379. Point warp(const cuda::GpuMat & src, InputArray K, InputArray R, InputArray T, int interp_mode, int border_mode,
  380. cuda::GpuMat & dst);
  381. private:
  382. cuda::GpuMat d_xmap_, d_ymap_, d_src_, d_dst_;
  383. };
  384. class CV_EXPORTS SphericalWarperGpu : public SphericalWarper
  385. {
  386. public:
  387. SphericalWarperGpu(float scale) : SphericalWarper(scale) {}
  388. Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) CV_OVERRIDE
  389. {
  390. Rect result = buildMaps(src_size, K, R, d_xmap_, d_ymap_);
  391. d_xmap_.download(xmap);
  392. d_ymap_.download(ymap);
  393. return result;
  394. }
  395. Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
  396. OutputArray dst) CV_OVERRIDE
  397. {
  398. d_src_.upload(src);
  399. Point result = warp(d_src_, K, R, interp_mode, border_mode, d_dst_);
  400. d_dst_.download(dst);
  401. return result;
  402. }
  403. Rect buildMaps(Size src_size, InputArray K, InputArray R, cuda::GpuMat & xmap, cuda::GpuMat & ymap);
  404. Point warp(const cuda::GpuMat & src, InputArray K, InputArray R, int interp_mode, int border_mode,
  405. cuda::GpuMat & dst);
  406. private:
  407. cuda::GpuMat d_xmap_, d_ymap_, d_src_, d_dst_;
  408. };
  409. class CV_EXPORTS CylindricalWarperGpu : public CylindricalWarper
  410. {
  411. public:
  412. CylindricalWarperGpu(float scale) : CylindricalWarper(scale) {}
  413. Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) CV_OVERRIDE
  414. {
  415. Rect result = buildMaps(src_size, K, R, d_xmap_, d_ymap_);
  416. d_xmap_.download(xmap);
  417. d_ymap_.download(ymap);
  418. return result;
  419. }
  420. Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
  421. OutputArray dst) CV_OVERRIDE
  422. {
  423. d_src_.upload(src);
  424. Point result = warp(d_src_, K, R, interp_mode, border_mode, d_dst_);
  425. d_dst_.download(dst);
  426. return result;
  427. }
  428. Rect buildMaps(Size src_size, InputArray K, InputArray R, cuda::GpuMat & xmap, cuda::GpuMat & ymap);
  429. Point warp(const cuda::GpuMat & src, InputArray K, InputArray R, int interp_mode, int border_mode,
  430. cuda::GpuMat & dst);
  431. private:
  432. cuda::GpuMat d_xmap_, d_ymap_, d_src_, d_dst_;
  433. };
  434. struct CV_EXPORTS SphericalPortraitProjector : ProjectorBase
  435. {
  436. void mapForward(float x, float y, float &u, float &v);
  437. void mapBackward(float u, float v, float &x, float &y);
  438. };
  439. // Projects image onto unit sphere with origin at (0, 0, 0).
  440. // Poles are located NOT at (0, -1, 0) and (0, 1, 0) points, BUT at (1, 0, 0) and (-1, 0, 0) points.
  441. class CV_EXPORTS SphericalPortraitWarper : public RotationWarperBase<SphericalPortraitProjector>
  442. {
  443. public:
  444. SphericalPortraitWarper(float scale) { projector_.scale = scale; }
  445. protected:
  446. void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br) CV_OVERRIDE;
  447. };
  448. struct CV_EXPORTS CylindricalPortraitProjector : ProjectorBase
  449. {
  450. void mapForward(float x, float y, float &u, float &v);
  451. void mapBackward(float u, float v, float &x, float &y);
  452. };
  453. class CV_EXPORTS CylindricalPortraitWarper : public RotationWarperBase<CylindricalPortraitProjector>
  454. {
  455. public:
  456. CylindricalPortraitWarper(float scale) { projector_.scale = scale; }
  457. protected:
  458. void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br) CV_OVERRIDE
  459. {
  460. RotationWarperBase<CylindricalPortraitProjector>::detectResultRoiByBorder(src_size, dst_tl, dst_br);
  461. }
  462. };
  463. struct CV_EXPORTS PlanePortraitProjector : ProjectorBase
  464. {
  465. void mapForward(float x, float y, float &u, float &v);
  466. void mapBackward(float u, float v, float &x, float &y);
  467. };
  468. class CV_EXPORTS PlanePortraitWarper : public RotationWarperBase<PlanePortraitProjector>
  469. {
  470. public:
  471. PlanePortraitWarper(float scale) { projector_.scale = scale; }
  472. protected:
  473. void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br) CV_OVERRIDE
  474. {
  475. RotationWarperBase<PlanePortraitProjector>::detectResultRoiByBorder(src_size, dst_tl, dst_br);
  476. }
  477. };
  478. //! @} stitching_warp
  479. } // namespace detail
  480. } // namespace cv
  481. #include "warpers_inl.hpp"
  482. #endif // OPENCV_STITCHING_WARPERS_HPP