Translation gives wrong norm in SolvePNP?

With the above image called “img2” I am trying to solvepnp so I can use the translation and rotation for the cv.calibrateHandEye() function. When I am using the solvepnp method and get the translation and rotation I get a norm that is too small. The euclidian norm says the camera is 10 unknown units. the correct distance is around 30 cm. What is the cause of this error. by a factor of three? I have two calibrations, one factory which is mtx in the code. These parameters is the calibration parameters from intel real sense. The second one, mtx2, is my own from Matlab. They are different but give almost the same norm. What did i misunderstand? My code is based on this tutorial from Opencv`

The board is 7x9 and 20x20mm

I cant continue without making sure that everything works.

import cv2
import numpy as np


img=cv2.imread('img2.png')

mtx=np.asarray([[420.12387085,0.,421.87664795],[0.,420.12387085,241.06109619],[0.,0.,1.]])

mtx1=np.asarray([[231.7225,0,161.8237],[0,229.9110,80.4734],[0,0,1.0000]])

criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.001)

objp = np.zeros((9*7,3), np.float32)

objp[:,:2] = np.mgrid[0:7,0:9].T.reshape(-1,2)

gray = cv2.cvtColor(img,cv2.COLOR_RGB2GRAY)

ret, corners = cv2.findChessboardCorners(gray, (7,9),None)

#solvepnp with factory calibration

if ret == True:

    corners2 = cv2.cornerSubPix(gray,corners,(11,11),(-1,-1),criteria)

    # Find the rotation and translation vectors.

    ret,rvecs, tvecs = cv2.solvePnP(objp, corners2, mtx,None)

    print("norm:\n",np.linalg.norm(tvecs))

    print("vector:\n",tvecs)

#solvepnp with matlab calibration

if ret == True:

    corners2 = cv2.cornerSubPix(gray,corners,(11,11),(-1,-1),criteria)

    # Find the rotation and translation vectors.

    ret,rvecs, tvecs = cv2.solvePnP(objp, corners2, mtx1,None)

    print("norm:\n",np.linalg.norm(tvecs))

    print("vector:\n",tvecs)

that’s your model. those are your units. you didn’t multiply that by your knowledge of the metric length of those squares. squares are now your base unit.

your camera is 10 squares away.

maybe. picture looks like it ought to be more but who knows, maybe the calibration is bad.