In OpenCV, I am using a Charuco board, have calibrated the camera, and use estimate to get rvec and tvec. (similar to the sample code). I am using a stationary board, with a camera moves around. I'm a noob with this, so please bear with me if this is something simple I am missing.
I understand that I can use Rodrigues() to get the 3x3 rotation matrix for the board orientation from rvec, and that I can transform the tvec value into world coordinates using worldPos = -R.t() * tvec (in python) to get position of camera
It seems that I got everything i need, however, if I rotate the camera physically, WorldPos also changes hugely! I am sure it’s not because the camera has been moved since I tried many times.
I don’t know where the problem is, thanks for your suggestion.
And the code is below(in python).
self.retval, self.rvec, self.tvec = aruco.estimatePoseBoard(self.corners, self.ids, board, self.cameraMatrix, self.distanceCoefficients)
self.dst, jacobian = cv2.Rodrigues(self.rvec)
self.rvec_trs = self.dst.transpose()
self.worldPos = - self.rvec_trs * self.tvec
self.worldPos = [self.worldPos[0][0],self.worldPos[1][1], self.worldPos[2][2]]