0

I'm getting an error in drawing epipolar line from fundamental matrix. Snap of my code is:

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);
}

And the error is program execution is stop working after first frame. enter image description here

Please suggest what I'm doing wrong. Thanks

0 Answers0