}\r
};\r
\r
+struct PlanePortraitProjector : ProjectorBase\r
+{\r
+ void mapForward(float x, float y, float &u, float &v);\r
+ void mapBackward(float u, float v, float &x, float &y);\r
+};\r
+\r
+\r
+class PlanePortraitWarper : public RotationWarperBase<PlanePortraitProjector>\r
+{\r
+public:\r
+ PlanePortraitWarper(float scale) { projector_.scale = scale; }\r
+\r
+protected:\r
+ void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br)\r
+ { \r
+ RotationWarperBase<PlanePortraitProjector>::detectResultRoiByBorder(src_size, dst_tl, dst_br); \r
+ }\r
+};\r
\r
} // namespace detail\r
} // namespace cv\r
else x = y = -1;\r
}\r
\r
+inline\r
+void PlanePortraitProjector::mapForward(float x, float y, float &u0, float &v0)\r
+{\r
+ float x0_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2];\r
+ float y0_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5];\r
+ float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8];\r
+\r
+ float x_ = y0_;\r
+ float y_ = x0_;\r
+\r
+ x_ = t[0] + x_ / z_ * (1 - t[2]);\r
+ y_ = t[1] + y_ / z_ * (1 - t[2]);\r
+\r
+ float u,v;\r
+ u = scale * x_;\r
+ v = scale * y_;\r
+\r
+ u0 = -u;\r
+ v0 = v;\r
+}\r
+\r
+\r
+inline\r
+void PlanePortraitProjector::mapBackward(float u0, float v0, float &x, float &y)\r
+{\r
+ float u, v;\r
+ u = -u0;\r
+ v = v0;\r
+\r
+ u = u / scale - t[0];\r
+ v = v / scale - t[1];\r
+\r
+ float z;\r
+ x = k_rinv[0] * v + k_rinv[1] * u + k_rinv[2] * (1 - t[2]);\r
+ y = k_rinv[3] * v + k_rinv[4] * u + k_rinv[5] * (1 - t[2]);\r
+ z = k_rinv[6] * v + k_rinv[7] * u + k_rinv[8] * (1 - t[2]);\r
+\r
+ x /= z;\r
+ y /= z;\r
+}\r
+\r
+\r
} // namespace detail\r
} // namespace cv\r
\r