I use OpenCV 2.4.5. I want to draw the lines between matched points of two images. The code is:
const int &w=image1.cols;
for (size_t i = 0; i<good_matches.size(); i++ )
{
//-- Get the keypoints from the good matches
img1.push_back(keypoints1[good_matches[i].queryIdx].pt);
img2.push_back(keypoints2[good_matches[i].trainIdx].pt);
circle(image1,img1[i],20,Scalar(255,0,0),5);
circle(image2,img2[i],20,Scalar(0,255,0),5);
line(image1,img1[i],Point2f(img2[i].x+w,img2[i].y),Scalar(255,255,255),5);
line(image2,Point2f(img1[i].x-w,img1[i].y),img2[i],Scalar(255,255,255),5);
}
When length of line within the bounds of image
is more than 16400
I get strange result. It looks like triangle of lines or sometimes broken line between 2 corresponding points instead of straigth line between points.
So I should to draw line segments instead of total line. But it's not very convenient. Is it due to restrictions of line drawing algorythm or can be correcteed somehow?