# How to get a 3*3 rigid transformation matrix by RANSAC of opencv using C++

Hey guys ，I’m preparing to reproduce an article，but I find there are some problems .Opencv do not have the function can get a 3*3 rigid transformation matrix using C++.

do you have a link for us ?

based on what kind of data ?

Rigid transformation of pixels in image registration

what about estimateRigidTransform or the reg module

The feature points are extracted and matched, and then the 3 * 3 rigid transformation matrix is estimated by RANSAC

you need to improve your question. show research effort. present attempted solutions. give a LOT more detail, especially pictures and source code.

is your question: how to do that ?

can you show us, what YOU have done so far, and where the actual problem is ?

This is an image registration work, I have completed the image feature points extraction and matching, and these key points are clustered. Now the problem is to solve a rigid transformation matrix, but opencv does not provide a method to solve the rigid transformation matrix.

of course it does. did you browse the docs?

estimateAffinePartial2D
estimateAffine2D
estimateAffine3D

pick one.

I didn’t find any information about the estimateAffinePartial2D .Maybe my version is lower？

what is your version? you should use 4.x, and you have to use at least 3.x. you absolutely have to stop using 2.4.

My version is 4.4.There no rigid transform function right？

define “rigid”.

explain why “estimateAffinePartial2D” doesn’t suit you.

Error: Bad argument (Unknown or unsupported robust estimation method) in cv::estimateAffinePartial2D。 I do not know why?

and what did you do to get that error? please be forthcoming, DO NOT wait until you are asked for details.

Mat M;
int maxIters, ransacReprojThreshold;
estimateAffinePartial2D(first_matches1, first_matches2,M, maxIters=200, ransacReprojThreshold = 30);

first_matches1，first_matches2 are used to store the coordinates of key points。Then happen this error。

would you like to explain all the arguments you are passing?

I do the work of image registration. First, I extract the key points from two images, and then use the matching algorithm to match the corresponding points. Finally, the rigid transformation matrix is obtained according to the point pair, but opencv does not provide the class method of rigid transformation. That’s the problem I’m facing now.

what degrees of freedom does `estimateAffinePartial2D` have that you don’t want?

4 degrees of freedom limited to combinations of translation, rotation, and uniform scaling

I don’t want uniform scaling