diff --git a/CMakeLists.txt b/CMakeLists.txt index 717982f..3f5770a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,6 +88,7 @@ add_dependencies(msckf_vio target_link_libraries(msckf_vio ${catkin_LIBRARIES} ${SUITESPARSE_LIBRARIES} + ${OpenCV_LIBRARIES} ) # Msckf Vio nodelet diff --git a/include/msckf_vio/feature.hpp b/include/msckf_vio/feature.hpp index 32b60b6..45abbaf 100644 --- a/include/msckf_vio/feature.hpp +++ b/include/msckf_vio/feature.hpp @@ -177,6 +177,9 @@ struct Feature { // Position of NxN Patch in 3D space std::vector anchorPatch_3d; + // Anchor Isometry + Eigen::Isometry3d T_anchor_w; + // 3d postion of the feature in the world frame. Eigen::Vector3d position; @@ -335,8 +338,11 @@ bool Feature::projectPixelToPosition(cv::Point2f in_p, // use undistorted position of point of interest // project it back into 3D space using pinhole model // save resulting NxN positions for this feature - anchorPatch_3d.push_back(Eigen::Vector3d(in_p.x/rho, in_p.y/rho, 1/rho)); - printf("%f, %f, %f\n",in_p.x/rho, in_p.y/rho, 1/rho); + + Eigen::Vector3d PositionInCamera(in_p.x/rho, in_p.y/rho, 1/rho); + Eigen::Vector3d PositionInWorld= T_anchor_w.linear()*PositionInCamera + T_anchor_w.translation(); + anchorPatch_3d.push_back(PositionInWorld); + printf("%f, %f, %f\n",PositionInWorld[0], PositionInWorld[1], PositionInWorld[2]); } bool Feature::initializeAnchor( @@ -412,6 +418,7 @@ bool Feature::initializePosition( // vector from the first camera frame in the buffer to this // camera frame. Eigen::Isometry3d T_c0_w = cam_poses[0]; + T_anchor_w = T_c0_w; for (auto& pose : cam_poses) pose = pose.inverse() * T_c0_w; diff --git a/include/msckf_vio/image_handler.h b/include/msckf_vio/image_handler.h index 8fd9ff9..f35e3a7 100644 --- a/include/msckf_vio/image_handler.h +++ b/include/msckf_vio/image_handler.h @@ -1,13 +1,14 @@ #ifndef MSCKF_VIO_IMAGE_HANDLER_H #define MSCKF_VIO_IMAGE_HANDLER_H -#include -#include +#include +#include #include #include + +#include #include -#include -#include + namespace msckf_vio { /* diff --git a/src/image_handler.cpp b/src/image_handler.cpp index 6f5bad7..3db65b5 100644 --- a/src/image_handler.cpp +++ b/src/image_handler.cpp @@ -1,4 +1,14 @@ -#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include namespace msckf_vio { namespace image_handler {