1 | initial version |
Your Mats are reallocated when they are filled and camera_params[i] point to another Mat header. You should do something like this:
std::vector<cv::Mat> camera_params;
std::vector<std::string> camera_params_name = { "K_00", "K_01", "D_00", "D_01", "R", "T"};
for (int i = 0; i < camera_params.size(); i++)
{
cv::FileStorage fs;
fs.open(root + camera_params_name[i] + ".yaml", cv::FileStorage::READ);
Mat tmp;
fs[camera_params_name[i]] >> tmp;
camera_params.push_back(tmp);
}
stereoRectify(K_00, cv::Mat(), camera_param[0], ....);
2 | No.2 Revision |
Your Mats are reallocated when they are filled and camera_params[i] point to another Mat header. You should do something like this:
std::vector<cv::Mat> camera_params;
std::vector<std::string> camera_params_name = { "K_00", "K_01", "D_00", "D_01", "R", "T"};
for (int i = 0; i < camera_params.size(); i++)
{
cv::FileStorage fs;
fs.open(root + camera_params_name[i] + ".yaml", cv::FileStorage::READ);
Mat tmp;
fs[camera_params_name[i]] >> tmp;
camera_params.push_back(tmp);
}
stereoRectify(K_00, stereoRectify(camera_param[0], cv::Mat(), camera_param[0], camera_param[1], ....);
3 | No.3 Revision |
Your Mats are reallocated when they are filled and camera_params[i] point to another Mat header. You should do something like this:
std::vector<cv::Mat> camera_params;
std::vector<std::string> camera_params_name = { "K_00", "K_01", "D_00", "D_01", "R", "T"};
for (int i = 0; i < camera_params.size(); i++)
{
cv::FileStorage fs;
fs.open(root + camera_params_name[i] + ".yaml", cv::FileStorage::READ);
Mat cv::Mat tmp;
fs[camera_params_name[i]] >> tmp;
camera_params.push_back(tmp);
}
stereoRectify(camera_param[0], cv::Mat(), camera_param[1], ....);