Drawing epipole lines
I am writing a program in C++ to draw epipole lines but the only the points are being displayed, not the lines.
I am trying to get the same output like the one in this picture-C:\fakepath\epiresult.jpg
But the output I'm getting is this- 1.C:\fakepath\pic1.png 2.C:\fakepath\pic2.png
The epipole lines are not being drawn and I can't seem to find any error with my code.
Here is the source code in c++ - https://drive.google.com/open?id=0B3j...
The pictures I have used is also included in the above link.
It looks like you have way too few points. Try increasing that. Do they even match?
Hi Tetragramm, actually I got 20 points. Isn't that enough? Yes most of them do match,some points don't though like maybe 2 or 3 points.
I basically looked at this python tutorial- http://docs.opencv.org/master/da/de9/...
and did the same in C++ , so I guess it should work.
Any suggestions on what to change in my code? Or how to increase the number of points?
I think cv::drawMatches is what you are looking for.
Change the default settings on SIFT to capture more points, and alter the threshold on the ratio test. If it doesn't work when you've got 100 matches with most of them good (use the draw matches to check that) then there's probably a problem.
Hi matman,but I was wondering why the lines are not being drawn at all?
And how exactly can drawMatches be used for drawing epilines after computing them?
Here is a tutorial how to use
cv::drawMatches
to draw epipole lines.But this is to draw the matched points between two images right?
I want to draw a line which connects all the points in second image which are projections of a point in the first image that only has one projection on the first image but several on the second image depending on the different distances or positions of that point from first image . This line is an epipolar line correct me if I am correct. So how do I use drawMatches to draw this line?
You're doing the right thing to draw the lines, I think you're just not getting a good calculation of the lines, because your matches is too small. You'll notice that the tutorial has many more points, and they seem better matched than yours.
Thanks for the input Tetragramm, I think that might be the error. But I still have a doubt as even with my limited matches, using the line function, shouldn't atleast some lines be drawn even if they incorrect as I have specified the initial and final destination points, so shouldn't atleast some lines be drawn then? Or am I mistaken about how the cv::line function works?
This is the tutorial that I followed and since it's in python, i copied the same logic to be done in C++. But still I am getting errors? Do you have any suggestions on how to rectify the error and improve my matching?
You probably are drawing lines, just off screen. Try printing the points you're using to draw the lines and see what you get. I bet it's less than zero, or greater than rows().
Try increasing the number of points you detect, and increase the multiplier on the line if( matches[i].distance <= max(2*min_dist, 0.02) )
Make that 5* or 10*min_dist