0

So I already know the 3D camera position and the position and size of an object in the world frame, as well as the camera matrix and distortion coefficients from a previous camera calibration.

What I need to work out is the 2D image coordinates of the object. Let's just say the object is a sphere with world position objPos and radius objRad, so the image I want to find the coordinates for will be a circle of image position imgPos and radius imgRad.

How would I go about doing this?

Cheers

Max Fuller
  • 53
  • 1
  • 5
  • you need a lot more things than that, you need a camera matrix used for the projection, you need the extrinsics which is the translation and rotation from the model coordinate system to the camera coordinate system. Then you will project the points... the position is easys to calculate, however the radius is not so simple unless that you project every point of the sphere, or you project to an image plane perpendicular to the sphere. – api55 Dec 04 '17 at 11:29

1 Answers1

1

In OpenCV exists a function to project 3D coordinates on a (camera) image - projectPoints In my opinion you have all you need for calling this function. The arguments are:

  1. 3D coordinates you want to project
  2. Rotation of your camera - rvec
  3. Position of your camera - tvec
  4. Camera matrix - from the calibration you have
  5. Camera distortion coefficients - from the calibration you have
  6. Resulting 2D image coordinates

If you have your extrinsic camera parameters in form of 4x4 matrix, you have to extract rvec and tvec from it (see here).

To come to your example case: I would generate the 3D coordinates of such a sphere with the corresponding radius. In a next step, I would project these 3D coordinate with above method.

Adrian Schneider
  • 1,427
  • 1
  • 11
  • 17