Variable restriction

62 views
Skip to first unread message

Albert Palomer

unread,
Jan 12, 2017, 10:52:45 AM1/12/17
to Ceres Solver
Hello,

I am solving a minimization problem where I solve the position of a plane. A plane is usually described as an equation such as nx*x+ny*y+nz*z+d=0 (amongst other possible forms). My minimization problem tries to solve nxny, nz (the normal n of the plane) and d. The problem is that there exist infinite parametrizations of the same plane (the same equation can be multiplied by any scalar resulting in the same plane). I have an approximation of my d. However, by setting a lower and upper limit to d (using ceres::Problem::SetParameterUpperBound) it is not restricted since other combinations of nx, ny and nz can be used with a d within the limits to represent another plane. This means that if the problem have some local minimum the solution might not be the best one. Hence, apart from restricting the d, I need to make the normal vector n of the plane be of module 1 (for the d to have physical sense). I have thought of a way to do this by adding, a cost function that penalizes the problem proportionally to how far away the normal n of the plane is from a unit vector (the cost could be something like c = k(sqrt(nx^2+ny^2+nz^2) - 1) being k a "gain" to make this cost bigger). Is this a good approach? Is there a better way to add restrictions between variables?

Thank you very much.


William Rucklidge

unread,
Jan 12, 2017, 11:05:03 AM1/12/17
to ceres-...@googlegroups.com
LocalParameterization is the way Ceres addresses this kind of problem, where the number of values to adjust is greater than the actual number of degrees of freedom. See, for example, QuaternionParameterization which allows unit quaternions to be part of the optimisation.

-wjr


--
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/895d6fba-10ee-4735-aeae-f2e0729d1ab4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Albert Palomer

unread,
Jan 12, 2017, 11:36:32 AM1/12/17
to ceres-...@googlegroups.com
Hi,

Thank you very much William for such a quick reply. Could it be that my Plus function should be something like:

whateverClass::Plus(cont double* x, const double* delta, doulble* x_plus_delta) const{
    for (int i=0;i<4;i++) x_plus_delta[0] = x[0] + delta[0];
    double module = sqrt(x_plus_delta[0]*x_plus_delta[0] + x_plus_delta[1]*x_plus_delta[1] + x_plus_delta[2]*x_plus_delta[2]);
    for (int i=0;i<4;i++) x_plus_delta[0] /= module;
}


Albert Palomer Vila

William Rucklidge

unread,
Jan 12, 2017, 12:01:41 PM1/12/17
to ceres-...@googlegroups.com
Not really - the Plus() operator will take a *3*-dimensional update vector, which should be applied to your 4-dimensional parameter vector, via some kind of parameterisation of the local tangent space. (I don't have any real advice on what that tangent space would look like, sorry).

Albert Palomer

unread,
Jan 12, 2017, 12:08:07 PM1/12/17
to ceres-...@googlegroups.com
I was just writing an e-mail because I realized what you said about the dimensions of the update vector. Therefore, I don't have a clue of how should I compute this function. 

Regarding the ComputeJacobian part, is this the partial derivative of plus with respect to delta? This will most likely depend on the delta itself and I don't see it given as an argument to the ComputeJacobian.


Albert Palomer Vila

Albert Palomer

unread,
Jan 12, 2017, 12:12:44 PM1/12/17
to ceres-...@googlegroups.com
I have found this old post:
Where sameer says that:
The computejacobian function computes the Jacobian w.r.t. delta at delta = 0 so delta is not needed.
So my part regarding the ComputeJacobian is solved. 

Regarding how to get the Plus function, is there any place where I can find examples of tangent spaces so I can see how mine would look like?


Albert Palomer Vila

Sameer Agarwal

unread,
Jan 12, 2017, 12:49:19 PM1/12/17
to ceres-...@googlegroups.com
Albert,
Have you had a look at HomogeneousVectorParameterization? it should be exactly what you need.
Sameer





Albert Palomer Vila



Albert Palomer Vila

To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.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.

--
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.

--
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.

--
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/CAD3_OrU2N0CZYNeuUojUteW%2Bo7YDqz5W%2BY8G5im6FWrR3ntWkA%40mail.gmail.com.

Albert Palomer

unread,
Jan 12, 2017, 2:56:33 PM1/12/17
to ceres-...@googlegroups.com
I see how this might be something close to what I need. However, this applies to the whole parameter. However, I want to divide the whole set of parameters (dimension 4) by the norm of the normal of the plane (the 3 first elements of the paramter vector).



Albert Palomer Vila



Albert Palomer Vila



Albert Palomer Vila

To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver+unsubscribe@googlegroups.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.

--
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.

--
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.

--
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.

--
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/CABqdRUBX_dEdAB1fe3LMqwN1Ue5OrQLRYDoHzWx4KdiNzxcM%3DQ%40mail.gmail.com.

Sameer Agarwal

unread,
Jan 12, 2017, 3:00:09 PM1/12/17
to ceres-...@googlegroups.com
you can split your parameter block into two, one for the normal and one for d, and then apply homogeneous parameterization to the normal.




Albert Palomer Vila



Albert Palomer Vila

To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.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.

--
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.

--
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.

--
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.

--
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.
--
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/CAD3_OrWHLVr0ELH1NJ-p_%3DvAsUKEOX79EpT-mZGhnCaqsDBCPg%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages