diff options
author | Martin Miller | 2017-03-24 13:32:25 -0500 |
---|---|---|
committer | Martin Miller | 2017-03-24 13:32:25 -0500 |
commit | bd2b2ae18c2c9416fd57a02b187d42b805969af0 (patch) | |
tree | 6d73c31142ddda14413b5f437e3cecd8d57893ce /src/camera.cpp | |
parent | 9458b30126e346c9e0d373c9df5690655bf7f8ab (diff) | |
download | refslam-bd2b2ae18c2c9416fd57a02b187d42b805969af0.zip refslam-bd2b2ae18c2c9416fd57a02b187d42b805969af0.tar.gz |
Move feature depth calculation to Feature class.
And also fixed F computation for features.
I realized that the features were transformed from image to body frame
prior to being passed to State. This makes sense because the State
really doesn't need to know about Camera objects. Since the camera was
no longer necessary inside of State it made sense to move the depth
computation from Camera::ref2body() into a method in the Feature class
that does not rely on camera parameters.
Additionally, the depth solver was changed from a simple matrix
inversion to a least squares calculation.
Fx in the feature class was fixed to take into account dt.
Updating Pkk1 is in the process of being modified to handle features.
Diffstat (limited to 'src/camera.cpp')
-rw-r--r-- | src/camera.cpp | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/src/camera.cpp b/src/camera.cpp index 9b7c134..d522cd6 100644 --- a/src/camera.cpp +++ b/src/camera.cpp @@ -134,56 +134,3 @@ Camera::img2body ( Vector3d &xi ) return xb; } /* ----- end of method Camera::img2body ----- */ -/* - *-------------------------------------------------------------------------------------- - * Class: Camera - * Method: Camera :: ref2body - * Description: Determines the feature position with respect to the body from a - * source reflection correspondence xs & sr given the body rotation and height. - *-------------------------------------------------------------------------------------- - */ -Vector3d -Camera::ref2body ( double z, const Quaterniond &qbw, const Vector3d &xs, - const Vector3d &xr ) -{ - // The output vector - Vector3d xb; - Vector4d xb4; - - // Rotation from body to camera - Matrix<double,4,4> Rbc4; - Rbc4 = Rc2b4().transpose(); - - // Projection matrices - Matrix<double,4,4> P1,P2,P; - P1 = K4()*Rbc4; - - // Rotation from body to world - Matrix<double,3,3> Rbw; - Matrix<double,4,4> Rbw4,Rwb4; - Rbw = qbw.toRotationMatrix(); - Rbw4 = Matrix<double,4,4>::Identity(); - Rbw4.block<3,3>(0,0) = Rbw; - Rwb4 = Rbw4.transpose(); - - - Matrix<double,4,4> J; // Reflection matrix - J = Matrix<double,4,4>::Identity(); - J(2,2) = -1; - J(2,3) = -2*z; - - P2 = K4()*Rbc4*Rwb4*J*Rbw4; - P.block<3,4>(0,0) = P1.block<3,4>(0,0); - P.block<1,4>(3,0) = P2.block<1,4>(1,0); - - Vector4d b; - b.segment<3>(0) = xs; - b[3] = xr[1]; - - xb4 = P.inverse()*b; - xb4 /= xb4[3]; - xb = xb4.segment<3>(0); - - return xb ; -} /* ----- end of method Camera::ref2body ----- */ - |