Drawing epipole lines

asked 2016-06-04 12:59:17 -0600

kevgeo gravatar image

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.

edit retag flag offensive close merge delete

Comments

It looks like you have way too few points. Try increasing that. Do they even match?

Tetragramm gravatar imageTetragramm ( 2016-06-04 13:42:42 -0600 )edit

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?

kevgeo gravatar imagekevgeo ( 2016-06-05 01:08:46 -0600 )edit

I think cv::drawMatches is what you are looking for.

matman gravatar imagematman ( 2016-06-05 06:24:06 -0600 )edit

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.

Tetragramm gravatar imageTetragramm ( 2016-06-05 07:46:12 -0600 )edit

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?

kevgeo gravatar imagekevgeo ( 2016-06-05 08:01:49 -0600 )edit

Here is a tutorial how to use cv::drawMatches to draw epipole lines.

matman gravatar imagematman ( 2016-06-05 10:21:57 -0600 )edit

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?

kevgeo gravatar imagekevgeo ( 2016-06-05 23:31:45 -0600 )edit

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.

Tetragramm gravatar imageTetragramm ( 2016-06-06 17:36:00 -0600 )edit

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?

kevgeo gravatar imagekevgeo ( 2016-06-06 22:14:05 -0600 )edit

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

Tetragramm gravatar imageTetragramm ( 2016-06-06 23:01:49 -0600 )edit