Cv2.DecomposeHomographyMat throws OpenCVException [closed]
Hello. I'm trying to use the DecomposeHomographyMat
method but it always throws an OpenCVException
with the message:
OpenCvSharp.OpenCVException: 'K.cols == 3 && K.rows == 3
Mat homo = Cv2.FindHomography(InputArray.Create(pts1), InputArray.Create(pts2), HomographyMethods.None);
Mat K = new Mat(3, 3, MatType.CV_8UC3, Scalar.All(0));
IEnumerable<Mat> rot = Enumerable.Empty<Mat>();
IEnumerable<Mat> trans = Enumerable.Empty<Mat>();
IEnumerable<Mat> normal = Enumerable.Empty<Mat>();
try
{
Cv2.DecomposeHomographyMat(homo, K, rot, trans, normal);
}
catch (OpenCVException e)
{
Console.WriteLine(e.ErrMsg);
}
What is wrong with my method call?
sorry but we cannot help with 3rdparty api wrappers.
however, the K Mat should be the camera Matrix from calibration (not an empty Mat), and CV_8UC3 is for sure the wrong type (and the reason for your error) it must be CV_32F instead