Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

asked 2017-04-24 23:41:38 -0600

Nbb gravatar image

Mat pointer

How do I create a vector of Mat pointers ? In the code below, I want to read the yaml files into the matrices K_00, K_01, etc

    //initialize camera params
    cv::Mat K_00, K_01, D_00, D_01, R, Tr;  
    std::vector<cv::Mat>     camera_params      = {  K_00,   K_01,   D_00,   D_01,   R,   T };
    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);
        fs[camera_params_name[i]] >> camera_params[i];
    }

    //error K_00, K_01, etc. are all empty
    stereoRectify(K_00, cv::Mat(), K_01, ....); // I want to use K_00, etc. instead of 
                                                // camera_params[0]