Hi!

I am trying to compute the rigid transformation between two point sets.

This seems to me as very commonly used operation, can someone direct me to the package or command

that achieves that?

Tnx!!

Natalie

Hi!

I am trying to compute the rigid transformation between two point sets.

This seems to me as very commonly used operation, can someone direct me to the package or command

that achieves that?

Tnx!!

Natalie

It’s not very clear what you’re asking. Could you please specify more precisely the question.

I need to calculate T(translation) and R(rotation) matrices for two clouds of 3D (x,y,z) points A and B,

so that the following expression Σ((R*Pb + T) - Pa)^2 will tend to 0,

something like the OpenCV estimateRigidTransform() function does.

Tnx!

There is just https://github.com/maxruby/OpenCV.jl. For a pure Julia implementation, it looks like https://github.com/peterkovesi/ImageProjectiveGeometry.jl may have what you need. Its `ransacfithomography`

is almost what you want, except I don’t think the homogeneous transform it returns is necessarily a rigid transformation. But at the very least, that package implements RANSAC (the basic algorithm used in `estimateRigidTransform`

as well). To me it looks like this would be the repo to contribute to if you wanted a pure Julia version.

Hmm, just noticed that you need this for 3D (`ImageProjectiveGeometry.ransacfithomography`

is for 2D, as is `estimateRigidTransform`

). Still, the `ransac`

function could be a good start, even though there are some obvious ways in which its performance can be improved.

I think the function that you want is often called `Procrustes`

alignment.

It’s mostly SVD plus some minor transformations, and it works for any number of dimensions (not just 3).

Here’s a Matlab version which you may want to port to Julia: https://stackoverflow.com/questions/18925181/procrustes-analysis-with-numpy/18927641#18927641

A RANSAC-based algorithm could actually use the Procrustes algorithm code (\ell^2-norm minimization) in the inner loop to improve handling of outliers.

Note this comment on copyright by the way: https://stackoverflow.com/questions/18925181/procrustes-analysis-with-numpy/18927641#comment27954878_18927641.

I believe that the algorithm searched for is Iterative Closest Point (ICP). I’m not aware of any implementations in Julia, but maybe calling Point Cloud Library (PCL) is an option? They have a great number of variants implemented.

The thread is old, but this function solves the problem you want to solve, if you want to align structures in three dimensions through rigid-body movements:

There is an example in the github directory.