Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing some errors preventing me from compiling #25

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions vikit_common/include/vikit/homography.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct HomographyDecomposition
Vector3d n;

// Resolved Composition
Sophus::SE3 T; //!< second from first
Sophus::SE3d T; //!< second from first
int score;
};

Expand Down Expand Up @@ -72,7 +72,7 @@ class Homography
const vector<Vector2d, aligned_allocator<Vector2d> >& fts_c1; //!< Features on first image on unit plane
const vector<Vector2d, aligned_allocator<Vector2d> >& fts_c2; //!< Features on second image on unit plane
vector<bool> inliers;
SE3 T_c2_from_c1; //!< Relative translation and rotation of two images
SE3d T_c2_from_c1; //!< Relative translation and rotation of two images
Matrix3d H_c2_from_c1; //!< Homography
vector<HomographyDecomposition> decompositions;
};
Expand Down
14 changes: 7 additions & 7 deletions vikit_common/include/vikit/img_align.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ using namespace vk;
using namespace Sophus;

//! Forward Compositional Image Alignment
class ForwardCompositionalSE3 : public NLLSSolver<6, SE3> {
class ForwardCompositionalSE3 : public NLLSSolver<6, SE3d> {

protected:
vector<vk::PinholeCamera>& cam_pyr_;
Expand All @@ -45,7 +45,7 @@ class ForwardCompositionalSE3 : public NLLSSolver<6, SE3> {
double res_thresh_;

virtual double
computeResiduals (const SE3& model, bool linearize_system, bool compute_weight_scale = false);
computeResiduals (const SE3d& model, bool linearize_system, bool compute_weight_scale = false);

virtual int
solve();
Expand All @@ -68,7 +68,7 @@ class ForwardCompositionalSE3 : public NLLSSolver<6, SE3> {
vector<cv::Mat>& tpl_pyr,
vector<cv::Mat>& img_pyr_dx,
vector<cv::Mat>& img_pyr_dy,
SE3& init_model,
SE3d& init_model,
int n_levels,
int n_iter = 50,
float res_thresh = 0.2,
Expand All @@ -90,13 +90,13 @@ class ForwardCompositionalSE3 : public NLLSSolver<6, SE3> {
int test_id = 0);

void
runOptimization(SE3& model, int levelBegin = -1, int levelEnd = -1);
runOptimization(SE3d& model, int levelBegin = -1, int levelEnd = -1);

};


//! Efficient Second Order Minimization (ESM)
class SecondOrderMinimisationSE3 : public NLLSSolver<6, SE3> {
class SecondOrderMinimisationSE3 : public NLLSSolver<6, SE3d> {

protected:
vector<vk::PinholeCamera>& cam_pyr_;
Expand All @@ -114,7 +114,7 @@ class SecondOrderMinimisationSE3 : public NLLSSolver<6, SE3> {
float res_thresh_;

virtual double
computeResiduals (const SE3& model, bool linearize_system, bool compute_weight_scale = false);
computeResiduals (const SE3d& model, bool linearize_system, bool compute_weight_scale = false);

virtual int
solve();
Expand All @@ -139,7 +139,7 @@ class SecondOrderMinimisationSE3 : public NLLSSolver<6, SE3> {
vector<cv::Mat>& img_pyr_dy,
vector<cv::Mat>& tpl_pyr_dx,
vector<cv::Mat>& tpl_pyr_dy,
SE3& init_model,
SE3d& init_model,
int n_levels,
int n_iter = 50,
float res_thresh = 0.2,
Expand Down
11 changes: 6 additions & 5 deletions vikit_common/include/vikit/math_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#define MATH_UTILS_H_


#include <Eigen/LU>
#include <Eigen/Core>
#include <Eigen/StdVector>
#include <sophus/se3.h>
Expand Down Expand Up @@ -42,19 +43,19 @@ double reprojError(
double error_multiplier2);

double computeInliers(
const vector<Vector3d>& features1,
const vector<Vector3d>& features2,
const vector<Vector3d, aligned_allocator<Vector3d> >& features1,
const vector<Vector3d, aligned_allocator<Vector3d> >& features2,
const Matrix3d& R,
const Vector3d& t,
const double reproj_thresh,
double error_multiplier2,
vector<Vector3d>& xyz_vec,
vector<Vector3d, aligned_allocator<Vector3d> >& xyz_vec,
vector<int>& inliers,
vector<int>& outliers);

void computeInliersOneView(
const vector<Vector3d> & feature_sphere_vec,
const vector<Vector3d> & xyz_vec,
const vector<Vector3d, aligned_allocator<Vector3d> > & feature_sphere_vec,
const vector<Vector3d, aligned_allocator<Vector3d> > & xyz_vec,
const Matrix3d &R,
const Vector3d &t,
const double reproj_thresh,
Expand Down
8 changes: 4 additions & 4 deletions vikit_common/src/homography.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void Homography::
calcFromPlaneParams(const Vector3d& n_c1, const Vector3d& xyz_c1)
{
double d = n_c1.dot(xyz_c1); // normal distance from plane to KF
H_c2_from_c1 = T_c2_from_c1.rotation_matrix() + (T_c2_from_c1.translation()*n_c1.transpose())/d;
H_c2_from_c1 = T_c2_from_c1.rotationMatrix() + (T_c2_from_c1.translation()*n_c1.transpose())/d;
}

void Homography::
Expand Down Expand Up @@ -195,7 +195,7 @@ decompose()
{
Matrix3d R = s * U * decompositions[i].R * V.transpose();
Vector3d t = U * decompositions[i].t;
decompositions[i].T = Sophus::SE3(R, t);
decompositions[i].T = Sophus::SE3d(R, t);
}
return true;
}
Expand Down Expand Up @@ -259,8 +259,8 @@ findBestDecomposition()
double adSampsonusScores[2];
for(size_t i=0; i<2; i++)
{
Sophus::SE3 T = decompositions[i].T;
Matrix3d Essential = T.rotation_matrix() * sqew(T.translation());
Sophus::SE3d T = decompositions[i].T;
Matrix3d Essential = T.rotationMatrix() * sqew(T.translation());
double dSumError = 0;
for(size_t m=0; m < fts_c1.size(); m++ )
{
Expand Down
14 changes: 7 additions & 7 deletions vikit_common/src/img_align.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ ForwardCompositionalSE3( vector<PinholeCamera>& cam_pyr,
vector<cv::Mat>& tpl_pyr,
vector<cv::Mat>& img_pyr_dx,
vector<cv::Mat>& img_pyr_dy,
SE3& init_model,
SE3d& init_model,
int n_levels,
int n_iter,
float res_thresh,
Expand Down Expand Up @@ -115,7 +115,7 @@ ForwardCompositionalSE3( vector<PinholeCamera>& cam_pyr,
}

void ForwardCompositionalSE3::
runOptimization(SE3& model, int levelBegin, int levelEnd)
runOptimization(SE3d& model, int levelBegin, int levelEnd)
{
if(levelBegin < 0 || levelBegin > n_levels_-1)
levelBegin = n_levels_-1;
Expand All @@ -133,7 +133,7 @@ runOptimization(SE3& model, int levelBegin, int levelEnd)
}

double ForwardCompositionalSE3::
computeResiduals (const SE3& model, bool linearize_system, bool compute_weight_scale)
computeResiduals (const SE3d& model, bool linearize_system, bool compute_weight_scale)
{
// Warp the image such that it aligns with the template image
double chi2 = 0;
Expand Down Expand Up @@ -206,7 +206,7 @@ solve()
void ForwardCompositionalSE3::
update(const ModelType& old_model, ModelType& new_model)
{
new_model = SE3::exp(x_)*(old_model);
new_model = SE3d::exp(x_)*(old_model);
}

void ForwardCompositionalSE3::
Expand Down Expand Up @@ -252,7 +252,7 @@ SecondOrderMinimisationSE3( vector<PinholeCamera>& cam_pyr,
vector<cv::Mat>& img_pyr_dy,
vector<cv::Mat>& tpl_pyr_dx,
vector<cv::Mat>& tpl_pyr_dy,
SE3& init_model,
SE3d& init_model,
int n_levels,
int n_iter,
float res_thresh,
Expand Down Expand Up @@ -306,7 +306,7 @@ SecondOrderMinimisationSE3( vector<PinholeCamera>& cam_pyr,
}

double SecondOrderMinimisationSE3::
computeResiduals (const SE3& model, bool linearize_system, bool compute_weight_scale)
computeResiduals (const SE3d& model, bool linearize_system, bool compute_weight_scale)
{
// Warp the image such that it aligns with the template image
double chi2 = 0;
Expand Down Expand Up @@ -406,7 +406,7 @@ solve()
void SecondOrderMinimisationSE3::
update(const ModelType& old_model, ModelType& new_model)
{
new_model = SE3::exp(x_)*old_model;
new_model = SE3d::exp(x_)*old_model;
}

void SecondOrderMinimisationSE3::
Expand Down
10 changes: 5 additions & 5 deletions vikit_common/src/math_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ reprojError(const Vector3d& f1,
}

double
computeInliers(const vector<Vector3d>& features1, // c1
const vector<Vector3d>& features2, // c2
computeInliers(const vector<Vector3d, aligned_allocator<Vector3d> >& features1, // c1
const vector<Vector3d, aligned_allocator<Vector3d> >& features2, // c2
const Matrix3d& R, // R_c1_c2
const Vector3d& t, // c1_t
const double reproj_thresh,
double error_multiplier2,
vector<Vector3d>& xyz_vec, // in frame c1
vector<Vector3d, aligned_allocator<Vector3d> >& xyz_vec, // in frame c1
vector<int>& inliers,
vector<int>& outliers)
{
Expand All @@ -95,8 +95,8 @@ computeInliers(const vector<Vector3d>& features1, // c1
}

void
computeInliersOneView(const vector<Vector3d> & feature_sphere_vec,
const vector<Vector3d> & xyz_vec,
computeInliersOneView(const vector<Vector3d, aligned_allocator<Vector3d> > & feature_sphere_vec,
const vector<Vector3d, aligned_allocator<Vector3d> > & xyz_vec,
const Matrix3d &R,
const Vector3d &t,
const double reproj_thresh,
Expand Down