19 July 2013

Finding transformation between corresponding 3D points

With the shape model registered with point cloud, we need to align it with the mean model so that they are in same reference frame and comparable.
The transformation between shape model and mean model includes translation, scaling and rotation.

Translation:
In order to make two shape comparable, I translate both registered shape model and mean model to origin.

Scaling:
A simple way is to normalize the shape itself which results in a scaled shape of size 1. The size of shape is calculated by Opencv cv::norm() which computes an absolute array norm based on following equation.
In my program I use NORM_L2.

Rotation:
Now the registered shape model and the mean shape are almost aligned except the rotation. As the correspondences between two shape are known information, the rotation matrix can be solved using SVD (singular vector decomposition) which is introduced here.
Firstly, we need to decompose matrix H which is:
As the centroid of two shape has been subtracted already in the translation part, we can just put PA and PB as our two shapes. Next, the SVD of H is:
Finally, the rotation matrix from shape A to shape B can be calculated using U and V:
If we want to get rotation from shape B to A, just alter the equation to PB*PA instead of PA*PB.


Reference:
[1] Finding optimal rotation and translation between corresponding 3D points
[2] OpenCV document

1 comment:

  1. Hi,

    Thank you for your tutorial.
    I used matlab code that your first reference link "Finding optimal rotation and translation between corresponding 3D points".

    But that not includes scale information. How can I get scale information ?

    Thank you,

    Regards

    ReplyDelete