Hello all, 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(img,
cv::Point(0,(*it)[2]/(*it)[1]),
cv::Point(img.cols,((*it)[2] + (*it)[0]*img.cols)/(*it)[1]),
cv::Scalar(255,255,255));
}
cv::imshow("Right Image Epilines (FM_7POINT)", img);
And the error is program execution is stop working after first frame. Please suggest what I'm doing wrong. Thanks