CubicInterpolator and BiCubicInterpolator to allow smooth interpolation of sampled functions and integration with automatic differentiation.class EAResidue {
public:
/// Set the constants of the problem
/// @param list_edge_ref : a list of 3d points in reference image 3xN
/// @param now_dist_transform_eig : distance transform of now frame as an image (row x cols)
EAResidue( MatrixXd& __list_edge_ref, MatrixXd& __now_dist_transform_eig, Matrix3d& K )
{
list_edge_ref = __list_edge_ref;
now_dist_transform_eig = __now_dist_transform_eig;
fx = ( K(0,0) );
fy = ( K(1,1) );
cx = ( K(0,2) );
cy = ( K(1,2) );
}
template <typename T>
bool operator()(const T* const Q, const T* const t, T* residual) const
{
T R[9];
ceres::QuaternionToRotation(Q, R); //use `ceres::QuaternionRotatePoint`
for( int i =0 ; i<list_edge_ref.cols() ; i++ )
{
T _x = T(list_edge_ref(0,i));
T _y = T(list_edge_ref(1,i));
T _z = T(list_edge_ref(2,i));
// xd = R*x + t
T _xd = t[0] + R[0] * _x + R[3] * _y + R[6] * _z;
T _yd = t[1] + R[1] * _x + R[4] * _y + R[7] * _z;
T _zd = t[2] + R[2] * _x + R[5] * _y + R[8] * _z;
// de-homegenous and project
T _u = T(fx) * _xd / _zd + T(cx);
T _v = T(fy) * _yd / _zd + T(cy);
double readVal = now_dist_transform_eig( _v, _u);
// residual[i] = T( now_dist_transform_eig( (int)_v, (int)_u) ); // <<<<<< This line is the trouble.
}
return true;
}
private:
MatrixXd list_edge_ref;
MatrixXd now_dist_transform_eig;
double fx, fy, cx, cy;
};--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/c56bceb3-8004-4237-8b49-7761ee47cd04%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/c56bceb3-8004-4237-8b49-7761ee47cd04%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Ceres Solver" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ceres-solver/JBPk9Aj0qio/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ceres-solver+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/CABqdRUA9NW2HSb-qX-%2Bpjcf%3DuP40kS5WZ4jh2AkDzMOGi7t0-g%40mail.gmail.com.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/c56bceb3-8004-4237-8b49-7761ee47cd04%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Ceres Solver" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ceres-solver/JBPk9Aj0qio/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/CABqdRUA9NW2HSb-qX-%2Bpjcf%3DuP40kS5WZ4jh2AkDzMOGi7t0-g%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/CAP%2Bw43vWDnQPPo6C-ToPFR_%3DuuzQFRPVyi6_TLB3j7EX173_ug%40mail.gmail.com.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/c56bceb3-8004-4237-8b49-7761ee47cd04%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Ceres Solver" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ceres-solver/JBPk9Aj0qio/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ceres-solver+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/CABqdRUA9NW2HSb-qX-%2Bpjcf%3DuP40kS5WZ4jh2AkDzMOGi7t0-g%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/CAP%2Bw43vWDnQPPo6C-ToPFR_%3DuuzQFRPVyi6_TLB3j7EX173_ug%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Ceres Solver" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ceres-solver/JBPk9Aj0qio/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ceres-solver+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/CABqdRUBCrHWPiTEVm039VBLrEO9EfVDW7N3fhSZuk%2BSJJ8BwFA%40mail.gmail.com.
MatrixXd a; // Fill a somehow. Grid2D<double, 1> grid(a.data(), a.rows(), a.cols()); BiCubicInterpolator<Grid2D<double, 1> > interpolated_a(grid); now your cost function should use the interpolated_a instead of a. class EAResidue { public: EAResidue( MatrixXd& list_edge_ref, BiCubicInterpolator<Grid2D<double, 1> >& interpolated_a) : list_edge_ref(list_edge_ref), interpolated_a(interpolated_a) {} |
template <typename T> bool operator()(const T* const Q, const T* const t, T* residual) const { |
/// some calculation |
T _u = T(fx) * _xd / _zd + T(cx); T _v = T(fy) * _yd / _zd + T(cy); |
interpolated_a.Evaluate(_u, _v, residuals + i); |
return true; } private: MatrixXd list_edge_ref; |
const BiCubicInterpolator<Grid2D<double, 1> >& interpolated_a; |
double fx, fy, cx, cy; }; |
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/c56bceb3-8004-4237-8b49-7761ee47cd04%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Ceres Solver" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ceres-solver/JBPk9Aj0qio/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/CABqdRUA9NW2HSb-qX-%2Bpjcf%3DuP40kS5WZ4jh2AkDzMOGi7t0-g%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/CAP%2Bw43vWDnQPPo6C-ToPFR_%3DuuzQFRPVyi6_TLB3j7EX173_ug%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Ceres Solver" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ceres-solver/JBPk9Aj0qio/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/CABqdRUBCrHWPiTEVm039VBLrEO9EfVDW7N3fhSZuk%2BSJJ8BwFA%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/CAP%2Bw43tHqZeLEC6omWptpnHqStr%3D7RUp3b%2B-zKBqM6RtjTVPjw%40mail.gmail.com.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/c56bceb3-8004-4237-8b49-7761ee47cd04%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Ceres Solver" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ceres-solver/JBPk9Aj0qio/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ceres-solver+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/CABqdRUA9NW2HSb-qX-%2Bpjcf%3DuP40kS5WZ4jh2AkDzMOGi7t0-g%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/CAP%2Bw43vWDnQPPo6C-ToPFR_%3DuuzQFRPVyi6_TLB3j7EX173_ug%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Ceres Solver" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ceres-solver/JBPk9Aj0qio/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ceres-solver+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/CABqdRUBCrHWPiTEVm039VBLrEO9EfVDW7N3fhSZuk%2BSJJ8BwFA%40mail.gmail.com.--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/CAP%2Bw43tHqZeLEC6omWptpnHqStr%3D7RUp3b%2B-zKBqM6RtjTVPjw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Ceres Solver" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ceres-solver/JBPk9Aj0qio/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ceres-solver+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/CABqdRUDbBJn44Y6kucO6-dMLJ%2BoKcKtvnmuBw6PPEELspc-_Xw%40mail.gmail.com.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/c56bceb3-8004-4237-8b49-7761ee47cd04%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Ceres Solver" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ceres-solver/JBPk9Aj0qio/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/CABqdRUA9NW2HSb-qX-%2Bpjcf%3DuP40kS5WZ4jh2AkDzMOGi7t0-g%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/CAP%2Bw43vWDnQPPo6C-ToPFR_%3DuuzQFRPVyi6_TLB3j7EX173_ug%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Ceres Solver" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ceres-solver/JBPk9Aj0qio/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/CABqdRUBCrHWPiTEVm039VBLrEO9EfVDW7N3fhSZuk%2BSJJ8BwFA%40mail.gmail.com.--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/CAP%2Bw43tHqZeLEC6omWptpnHqStr%3D7RUp3b%2B-zKBqM6RtjTVPjw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Ceres Solver" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ceres-solver/JBPk9Aj0qio/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/CABqdRUDbBJn44Y6kucO6-dMLJ%2BoKcKtvnmuBw6PPEELspc-_Xw%40mail.gmail.com.
I
const double data[] = {1.0, 3.0, -1.0, 4.0,
3.6, 2.1, 4.2, 2.0,
2.0, 1.0, 3.1, 5.2};
ceres::Grid2D<double, 1> grid(data, 3, 4);/home/mpkuse/Downloads/edge_alignment/standalone/standalone_edge_align.cpp: In function ‘int main()’:
/home/mpkuse/Downloads/edge_alignment/standalone/standalone_edge_align.cpp:111:46: error: no matching function for call to ‘ceres::Grid2D<double, 1>::Grid2D(const double [12], int, int)’
ceres::Grid2D<double, 1> grid(data, 3, 4);
^
In file included from /home/mpkuse/Downloads/edge_alignment/standalone/standalone_edge_align.cpp:16:0:
/usr/local/include/ceres/cubic_interpolation.h:390:3: note: candidate: ceres::Grid2D<T, kDataDimension, kRowMajor, kInterleaved>::Grid2D(const T*, int, int, int, int) [with T = double; int kDataDimension = 1; bool kRowMajor = true; bool kInterleaved = true]
Grid2D(const T* data,
^
/usr/local/include/ceres/cubic_interpolation.h:390:3: note: candidate expects 5 arguments, 3 provided
/usr/local/include/ceres/cubic_interpolation.h:386:8: note: candidate: constexpr ceres::Grid2D<double, 1>::Grid2D(const ceres::Grid2D<double, 1>&)
struct Grid2D {
^
/usr/local/include/ceres/cubic_interpolation.h:386:8: note: candidate expects 1 argument, 3 provided
/usr/local/include/ceres/cubic_interpolation.h:386:8: note: candidate: constexpr ceres::Grid2D<double, 1>::Grid2D(ceres::Grid2D<double, 1>&&)
/usr/local/include/ceres/cubic_interpolation.h:386:8: note: candidate expects 1 argument, 3 provided
CMakeFiles/edge_align.dir/build.make:62: recipe for target 'CMakeFiles/edge_align.dir/standalone_edge_align.cpp.o' failed
make[2]: *** [CMakeFiles/edge_align.dir/standalone_edge_align.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/edge_align.dir/all' failed
make[1]: *** [CMakeFiles/edge_align.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
const double data[] = {1.0, 3.0, -1.0, 4.0,
3.6, 2.1, 4.2, 2.0,
2.0, 1.0, 3.1, 5.2};
ceres::Grid2D<double, 1> grid(data, 0,3, 0,4); //< Interface changed.
--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/b3530a12-b38d-480b-8f09-d334f9ad2f8c%40googlegroups.com.