-1

I am trying to find distance of a person from the camera in a video using landmarks and cv2.solvePnp function. Ideally I want to get distance in some real world unit like metres/cm/mm

I have used Mediapipe pose detector to find 2d and 3d landmarks from the video and cv2.calibratecamera to get camera matrix. I then used cv2.solvePnp on every frame to find rvec and tvec. Then I multiplied [rvec|tvec] with 3d landmarks to get 3d points in camera coordinate system and used z coordinate as a proxy for distance. Although I am getting correct trends (If I go back distance increases and vice-versa), I don't understand the scale/units of values.How can I convert those into meters/cm/mm etc?

Here are some of my confusion

  1. According to mediapipe documentation, the 3d 'world coordinates" are in meters with hip as origin, however the coordinates I am getting after solvpnp are in order of 1000 so it can't be meters

  2. According to cv2.calibratecamera if we give the real-world coordinates of chessboard in different units then answer should also be scaled. However, even if I try to scale objectpoints by different values my intrinsic matrix which I get remains the same

0 Answers0