0

I have a Source and target in the same coordinate system. There are 'n' points in the source and 'n' points in target(n>=3). Correspondences are also known. I would like to find optimal rigid transformation matrix(6 DOF or less in some cases).

I understand that this is solved by minimizing the squares of distances between source and target points.

I have two following questions.

1) What is the best solver in these cases? 2) In case of Levenberg–Marquardt algorithm with Quaternions representing rotations, what is the best way to calculate Jacobian matrix?

Tharun
  • 31
  • 7
  • How about a least squares solution? You have a matrix of input coordinates `A`, a matrix of output coordinates `B`, and you want to find a transformation matrix `M`: `B=MA` -> `M=B/A`. Find `B/A` in the least squares sense and you're done! (In MATLAB, you can literally type `M=B/A`). – Cris Luengo Oct 29 '18 at 05:51
  • I need to accommodate the cases of 1,2,3,4 and 5 DOF aslo not just 6 DOF. Representing these cases in just matrices isn't the best I suppose. Also, I am looking for solution in C++. Thank you – Tharun Oct 29 '18 at 06:33
  • You might want to look at https://en.wikipedia.org/wiki/Orthogonal_Procrustes_problem I'm not sure exactly what you mean by 'rigid transformation' but such problems can often be solved directly rather than resorting to non-linear least squares. – dmuir Oct 29 '18 at 09:16
  • by rigid transformation I mean, only three rotation and three translation DOF are allowed. I think the reference you mentioned is valid only in the cases of rotation DOF not when translation is also included. – Tharun Oct 30 '18 at 01:43
  • @dmuir: a rigid transformation is a combination of translation and rotation. –  Oct 30 '18 at 11:37

1 Answers1

1

Given points P[] and corresponding points Q[] we want to find a translation T and a rotation R to minimise

E = Sum{ <Q[i] - (R*P[i]+T)|Q[i] - (R*P[i]+T)>}

but this is

E = Sum{ <Q[i] - R*P[i] - T | Q[i] - R*P[i] - T>}

and given R, the value of T that minimises this is

T = mean { Q[i] - R*P[i]} = Qbar - R*Pbar

where Qbar is the mean of the Qs and Pbar of the Ps.

Plugging in this value of T we get

E = Sum{ <q[i] - R*p[i] | q[i] - R*p[i]>}
where q[i] = Q[i]-Qbar, p[i] = P[i]-Pbar

Finding R to minimise E is the orthogonal procrusetes problem. When this is solved for R we can compute T as above.

The modifications when wanting the solution for the weighted case are simple. First of all Pbar and Qbar should be weighted averages, and then we should use

q[i] = sqrt( weight[i]) * ( Q[i]-Qbar)
p[i] = sqrt( weight[i]) * ( P[i]-Pbar)
dmuir
  • 4,211
  • 2
  • 14
  • 12
  • Thank you for the detailed explanation. Do you have any solution if there is a weight attached to each pair of source and target? – Tharun Nov 02 '18 at 01:54