misc2.h
Go to the documentation of this file.
00001 #ifndef RGBD_SLAM_MISC2_H_
00002 #define RGBD_SLAM_MISC2_H_
00003 /* This file is part of RGBDSLAM.
00004  * 
00005  * RGBDSLAM is free software: you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation, either version 3 of the License, or
00008  * (at your option) any later version.
00009  * 
00010  * RGBDSLAM is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  * 
00015  * You should have received a copy of the GNU General Public License
00016  * along with RGBDSLAM.  If not, see <http://www.gnu.org/licenses/>.
00017  */
00018 #include "parameter_server.h"
00019 
00020 inline double depth_std_dev(double depth)
00021 {
00022   // From Khoselham and Elberink?
00023   static double depth_std_dev = ParameterServer::instance()->get<double>("sigma_depth");
00024   // Previously used 0.006 from information on http://www.ros.org/wiki/openni_kinect/kinect_accuracy;
00025   // ...using 2sigma = 95%ile
00026   //static const double depth_std_dev  = 0.006;
00027   return depth_std_dev * depth * depth;
00028 }
00029 //Functions without dependencies
00030 inline double depth_covariance(double depth)
00031 {
00032   static double stddev = depth_std_dev(depth);
00033   static double cov = stddev * stddev;
00034   return cov;
00035 }
00036 
00037 inline Eigen::Matrix3d point_information_matrix(double distance)
00038 {
00039   Eigen::Matrix3d inf_mat = Eigen::Matrix3d::Identity();
00040   /* Std dev of 1 pixel in xy boils down to identity for 0,0 and 1,1:
00041   inf_mat(0,0) = 1.0/1.0;//-> 1/pixel_dist*pixel_dist
00042   inf_mat(1,1) = 1.0/1.0; 
00043   */
00044   inf_mat(2,2) = 1.0/depth_covariance(distance);
00045 
00046   return inf_mat;
00047 }
00048 
00049 inline void backProject(const float& fxinv, const float& fyinv,
00050                         const float& cx, const float& cy,
00051                         const float& u,  const float& v, const float& z,
00052                         float& out_x,  float& out_y, float& out_z)
00053 {
00054     //If depth is distance, not distance projected onto optical axis:
00055   /*
00056     float tmpx = (u-cx) * fxinv;
00057     float tmpy = (v-cy) * fyinv;
00058     out_z = z / std::sqrt(tmpx*tmpx + tmpy*tmpy + 1 ) ;
00059     out_x = tmpx * out_z;
00060     out_y = tmpy * out_z;
00061   */
00062   out_x = (u - cx) * z * fxinv;
00063   out_y = (v - cy) * z * fyinv;
00064   out_z = z;
00065 }
00066 #endif


rgbdslam_v2
Author(s): Felix Endres, Juergen Hess, Nikolas Engelhard
autogenerated on Thu Jun 6 2019 21:49:45