  C RUBY-ON-RAILS MYSQL ASP.NET DEVELOPMENT RUBY .NET LINUX SQL-SERVER REGEX WINDOWS ALGORITHM ECLIPSE VISUAL-STUDIO STRING SVN PERFORMANCE APACHE-FLEX UNIT-TESTING SECURITY LINQ UNIX MATH EMAIL OOP LANGUAGE-AGNOSTIC VB6 MSBUILD # Compiling Ceres Solver With Android and Eclipse  » android » Compiling Ceres Solver With Android and Eclipse

By : user2950071
Date : November 17 2020, 11:52 AM
This might help you Questions like this are best asked on the ceres-solver mailinglist. The config.h you are looking for exists in
ceres-solver-1.10.0/config/ceres/internal/config.h code : ## modify the squared sum [ceres-solver]

By : Gordon Platt
Date : March 29 2020, 07:55 AM
Any of those help I am trying to modify the default behavior of ceres which is computing the squared sum of residuals as cost function. I want it to compute only a sum ( the residuals are already computed in a manner that they can only be positive) , I found the solution, which is :
code :
``````struct Conditioners : ceres::CostFunction
{
public:
Conditioners()
{
set_num_residuals(1);
mutable_parameter_block_sizes()->push_back(1);
}

~Conditioners()
{}

template<typename T>
T operator() (T x)
{
return T(x * x);
}

bool Evaluate(double const* const* parameters, double* residuals, double** jacobians) const
{
residuals = parameters * parameters

if (jacobians)
jacobians = 2.0 * parameters

return true;
}
};
`````` ## How to retrieve outliers from ceres solver result?

By : Liviu Onet
Date : March 29 2020, 07:55 AM
hope this fix your issue I had the similar problem. After looking into Ceres library sources (particularly into ResidualBlock::Evaluate() method) I had a conclusion that there is no explicit "outlier" status for residual block. It seems that the loss function just affects resulting cost value for a block (which is exactly described by the phrase from documentation you have quoted - "Loss functions reduce the influence of residual blocks with high residuals"). So the answer is that you cannot retrieve outliers from Ceres, there is no such feature.
Workaround might be calculating residuals for your data with the solved result, and apply loss function to them. The comment from LossFunction::Evaluate() might help:
code :
``````// For a residual vector with squared 2-norm 'sq_norm', this method
// is required to fill in the value and derivatives of the loss
// function (rho in this example):
//
//   out = rho(sq_norm),
//   out = rho'(sq_norm),
//   out = rho''(sq_norm),
//
// Here the convention is that the contribution of a term to the
// cost function is given by 1/2 rho(s),  where
//
//   s = ||residuals||^2.
//
// Calling the method with a negative value of 's' is an error and
// the implementations are not required to handle that case.
//
// Most sane choices of rho() satisfy:
//
//   rho(0) = 0,
//   rho'(0) = 1,
//   rho'(s) < 1 in outlier region,
//   rho''(s) < 0 in outlier region,
//
// so that they mimic the least squares cost for small residuals.
virtual void Evaluate(double sq_norm, double out) const = 0;
`````` ## What is tripping up clang but not g++ in compiling a simple Ceres Solver demo?

By : Kilian
Date : March 29 2020, 07:55 AM
To fix this issue gcc is to g++ what clang is to clang++ :)
Basically, clang by default doesn't compile with the stdlibc++ flag, as does gcc. This results in the C libraries being linked, which do not contain std::basic_string and similar classes from the C++ library. ## How to create different solver blocks for the same solution in ceres?

By : sunil aher
Date : March 29 2020, 07:55 AM
it helps some times I got it. You are allowed to use multiple pointers into the same array, you are just not allowed to have different block sizes for the same pointer. This means your blocks inside the array may not overlap inside the array, but different cost functions are allowed to use the same blocks.
The solution is to use one block per coordinate pair:
code :
``````for(int i = 0; i < mesh.n_faces(); i++) {
face_cost_functors.push_back(new FaceFunctor());
ceres::DynamicAutoDiffCostFunctionFaceFunctor> *face_cost_function = new ceres::DynamicAutoDiffCostFunction<FaceFunctor>(face_cost_functors.back());
face_cost_function->SetNumResiduals(1);
}
`````` ## Ceres Solver C++: Segmentation fault: 11

By : user2842181
Date : March 29 2020, 07:55 AM
I wish did fix the issue. You are accessing the jacobians array wrong. Here is why.
When you added the residual block, you told Ceres that the cost function only depends on one parameter block of size 2 and produces a residual of size 2.
code :
``````if (jacobians != NULL && jacobians != NULL) {
jacobians = 2+x2;
jacobians = x1;
jacobians = -pow(x2,2);
jacobians = 2-2*x1*x2;
}
`````` 