我有 2 帧由移动(非常慢)的相机完成的视频流;在使用(通过 OpenCV)SIFT 算法和 findHomography OpenCv 函数后,我得到了描述相机在 2 帧之间完成的运动的变换矩阵。我想做的是在第二帧中找到第一帧的一个点:所以我的代码是:
H = findHomography( point1, point2, CV_RANSAC ); //compute the transformation matrix using the
// matching points (the matrix is correct, i checked it)
Mat dstMat(3, 1, H.type());
vector<Point3f> vec;
Mat srcMat(3, 1, H.type());
vec.push_back(Point3f(Ptx,Pty,-1)); // fill the 3x1 vector with the coordinate
// of the interest point in frame 1
srcMat= Mat(vec).reshape(1).t(); //conversion of vec in Mat (the vector is correct, i checked it)
dstMat = H*srcMat; //compute the arrival point in frame 2 // ERROR
但是,在写入错误的地方,我收到以下错误:OpenCV Error: Assertion failed (type == B.type() && (type == CV_32FC1 || type == CV_64FC1 || type == CV_32FC2 || type == gemm 中的 CV_64FC2)),文件 /tmp/buildd/ros-fuerte-opencv2-2.4.2-1precise-20130312-1306/modules/core/src/matmul.cpp,第 711 行终止在抛出 'cv: 实例后调用: :Exception' what(): /tmp/buildd/ros-fuerte-opencv2-2.4.2-1precise-20130312-1306/modules/core/src/matmul.cpp:711: 错误: (-215) type == B .type() && (type == CV_32FC1 || type == CV_64FC1 || type == CV_32FC2 || type == CV_64FC2) 在函数 gemm
中止(核心转储)
为什么?