0

Referring to the question: Computing x,y coordinate (3D) from image point

If I have the coordinate Z of the point measured in pixel (not in mm), how can I do the same thing shown in the question above?

Community
  • 1
  • 1
Luca90
  • 63
  • 1
  • 2
  • 12
  • Are you sure it is the same question? I'm sure the other problem only worked because the height z was fixed. – Sebastian Schmitz Jan 07 '14 at 14:43
  • I understand, my task is obtaining the 3D coordinates (x and y) of the center of a sphere and the radius of the sphere. So it's correct projecting the plane on my two points in order to set the coordinate Z to 0? – Luca90 Jan 07 '14 at 15:01

1 Answers1

1

The calibration matrix A returned by calibrateCamera provides the scaling factors, when paired with the physical dimensions of the sensor. Use the calibrationMatrixValues routine to do the conversions. You can get the sensor dimensions from the camera spec sheet or (sometimes) from the image EXIF header.

Once you have the f_mm from it, it is Z_mm = f_mm / fx * Z_pixels.

Francesco Callari
  • 11,300
  • 2
  • 25
  • 40
  • I'm reading the book "learning opencv computer vision with the opencv library" and I'm trying to use the formula q=sMWQ, where q=[x,y,1] trasposed and it's known, s is the scale factor and it is unknown (it's my problem), M is the camera matrix and it is known, W is the product of the rotation matrix and the traslation matrix and it's known, Q=[X,Y,1] trasposed and it is unknown (it's my task). How can I calculate the scale factor "s"? I don't know if what I wrote is related to your answer, sorry I didn' understand your answer. – Luca90 Jan 07 '14 at 15:42
  • Ok, so I have to resolve this formula [69a88b04c61001bf4e198abae39569e8bc3e81c2.png](http://docs.opencv.org/_images/math/69a88b04c61001bf4e198abae39569e8bc3e81c2.png) where "fx" and "fy" are the pixel focal lenghts that you have explained above and "z" is the distance between the point and the camera, it's correct? – Luca90 Jan 08 '14 at 15:04
  • Re-edited answer to clarify. Please accept or upvote if you find it useful – Francesco Callari Jan 08 '14 at 16:39