Ask Your Question
1

SolvePnPRansac works in 2.4.11 but not in 3.1.0 [closed]

asked 2017-01-19 09:15:35 -0600

Brumbazz gravatar image

I have some code, where a camera pose is estimated using SolvePnPRansac based on 2d-3d correspondance. I backproject a pointcloud into my image so visual confirmation is easy.

I know the data is noisy but in 2.4.11, I can set the number of iterations high and the number of inliers high and get fairly consistent results. Even using the standard settings the results are ok.

Using the exact same data but 3.1.0, I cannot produce a single result, which is right regardless of settings.

Has something fundamentally changed, which means the algorithm can no longer handle noisy data?

I made the switch in order to use other functions not available in 2.4.x.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Brumbazz
close date 2017-01-25 09:58:00.301570

Comments

1

Check the docs for arguments to each version of the algorithm, the API has changed.

Der Luftmensch gravatar imageDer Luftmensch ( 2017-01-19 10:37:30 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
0

answered 2017-01-19 18:45:29 -0600

Tetragramm gravatar image

I'm not sure, but it's possible. Look HERE for a history of the commits. 2.4.11 is from Feb 2015, so anything since then could be the cause.

edit flag offensive delete link more
0

answered 2017-01-25 03:52:54 -0600

Brumbazz gravatar image

updated 2017-01-25 03:57:17 -0600

Ok, so I'm using mexopencv, which might be the cause but all it does is wrap the opencv function.

I have tested with artificial data, that does not have noise. I use some 2D data, which I project into 3D space given a camera matrix and a transformation, while scaling the 3D points, so each 2D point is represented at several distances.

Using SolvePnP I can estimate the transformation and project my 3D points back into 2D and see if they match the original points, which they do (within tolerance) for both 2.4.11 and 3.10.

However, doing the same with SolvePnPRansac only works in 2.4.11 and not 3.10. Since there are no noisy points, this should work for the default settings, which it does not. The default/minimum settings are identical to SolvePnP, so I cannot see, where I could go wrong.

I don't really know where to start :-(

edit flag offensive delete link more

Comments

You should edit your question and post a short reprodicible code for both version using perfect artificial data.

Eduardo gravatar imageEduardo ( 2017-01-25 07:24:47 -0600 )edit

My comment above is THE ANSWER. If not, at least confirm that you are aware of the API change. And please post comments as comments and not answers.

Der Luftmensch gravatar imageDer Luftmensch ( 2017-01-25 07:28:39 -0600 )edit

I know there has been a change from minInliers to Confidence, but as input everything apart from 2D points, 3D points and camera matrix defaults to something, then the function should produce correct results if these are not set.

Sorry about the answer/comments mishap.

I am working on a code example

Brumbazz gravatar imageBrumbazz ( 2017-01-25 07:55:25 -0600 )edit

All right, so I actually made an example, which does seem to create the error, I get through the mexopencv. So I guess the problem is not in OpenCV, sorry about that and thank everyone for the help.

Brumbazz gravatar imageBrumbazz ( 2017-01-25 09:57:07 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-01-19 09:15:35 -0600

Seen: 376 times

Last updated: Jan 25 '17