template <typename T>
bool operator()(const T* const pose,
T* residuals) const
{
/* apply rotation and translation to 3D point */
Eigen::Matrix<T,3,1> transformed_point;
/* perform R^t (x - T) */
Eigen::Map<const Eigen::Matrix<T,3,1>> translation(&pose[4]);
Eigen::Matrix<T, 3, 1> translated_point = Eigen::Matrix<T,3,1>(point.cast<T>()) - translation;
Eigen::Matrix<T, 3, 3> orientation;
ceres::QuaternionToRotation(pose, orientation.data());
transformed_point = orientation.transpose() * translated_point;
/* project to image */
Eigen::Matrix<T,2,1> projection;
projection(0) = (transformed_point(0) * fx) / transformed_point(2) + cx;
projection(1) = (transformed_point(1) * fy) / transformed_point(2) + cy;
/* compute reprojection error */
Eigen::Map<Eigen::Matrix<T,2,1>> residuals_eigen(residuals);
residuals_eigen = projection - feature.cast<T>();
/* compute observation information matrix */
double pixel_noise = 1;
pixel_noise *= pixel_noise;
Eigen::DiagonalMatrix<double, 2> feature_noise; feature_noise.diagonal() << pixel_noise, pixel_noise;
Eigen::Matrix<T, 2, 2> projected_covariance = vtnr::FeatureHandler::projection_covariance(transformed_point, Eigen::Matrix<T,3,3>(point_covariance.cast<T>()), orientation, fx, fy);
Eigen::Matrix<T, 2, 2> observation_covariance = Eigen::Matrix<double,2,2>(feature_noise).cast<T>() + projected_covariance;
/* compute inverse square root of covariance matrix to obtain the factor to multiply the residual with */
// TODO: this can probably be done in a more stabler and efficient way
Eigen::SelfAdjointEigenSolver<Eigen::Matrix<T,2,2>> eigen_solver(observation_covariance);
Eigen::Matrix<T,2,2> information(eigen_solver.operatorInverseSqrt());
//Eigen::LLT<information_t> lltOfInformation(information_);
//squareRootInformation_ = lltOfInformation.matrixL().transpose();
residuals_eigen = information * residuals_eigen;
return true;
}
The error I'm getting is:
In file included from /usr/include/eigen3/Eigen/Eigenvalues:38:0,
from /usr/include/eigen3/Eigen/Dense:7,
from /usr/include/ceres/internal/numeric_diff.h:40,
from /usr/include/ceres/dynamic_numeric_diff_cost_function.h:44,
from /usr/include/ceres/ceres.h:44,
from /home/v01d/ros/src/vtnr/src/vtnr_minimization.cpp:1:
/usr/include/eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h: In instantiation of ‘Eigen::ComputationInfo Eigen::internal::computeFromTridiagonal_impl(DiagType&, SubDiagType&, Eigen::Index, bool, MatrixType&) [with MatrixType = Eigen::Matrix<ceres::Jet<double, 7>, 2, 2, 0, 2, 2>; DiagType = Eigen::Matrix<ceres::Jet<double, 7>, 2, 1, 0, 2, 1>; SubDiagType = Eigen::Matrix<ceres::Jet<double, 7>, 1, 1, 0, 1, 1>; Eigen::Index = long int]’:
/usr/include/eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h:435:49: required from ‘Eigen::SelfAdjointEigenSolver<MatrixType>& Eigen::SelfAdjointEigenSolver<_MatrixType>::compute(const Eigen::EigenBase<OtherDerived>&, int) [with InputType = Eigen::Matrix<ceres::Jet<double, 7>, 2, 2, 0, 2, 2>; _MatrixType = Eigen::Matrix<ceres::Jet<double, 7>, 2, 2, 0, 2, 2>]’
/usr/include/eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h:168:14: required from ‘Eigen::SelfAdjointEigenSolver<_MatrixType>::SelfAdjointEigenSolver(const Eigen::EigenBase<OtherDerived>&, int) [with InputType = Eigen::Matrix<ceres::Jet<double, 7>, 2, 2, 0, 2, 2>; _MatrixType = Eigen::Matrix<ceres::Jet<double, 7>, 2, 2, 0, 2, 2>]’
/home/v01d/ros/src/vtnr/src/vtnr_minimization.cpp:70:94: required from ‘bool StereoReprojectionError::operator()(const T*, T*) const [with T = ceres::Jet<double, 7>]’
/usr/include/ceres/internal/variadic_evaluate.h:175:19: required from ‘static bool ceres::internal::VariadicEvaluate<Functor, T, N0, 0, 0, 0, 0, 0, 0, 0, 0, 0>::Call(const Functor&, const T* const*, T*) [with Functor = StereoReprojectionError; T = ceres::Jet<double, 7>; int N0 = 7]’
/usr/include/ceres/internal/autodiff.h:282:72: required from ‘static bool ceres::internal::AutoDiff<Functor, T, N0, N1, N2, N3, N4, N5, N6, N7, N8, N9>::Differentiate(const Functor&, const T* const*, int, T*, T**) [with Functor = StereoReprojectionError; T = double; int N0 = 7; int N1 = 0; int N2 = 0; int N3 = 0; int N4 = 0; int N5 = 0; int N6 = 0; int N7 = 0; int N8 = 0; int N9 = 0]’
/usr/include/ceres/autodiff_cost_function.h:211:66: required from ‘bool ceres::AutoDiffCostFunction<CostFunctor, kNumResiduals, N0, N1, N2, N3, N4, N5, N6, N7, N8, N9>::Evaluate(const double* const*, double*, double**) const [with CostFunctor = StereoReprojectionError; int kNumResiduals = 2; int N0 = 7; int N1 = 0; int N2 = 0; int N3 = 0; int N4 = 0; int N5 = 0; int N6 = 0; int N7 = 0; int N8 = 0; int N9 = 0]’
/home/v01d/ros/src/vtnr/src/vtnr_minimization.cpp:149:1: required from here
/usr/include/eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h:496:20: error: no match for ‘operator=’ (operand types are ‘Eigen::DenseCoeffsBase<Eigen::Matrix<ceres::Jet<double, 7>, 1, 1, 0, 1, 1>, 1>::Scalar {aka ceres::Jet<double, 7>}’ and ‘int’)
subdiag[i] = 0;
--
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/aa525e90-317b-4e64-b85c-e4de981e4949%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/aa525e90-317b-4e64-b85c-e4de981e4949%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/UJU6tfBHqq0/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/CABqdRUAJPH7ZJwjKeZPCD_B0dam89tZnM-6SP4AG-f7brrA87w%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/aa525e90-317b-4e64-b85c-e4de981e4949%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/UJU6tfBHqq0/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/CABqdRUAJPH7ZJwjKeZPCD_B0dam89tZnM-6SP4AG-f7brrA87w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
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/CAJw%3DTtokMPoFDDFt0xsTW4M8VY8R3LJAf20M4cmx4c2_nDVo3Q%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/aa525e90-317b-4e64-b85c-e4de981e4949%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/UJU6tfBHqq0/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/CABqdRUAJPH7ZJwjKeZPCD_B0dam89tZnM-6SP4AG-f7brrA87w%40mail.gmail.com.
--
For more options, visit https://groups.google.com/d/optout.
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/CAJw%3DTtokMPoFDDFt0xsTW4M8VY8R3LJAf20M4cmx4c2_nDVo3Q%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/UJU6tfBHqq0/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/CABqdRUBQ915wyPTQ3hyiv%3D37aD%3D%3DGqbwqgYvWthdJ33%3DpAqarQ%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/aa525e90-317b-4e64-b85c-e4de981e4949%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/UJU6tfBHqq0/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/CABqdRUAJPH7ZJwjKeZPCD_B0dam89tZnM-6SP4AG-f7brrA87w%40mail.gmail.com.
--
For more options, visit https://groups.google.com/d/optout.
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/CAJw%3DTtokMPoFDDFt0xsTW4M8VY8R3LJAf20M4cmx4c2_nDVo3Q%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/UJU6tfBHqq0/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/CABqdRUBQ915wyPTQ3hyiv%3D37aD%3D%3DGqbwqgYvWthdJ33%3DpAqarQ%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/6c56113c-8f8c-47ca-b8ed-d58b1af06c05%40googlegroups.com.
I have a point cloud (3D points) with their 3D covariances. My cost function is a standard reprojection error which measures distance (in 2D) between observed 2D point and 3D -> 2D projected point from the cloud. I want to weigh this residual using the 3D covariance projected towards the 2D image. This is done by using the jacobian of the projection function and thus with a standard covariance propagation. In the end I have a 2D covariance (the result of the projection) which is what I would invert and use as information matrix.
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/aa525e90-317b-4e64-b85c-e4de981e4949%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/UJU6tfBHqq0/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/CABqdRUAJPH7ZJwjKeZPCD_B0dam89tZnM-6SP4AG-f7brrA87w%40mail.gmail.com.
--
For more options, visit https://groups.google.com/d/optout.
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/CAJw%3DTtokMPoFDDFt0xsTW4M8VY8R3LJAf20M4cmx4c2_nDVo3Q%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/UJU6tfBHqq0/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/CABqdRUBQ915wyPTQ3hyiv%3D37aD%3D%3DGqbwqgYvWthdJ33%3DpAqarQ%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/CAJw%3DTtpMMfa-%2BcrirLBC0OuVYwVmf4jtvcNi69%2Bj17RfGYF0VA%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/aa525e90-317b-4e64-b85c-e4de981e4949%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/UJU6tfBHqq0/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/CABqdRUAJPH7ZJwjKeZPCD_B0dam89tZnM-6SP4AG-f7brrA87w%40mail.gmail.com.
--
For more options, visit https://groups.google.com/d/optout.
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/CAJw%3DTtokMPoFDDFt0xsTW4M8VY8R3LJAf20M4cmx4c2_nDVo3Q%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/UJU6tfBHqq0/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/CABqdRUBQ915wyPTQ3hyiv%3D37aD%3D%3DGqbwqgYvWthdJ33%3DpAqarQ%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/6c56113c-8f8c-47ca-b8ed-d58b1af06c05%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/UJU6tfBHqq0/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/CABqdRUDzsFJWQ%3DarXnvv5frK%2B5UgeWm3PjL3MutVd47LUUKSuQ%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/aa525e90-317b-4e64-b85c-e4de981e4949%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/UJU6tfBHqq0/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/CABqdRUAJPH7ZJwjKeZPCD_B0dam89tZnM-6SP4AG-f7brrA87w%40mail.gmail.com.
--
For more options, visit https://groups.google.com/d/optout.
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/CAJw%3DTtokMPoFDDFt0xsTW4M8VY8R3LJAf20M4cmx4c2_nDVo3Q%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/UJU6tfBHqq0/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/CABqdRUBQ915wyPTQ3hyiv%3D37aD%3D%3DGqbwqgYvWthdJ33%3DpAqarQ%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/6c56113c-8f8c-47ca-b8ed-d58b1af06c05%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/UJU6tfBHqq0/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/CABqdRUDzsFJWQ%3DarXnvv5frK%2B5UgeWm3PjL3MutVd47LUUKSuQ%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/CAJw%3DTtoC1snMb3ELF_jdA__kEQhJuvw0v9ATVFwUNAYNJXryBA%40mail.gmail.com.
Hi,I'm trying to consider this option and I understand your idea would be to reproduce the functionality of the AutoDiffCostFunction but with an extra call to first compute the information matrix based on the current value of my parameters.I don't really understand how should I implement this since it would seem that jacobians can be either expected or not at a given time and this is what triggers either the standard evaluate() call to the cost function functor, or to the auto differentiationmachinery. So in the case where Jacobians would be expected, how should I deal with this?
In any case, when jacobians are expected I (think I) understand from the Differentiate() function that the Jet variables are first built, then used to invoke the cost functor and from that the real valued part is used to update the residual and the non-real valued part to obtain the jacobians. So, sorry for insisting in my idea of taking the real part of the parameters when I receive a Jet in my function, but wouldn't it what it is actually happening here? In case I wasn't clear before, I'm not talking about modifying the Jet or accessing the jacobians, but to used the real-valued part of the Jet to compute my information matrix, as if I were receiving a double value directly and do everything else the same. I have this implemented and would seem to work, but it is difficult to be sure about that.
On Wednesday, September 20, 2017 at 4:32:10 PM UTC-3, Sameer Agarwal wrote:You can't access the jacobian while doing automatic differentiation.What I would recommend doing in this case is creating a CostFunction yourself, which uses the underlying autodiff machinery to compute the Jacobian and uses it.Sameer
--
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/95a8457a-39c8-435a-8d58-f314ad0d5e90%40googlegroups.com.