# Revision history [back]

See comments for answer.Solved it - This function convert the aggregated pose into a projection matrix that makes sense.

inline cv::Mat getProjectionMat(const cv::Mat &T, const cv::Mat &K){

cv::Mat R = T(cv::Range(0, 3), cv::Range(0, 3));
cv::Mat t = T(cv::Range(0, 3), cv::Range(3, 4));

cv::Mat P(3, 4, CV_64F);

P(cv::Range(0, 3), cv::Range(0, 3)) = R.t();
P(cv::Range(0, 3), cv::Range(3, 4)) = -R.t()*t;
return  K*P;
}


Source http://nghiaho.com/?p=2379

maym86 gravatar imagemaym86 (4 hours ago)edit "My understanding is that the camera pose relates camera movement, where as the projection operates on 3d points, so they should have different representation. A simple example you can think of is a camera that moves in the x direction by 1 unit with no rotation. So the camera pose is R = identity, t = [1,0,0]. If we are looking at a bunch of 3d points in front of us, then by moving the camera right, we expect the points to move left, resulting in the projection matrix [R=identity | t=[-1,0,0]]." - nghiaho12

Solved it - This function convert the aggregated pose into a projection matrix that makes sense.

inline cv::Mat getProjectionMat(const cv::Mat &T, const cv::Mat &K){

cv::Mat R = T(cv::Range(0, 3), cv::Range(0, 3));
cv::Mat t = T(cv::Range(0, 3), cv::Range(3, 4));

cv::Mat P(3, 4, CV_64F);

P(cv::Range(0, 3), cv::Range(0, 3)) = R.t();
P(cv::Range(0, 3), cv::Range(3, 4)) = -R.t()*t;
return  K*P;
}


Source http://nghiaho.com/?p=2379

maym86 gravatar imagemaym86 (4 hours ago)edit "My understanding is that the camera pose relates camera movement, where as the projection operates on 3d points, so they should have different representation. A simple example you can think of is a camera that moves in the x direction by 1 unit with no rotation. So the camera pose is R = identity, t = [1,0,0]. If we are looking at a bunch of 3d points in front of us, then by moving the camera right, we expect the points to move left, resulting in the projection matrix [R=identity | t=[-1,0,0]]." - nghiaho12