forked from gaoxiang12/slambook
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
xiang.gao
committed
Sep 12, 2016
1 parent
eea286f
commit 7892d91
Showing
15 changed files
with
507 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,117 @@ | ||
#include "myslam/g2o_types.h" | ||
#include "myslam/g2o_types.h" | ||
|
||
namespace myslam | ||
{ | ||
void EdgeProjectXYZRGBD::computeError() | ||
{ | ||
const g2o::VertexSBAPointXYZ* point = static_cast<const g2o::VertexSBAPointXYZ*> ( _vertices[0] ); | ||
const g2o::VertexSE3Expmap* pose = static_cast<const g2o::VertexSE3Expmap*> ( _vertices[1] ); | ||
_error = _measurement - pose->estimate().map ( point->estimate() ); | ||
} | ||
|
||
void EdgeProjectXYZRGBD::linearizeOplus() | ||
{ | ||
g2o::VertexSE3Expmap* pose = static_cast<g2o::VertexSE3Expmap *> ( _vertices[1] ); | ||
g2o::SE3Quat T ( pose->estimate() ); | ||
g2o::VertexSBAPointXYZ* point = static_cast<g2o::VertexSBAPointXYZ*> ( _vertices[0] ); | ||
Eigen::Vector3d xyz = point->estimate(); | ||
Eigen::Vector3d xyz_trans = T.map ( xyz ); | ||
double x = xyz_trans[0]; | ||
double y = xyz_trans[1]; | ||
double z = xyz_trans[2]; | ||
|
||
_jacobianOplusXi = - T.rotation().toRotationMatrix(); | ||
|
||
_jacobianOplusXj ( 0,0 ) = 0; | ||
_jacobianOplusXj ( 0,1 ) = -z; | ||
_jacobianOplusXj ( 0,2 ) = y; | ||
_jacobianOplusXj ( 0,3 ) = -1; | ||
_jacobianOplusXj ( 0,4 ) = 0; | ||
_jacobianOplusXj ( 0,5 ) = 0; | ||
|
||
_jacobianOplusXj ( 1,0 ) = z; | ||
_jacobianOplusXj ( 1,1 ) = 0; | ||
_jacobianOplusXj ( 1,2 ) = -x; | ||
_jacobianOplusXj ( 1,3 ) = 0; | ||
_jacobianOplusXj ( 1,4 ) = -1; | ||
_jacobianOplusXj ( 1,5 ) = 0; | ||
|
||
_jacobianOplusXj ( 2,0 ) = -y; | ||
_jacobianOplusXj ( 2,1 ) = x; | ||
_jacobianOplusXj ( 2,2 ) = 0; | ||
_jacobianOplusXj ( 2,3 ) = 0; | ||
_jacobianOplusXj ( 2,4 ) = 0; | ||
_jacobianOplusXj ( 2,5 ) = -1; | ||
} | ||
|
||
void EdgeProjectXYZRGBDPoseOnly::computeError() | ||
{ | ||
const g2o::VertexSE3Expmap* pose = static_cast<const g2o::VertexSE3Expmap*> ( _vertices[0] ); | ||
_error = _measurement - pose->estimate().map ( point_ ); | ||
} | ||
|
||
void EdgeProjectXYZRGBDPoseOnly::linearizeOplus() | ||
{ | ||
g2o::VertexSE3Expmap* pose = static_cast<g2o::VertexSE3Expmap*> ( _vertices[0] ); | ||
g2o::SE3Quat T ( pose->estimate() ); | ||
Vector3d xyz_trans = T.map ( point_ ); | ||
double x = xyz_trans[0]; | ||
double y = xyz_trans[1]; | ||
double z = xyz_trans[2]; | ||
|
||
_jacobianOplusXi ( 0,0 ) = 0; | ||
_jacobianOplusXi ( 0,1 ) = -z; | ||
_jacobianOplusXi ( 0,2 ) = y; | ||
_jacobianOplusXi ( 0,3 ) = -1; | ||
_jacobianOplusXi ( 0,4 ) = 0; | ||
_jacobianOplusXi ( 0,5 ) = 0; | ||
|
||
_jacobianOplusXi ( 1,0 ) = z; | ||
_jacobianOplusXi ( 1,1 ) = 0; | ||
_jacobianOplusXi ( 1,2 ) = -x; | ||
_jacobianOplusXi ( 1,3 ) = 0; | ||
_jacobianOplusXi ( 1,4 ) = -1; | ||
_jacobianOplusXi ( 1,5 ) = 0; | ||
|
||
_jacobianOplusXi ( 2,0 ) = -y; | ||
_jacobianOplusXi ( 2,1 ) = x; | ||
_jacobianOplusXi ( 2,2 ) = 0; | ||
_jacobianOplusXi ( 2,3 ) = 0; | ||
_jacobianOplusXi ( 2,4 ) = 0; | ||
_jacobianOplusXi ( 2,5 ) = -1; | ||
} | ||
|
||
void EdgeProjectXYZ2UVPoseOnly::computeError() | ||
{ | ||
const g2o::VertexSE3Expmap* pose = static_cast<const g2o::VertexSE3Expmap*> ( _vertices[0] ); | ||
_error = _measurement - camera_->camera2pixel ( | ||
pose->estimate().map(point_) ); | ||
} | ||
|
||
void EdgeProjectXYZ2UVPoseOnly::linearizeOplus() | ||
{ | ||
g2o::VertexSE3Expmap* pose = static_cast<g2o::VertexSE3Expmap*> ( _vertices[0] ); | ||
g2o::SE3Quat T ( pose->estimate() ); | ||
Vector3d xyz_trans = T.map ( point_ ); | ||
double x = xyz_trans[0]; | ||
double y = xyz_trans[1]; | ||
double z = xyz_trans[2]; | ||
double z_2 = z*z; | ||
|
||
_jacobianOplusXi ( 0,0 ) = x*y/z_2 *camera_->fx_; | ||
_jacobianOplusXi ( 0,1 ) = - ( 1+ ( x*x/z_2 ) ) *camera_->fx_; | ||
_jacobianOplusXi ( 0,2 ) = y/z * camera_->fx_; | ||
_jacobianOplusXi ( 0,3 ) = -1./z * camera_->fx_; | ||
_jacobianOplusXi ( 0,4 ) = 0; | ||
_jacobianOplusXi ( 0,5 ) = x/z_2 * camera_->fx_; | ||
|
||
_jacobianOplusXi ( 1,0 ) = ( 1+y*y/z_2 ) *camera_->fy_; | ||
_jacobianOplusXi ( 1,1 ) = -x*y/z_2 *camera_->fy_; | ||
_jacobianOplusXi ( 1,2 ) = -x/z *camera_->fy_; | ||
_jacobianOplusXi ( 1,3 ) = 0; | ||
_jacobianOplusXi ( 1,4 ) = -1./z *camera_->fy_; | ||
_jacobianOplusXi ( 1,5 ) = y/z_2 *camera_->fy_; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.