linzhang.robot
linzhang.robot

Reputation: 379

opencv - 3D rigid/affine transformation

this is an duplicate question of opencv: Rigid Transformation between two 3D point clouds. However, there is no answer accepted and I don't understand the only answer there.

The only answer says scaling and shearing can have different meaning in higher dimension, and gives an example that 2D scaling is 3D translation.

I think a 3D affine transformation should include scaling/shearing in 3 dimensions (i.e. x,y,z axis). A 3D rigid transformation should only have translation and rotation in 3 dimensions.

I am confused that why the answer in the post saying "That's the reason why you don't have an option to set a rigid affine transformation in 3D, because you actually already are performing one"

I should have commented on the original post but I can't due to the reputation requirement.

Upvotes: 2

Views: 11678

Answers (2)

steven h
steven h

Reputation: 11

I wanted to update the answer to this question as its the first to show up on google and opencv has changes since.

As of opencv 4.5.3 there is a new overload of EstimateAffine3D which has the parameter "force_rotation".

Using this overload with force_rotation=true, you will recieve the rigid transformation between 2 sets of 3d points.

I have validated that the results are identical between this and the alternative suggested by OP.

Upvotes: 1

beaker
beaker

Reputation: 16810

Despite what the (now deleted) answer linked in the question (as well as my previous deluded speculation... I blame a bad plate of Arcturian MegaDonkey) might have suggested, estimateAffine3d does exactly what it says: estimates affine transformations, including scaling, shearing, translations and rotations, in 3d. The OP has confirmed this (in comments) and I've run several tests in which the transformations were successfully recovered.

There is no reason to believe that estimateAffine3d does not work as intended.

Upvotes: 3

Related Questions