diff --git a/modules/viz/include/opencv2/viz.hpp b/modules/viz/include/opencv2/viz.hpp index fda105adc5..137183476d 100644 --- a/modules/viz/include/opencv2/viz.hpp +++ b/modules/viz/include/opencv2/viz.hpp @@ -44,8 +44,8 @@ // //M*/ -#ifndef __OPENCV_VIZ_HPP -#define __OPENCV_VIZ_HPP +#ifndef __OPENCV_VIZ_HPP__ +#define __OPENCV_VIZ_HPP__ #include @@ -53,5 +53,14 @@ #include -#endif __OPENCV_VIZ_HPP +namespace temp_viz +{ + //! takes coordiante frame data and builds transfrom to global coordinate frame + CV_EXPORTS Affine3f makeTransformToGlobal(const Vec3f& axis_x, const Vec3f& axis_y, const Vec3f& axis_z, const Vec3f& origin = Vec3f::all(0)); + + CV_EXPORTS Affine3f makeCameraPose(const Vec3f& position, const Vec3f& focal_point, const Vec3f& up_vector); +} + + +#endif /* __OPENCV_VIZ_HPP__ */ diff --git a/modules/viz/src/precomp.hpp b/modules/viz/src/precomp.hpp index 4a53d7a4a6..67c9ccd9c2 100644 --- a/modules/viz/src/precomp.hpp +++ b/modules/viz/src/precomp.hpp @@ -154,8 +154,8 @@ #include #include +#include #include "opencv2/viz/widget_accessor.hpp" -#include #include namespace temp_viz diff --git a/modules/viz/src/viz.cpp b/modules/viz/src/viz.cpp index 89d1450033..07c6008093 100644 --- a/modules/viz/src/viz.cpp +++ b/modules/viz/src/viz.cpp @@ -1 +1,20 @@ -#include "precomp.hpp" \ No newline at end of file +#include "precomp.hpp" + + +cv::Affine3f temp_viz::makeTransformToGlobal(const Vec3f& axis_x, const Vec3f& axis_y, const Vec3f& axis_z, const Vec3f& origin) +{ + Affine3f::Mat3 R; + R.val[0] = axis_x.val[0]; + R.val[3] = axis_x.val[1]; + R.val[6] = axis_x.val[2]; + + R.val[1] = axis_y.val[0]; + R.val[4] = axis_y.val[1]; + R.val[7] = axis_y.val[2]; + + R.val[2] = axis_z.val[0]; + R.val[5] = axis_z.val[1]; + R.val[8] = axis_z.val[2]; + + return Affine3f(R, origin); +}