1 | initial version |
Setting the cx and cy values manually to the real middle of the image size has helped me here.
Creating the Projection matrices like this helped me get a pretty good result.
//LEFT
float fx = camera_matrixL.at<float>(0, 0);
float fy = camera_matrixL.at<float>(1, 1);
//Set mid point to actual pixel center
cv::Mat_<float> P_left(3, 4);
P_left << fx, 0, 424, 0,
0, fy, 400, 0,
0, 0, 1, 0;
//RIGHT
float fx = camera_matrixR.at<float>(0, 0);
float fy = camera_matrixR.at<float>(1, 1);
//P2 gets the baseline added
cv::Mat_<float> P_right(3, 4);
P_right << fx, 0, 424, T.at<float>(0, 0) * 10,
0, fy, 400, 0,
0, 0, 1, 0;