7

I am new to OpenCV. I have got the Surf Detection sample working. Now I want to place a 3d model on the detected image.

How can I find the 3d Projection matrix?

Sumeet Jindal
  • 882
  • 1
  • 7
  • 16
  • 1
    Possible solution : http://urbanar.blogspot.in/2011/04/from-homography-to-opengl-modelview.html – Sumeet Jindal May 28 '12 at 07:13
  • 2
    The problem is too complex for that simple question. You mean the Homography. You have to pass the keypoints detected with surf to the function cvFindHomography – Jav_Rock May 28 '12 at 14:50

1 Answers1

5

I guess you are talking about Augment Reality as you say you want to place a 3D model on the detected image (in the camera frame? ). They key of the problem is always to detect at least 4 points that match other 4 "keypoints" in our marker. Then, solving some equations we will get our homography, which will allow us to project any point.

In OpenCV there is a function that performs this task: cvFindHomography

You just need the pairs of matches, select a method (RANSAC, i.e.) and you will get the Homography.

Then you can project the points like explained here:

Community
  • 1
  • 1
Jav_Rock
  • 22,059
  • 20
  • 123
  • 164
  • 1
    I used cvFindHomography to project a test square on to the image and then called solvePnP to compute the modelview matrix. – Sumeet Jindal May 28 '12 at 20:23