I would like to estimate the pose of know 3D object by using opencv. I can use solvePnP if the points of the 3D Model and their corresponded points at the image are given. My question is: how I can find the correspondence between the know 3D Model and its projection on the image? Thank you a lot
Asked
Active
Viewed 2,124 times
3
-
What do u mean by correspondence? Are you talking about augmented reality? – Sumeet Jindal Jun 26 '12 at 06:03
-
I am not talking explicitly about AR. AR can be one of use cases where you need the pose estimation. By correspondence I mean, which point of know 3D Model is projected to which point onto the image. For example in this blog. http://www.morethantechnical.com/2010/03/19/quick-and-easy-head-pose-estimation-with-opencv-w-code/ The points of 3D Models are known and the points of this 3D Model, that are projected onto the image, are also known. I hope, I could explain it well. – M.K. Jun 26 '12 at 11:18
3 Answers
3
Once you have some matches of points in the 3d model and points in the scene, you have to apply cv::findHomography(). This function calculates a matrix that projects any point from the 3D model into the scene. Actually only 4 matches are needed for homography calculation.

Jav_Rock
- 22,059
- 20
- 123
- 164
1
poseMatrix = solvePnP(objectPoints, imagePoints);
imagePoint_computed = objectPoints[i] * poseMatrix * cameraMatrix
find the j at which
imagePoints[j] ~= imagePoint_computed.
objectPoints[j] and imagePoints[i] are the corresponding points.

Sumeet Jindal
- 882
- 1
- 7
- 16
-
but doesn't solvePnP have to have objectpoints and imagepoints in corresponding order? that's the issue, he doesn't know which image point corresponds to which object point. you could run through some loop trying different correspondences, but that is not reliable. – hokiebird Dec 04 '12 at 05:45
1
This kept bugging me, so I kept looking. the SoftPOSIT algorithm is what you want. http://www.cfar.umd.edu/~daniel/Site_2/Code.html has a matlab implementation, some folks have translated to c/c++

hokiebird
- 280
- 1
- 5
- 15