how to draw epipolar line

asked 2018-01-16 11:31:16 -0500

arti gravatar image

updated 2018-01-16 11:35:12 -0500

berak gravatar image

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

edit retag flag offensive close merge delete

Comments

1

did you see this tutorial

sturkmen gravatar imagesturkmen ( 2018-01-16 13:41:56 -0500 )edit

Thanks for your response....but still problem not resolve..can you check my code please...https://drive.google.com/dri... this is my code....i followed the link https://www.packtpub.com/books/conten... help if you can resolve proble...Thanks

arti gravatar imagearti ( 2018-01-22 23:46:34 -0500 )edit

your links are broken, I can't open either of them!

Farid gravatar imageFarid ( 2019-03-11 12:49:22 -0500 )edit