Ask Your Question

Revision history [back]

Cv2.DecomposeHomographyMat throws OpenCVException

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?

Cv2.DecomposeHomographyMat throws OpenCVException

Hello. I'm trying to use the DecomposeHomographyMat DecomposeHomographyMat method but it always throws an OpenCVException OpenCVException with the message:

OpenCvSharp.OpenCVException: 'K.cols == 3 && K.rows == 3'

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? call?