Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

What are the requirements for solvePnP and how to improve my results?

My goal is to estimate the camera pose by using a camara-matrix, a distortion matrix, and a set of image-to-object-coordinate-correspondences.

I am having issues with the solvePnP function which I do use to estimate my camera pose. My results seem to be inaccurate, especially for the pitch axis. I am using co-planar points, which even also have only a little variation in the y-axis, so that they are almost in a line.

What are the requirements for solvePnP and how to improve my results?

I am using the Calib3d.CV_ITERATIVE flag to select this of the three algorithms, because the other two performed obviously completly wrong. But P3P was closer than EPNP. I am using the latest OpenCV 2.4.8.0 java-wrapper.

I created an evaluation dataset. On my Roll-Axis, and on my Yaw-Axis (in world coordinates) the median of the difference between the calculated and expected results are small. But the differences within one sample are +-5 (for roll) and +3/-7 for (yaw) expect outliners, which can be 20° off but occour seldom in my testdataset.

Big problems I observe for the pitch angle. The median of the difference between expectation and estimated values is 9.6. the accurancy drifts arround 30°.

Will I have more success with other algorithms, which solve the PnP problem, or if I do add more points, e.g. ones which are moved along the (open-cv) Z-axis to my szene?

Here is an Xml-File which contains the points of my test-dataset. And here is an Xls-File with my current evaluation. Here you find the images of the test-dataset and containing an (incomplete) projection of a cube. Here you find the code I use to generate the xml file, and test solvePnP and generate my xml file. Here you find a not yet used dataset of a test szene, with two points with variation in the Z-Axis. Do you recommend to create the full-annotations for this testset?

I assume no important information to be mentioned here, but for completness I am appending the related question I asked at the 13th of march on stackoverflow.

What are the requirements for solvePnP and how to improve my results?

My goal is to estimate the camera pose by using a camara-matrix, a distortion matrix, and a set of image-to-object-coordinate-correspondences.

I am having issues with the solvePnP function which I do use to estimate my camera pose. My results seem to be inaccurate, especially for the pitch axis. I am using co-planar points, which even also have only a little variation in the y-axis, so that they are almost in a line.

What are the requirements for solvePnP and how to improve my results?

I am using the Calib3d.CV_ITERATIVE flag to select this of the three algorithms, because the other two performed obviously completly wrong. But P3P was closer than EPNP. I am using the latest OpenCV 2.4.8.0 java-wrapper.

I created an evaluation dataset. On my Roll-Axis, and on my Yaw-Axis (in world coordinates) the median of the difference between the calculated and expected results are small. But the differences within one sample are +-5 (for roll) and +3/-7 for (yaw) expect outliners, which can be 20° off but occour seldom in my testdataset.

Big problems I observe for the pitch angle. The median of the difference between expectation and estimated values is 9.6. the accurancy drifts arround 30°.

Will I have more success with other algorithms, which solve the PnP problem, or if I do add more points, e.g. ones which are moved along the (open-cv) Z-axis to my szene?


Here is an Xml-File which contains the points of my test-dataset. test-dataset.

And here is an Xls-File with my current evaluation. .

Here you find the images of the test-dataset and containing an (incomplete) projection of a cube. .

Here you find the code I use to generate the xml file, and test solvePnP and generate my xml file. file.

Here you find a not yet used dataset of a test szene, with two points with variation in the Z-Axis. Do you recommend to create the full-annotations for this testset?

I assume no important information to be mentioned here, but for completness I am appending the related question I asked at the 13th of march on stackoverflow.