title: OpenCV: solvePnP tvec units and axes directions
body: <p>I'm trying to find the relative position of the camera to the chessboard (or the other way around) - I feel OK with converting between different coordinate systems, e.g. as suggested <a href="https://stackoverflow.com/questions/14444433/calculate-camera-world-position-with-opencv-python?rq=1">here</a>. I decided to use chessboard not only for calibration but actual position determination as well at this stage, since I can use the <code>findChessboardCorners</code> to get the <code>imagePoints</code> (and this works OK).</p>
  
  <p>I've read a lot on this topic and feel that I understand the <code>solvePnP</code> outputs (even though I'm completely new to <code>openCV</code> and computer vision in general). Unfortunately, the results I get from <code>solvePnP</code> and physically measuring the test set-up are different: translation in z-direction is off by approx. 25%. <code>x</code> and <code>y</code> directions are completely wrong - several orders of magnitude and different direction than what I've read to be the camera coordinate system (x pointing up the image, y to the right, z away from the camera). The difference persists if I convert <code>tvec</code> and <code>rvec</code> to camera pose in world coordinates.</p>
  
  <p>My questions are:</p>
  
  <ul>
  <li>What are the directions of camera and world coordinate systems' axes?</li>
  <li>Does <code>solvePnP</code> output the translation in the same units as I specify the <code>objectPoints</code>?</li>
  <li>I specified the world origin as the first of the <code>objectPoints</code> (one of the chessboard corners). Is that OK and is <code>tvec</code> the translation to exactly that point from the camera coordinates?</li>
  </ul>
  
  <p>This is my code (I attach it <em>pro forma</em> as it does not throw any exceptions etc.). I used grayscale images to get the camera intrinsics matrix and distortion coefficients during calibration so decided to perform localisation in grayscale as well. <code>chessCoordinates</code> is a list of chessboard points location in mm with respect to the origin (one of the corner points). <code>camMatrix</code> and <code>distCoefficients</code> come from calibration (performed using the same chessboard and <code>objectPoints</code>).</p>
  
  <pre><code>camCapture=cv2.VideoCapture(0) # Take a picture of the target to get the imagePoints 
  tempImg=camCapture.read()
  imgPts=[]
  tgtPts=[]
  
  tempImg=cv2.cvtColor(tempImg[1], cv2.COLOR_BGR2GRAY)
  found_all, corners = cv2.findChessboardCorners(tempImg, chessboardDim )
  
  imgPts.append(corners.reshape(-1, 2))
  tgtPts.append(np.array(chessCoordinates, dtype=np.float32))
  
  retval,myRvec,myTvec=cv2.solvePnP(objectPoints=np.array(tgtPts), imagePoints=np.array(imgPts), cameraMatrix=camMatrix, distCoeffs=distCoefficients)
  </code></pre>