# Inverse Matrix from a Decomposehomography [closed]

I need to obtain the inverse of a rotation matrix I get from decomposehomography() but I'm having some trouble as it looks like the type of the matrix I obtain from that function does not seem to work with .inv(). Here's an example where Prev_rot_matrix is another matrix

int solutions = decomposeHomographyMat(H, cameraMatrix, Rs_decomp, ts_decomp, normals_decomp);
for (int i = 0; i < solutions; i++)
{
if(normals_decomp[i].at<double>(2)>0)
{
aux=FrameVar(Rs_decomp[i], Prev_rot_matrix); /*Prev_rot_matrix has the same structure as Rs_decomp[i]*/
if(aux<Var)
{
Var=aux;
SOL=i;
}
}
}

double FrameVar(Mat Rot_Curr, Mat Rot_Prev)
{
//Previous rotation: Rot_Prev ;
current rotation: Rot_Curr
double NewAngle, OldAngle, aux;
Mat Rot_Curr_vect, Rot_Prev_vect;
Mat VarAngle(cv::Size(1,1), CV_64FC1);

Rodrigues(Rot_Curr, Rot_Curr_vect);
Rot_Prev_vect=Rot_Prev.inv()*Rodrigues(Rot_Prev, Rot_Prev_vect);
...


So when I try to compile it I get:

‘cv::MatExpr’ is not derived from ‘const cv::Affine3<t>’
Rot_Prev_vect=Rot_Prev.inv()*Rodrigues(Rot_Prev, Rot_Prev_vect);

and a bunch of other errors.

In case that that meant Rot_Prev class does not have .inv(), how can I obtain its inverse matrix? I want to get the previous rotation vector in the new frame coordinates

edit retag reopen merge delete