motion_estimation.cpp
Go to the documentation of this file.
00001 
00024 #include "rgbdtools/registration/motion_estimation.h"
00025 
00026 namespace rgbdtools {
00027 
00028 MotionEstimation::MotionEstimation()
00029 {
00030 
00031 }
00032 
00033 MotionEstimation::~MotionEstimation()
00034 {
00035 
00036 }
00037 
00038 AffineTransform MotionEstimation::getMotionEstimation(
00039   RGBDFrame& frame,
00040   const AffineTransform& prediction)
00041 {
00043   
00044   AffineTransform motion;
00045   bool result;
00046 
00047   if (frame.n_valid_keypoints == 0)
00048   {
00049     std::cerr << "No features detected." << std::endl;
00050     result = false;
00051   }
00052   else
00053   {
00054     result = getMotionEstimationImpl(frame, prediction, motion);
00055   }
00056 
00057   if (!result)
00058   {
00059     std::cerr << "Could not estimate motion from RGBD data, using Identity transform." 
00060               << std::endl;
00061     motion.setIdentity();
00062   }
00063 
00064   return motion;
00065 }
00066 
00067 void MotionEstimation::constrainMotion(AffineTransform& motion)
00068 {
00069   // **** degree-of-freedom constraints
00070 
00071   if (motion_constraint_ == ROLL_PITCH)
00072   {
00073     float x, y, z, roll, pitch, yaw;
00074     eigenAffineToXYZRPY(motion, x, y, z, roll, pitch, yaw);
00075     XYZRPYToEigenAffine(x, y, z, 0, 0, yaw, motion);
00076   }
00077   else if (motion_constraint_ == ROLL_PITCH_Z)
00078   {
00079     float x, y, z, roll, pitch, yaw;
00080     eigenAffineToXYZRPY(motion, x, y, z, roll, pitch, yaw);
00081     XYZRPYToEigenAffine(x, y, 0, 0, 0, yaw, motion);
00082   }
00083 }
00084 
00085 void MotionEstimation::setBaseToCameraTf(const AffineTransform& b2c)
00086 {
00087   b2c_ = b2c;
00088 }
00089 
00090 void MotionEstimation::setMotionConstraint(int motion_constraint)
00091 {
00092   motion_constraint_ = motion_constraint;
00093 }
00094 
00095 } // namespace rgbdtools
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends


lib_rgbdtools
Author(s): Ivan Dryanovski
autogenerated on Tue Aug 27 2013 10:33:54