def vecToMat(vec): f, k1, k2, ox, oy = vec[6:] rot = vec[:3] trans = vec[3:6] K = np.eye(3) K[[0,1],[0,1]] = f K[:2, 2] = [ox, oy] R = cv2.Rodrigues(rot)[0] RT = np.zeros((3, 4), dtype=np.float32) RT[:3, :3] = R RT[:3, 3] = trans P = Calibrate.composeKRT(K, RT)[:3,:] return np.float32(P), (k1, k2)
def P(self, upright=True): '''Yields the camera projection matrix P = K RT.''' return Calibrate.composeKRT(self.K(),self.RT(upright = upright))