I am struggling to formulate my problem in a way that allows me to use AutoDiffCostFunction, but I am pretty sure it is possible.
My optimisation problem is a non-rigid ICP, where given a target and a source 3d point, I need to estimate parameters for a couple of transfomations that go into transforming the source onto the target.
Given N (large number, changing at every frame) parameters, I know that I will only require K (constant) of them per each pair of target-source. The problem that arises however is that I'm the indices of the parameters are not in one block, but they are retrieved through KNN.
double *mutable_epsilon_[KNN_NEIGHBOURS];
double *parameters_;
double **mutable_epsilon(int *index_list)
{
for(int i = 0; i < KNN_NEIGHBOURS; i++)
mutable_epsilon_[i] = &(parameters_[index_list[i]]);
return mutable_epsilon_;
}
double *mutable_params()
{
return parameters_;
}
Then I want to use
mutable_epsilon_ in my optimisation and have the changes propagate to
parameters_.
The alternative, would, of course, be to send in parameters_ straight away, but the problem with that is that parameters will have a variable number at each frame, and only K if them would be used anyway.
What would be the best approach here?