How to Invert 3x2 Transformation Matrix
Hi, i am having trouble inveting an 3x2 Transformation Matrix. If my original transformation is rotation with +5°, i want the inverse, which rotation is -5°. Then i want to transform some point with the new inverse Matrix. If I use
cv::Mat inverse;
inverse = H.inv(cv::DECOMP_SVD);
I get back a matrxi, but it is 2x3 instead of 3x2, and then i cannt use cv::transform anymore because it gets a SIGABRT.
What am i doing wrong ?
regard Peter
It might be a good idea to add your code with cv::transform also and add the complete error or code line where it occurs in debugging. A SIGABRT is usually called from an abort() function which in code means basically some of the input data is not correctly...
Also it seems that you can only call the inverse function on squared matrices, see the wikipedia docs here.
I think you are looking for the function invert, instead of inv. Is that possible? But the behaviour is the MxN becomes NxM ... which is normal for inverting a matrix.
So basically I don't think you can simply call an inversion on a matrix to get a inverse transformation matrix.... The solution to your problem after some looking is here, read more about the warpAffine function and the inverse flag. I think this is what you want right?
@pkohout: Do you really have a 3x2 or actually a 2x3 transformation matrix? A 2x3 matrix you can easily invert using the
invertAffineTransform
function (http://docs.opencv.org/modules/imgproc/doc/geometric_transformations.html#invertaffinetransform).