我从基本矩阵绘制极线时出错。我的代码是:
cv::Mat fundamental = cv::findFundamentalMat(
cv::Mat(img_corners), // points in first image
cv::Mat(prevImg_corners), // points in second image
CV_FM_7POINT); // 7-point method
std::vector<cv::Vec3f> lines1;
cv::computeCorrespondEpilines(
img_corners, // image points
1, // in image 1 (can also be 2)
fundamental, // F matrix
lines1); // vector of epipolar lines
// for all epipolar lines
for (vector<cv::Vec3f>::const_iterator it= lines1.begin();
it!= lines1.end(); ++it) {
// draw the line between first and last column
cv::line(prevImg,
cv::Point(0,-(*it)[2]/(*it)[1]),
cv::Point(prevImg.cols,-((*it)[2]+
(*it)[0]*prevImg.cols)/(*it)[1]),
cv::Scalar(255,255,255),2,8);
}
错误是程序执行在第一帧后停止工作。 enter image description here
请建议我做错了什么。感谢