How to read the text file and create Mat object in C++

后端 未结 4 1529
长发绾君心
长发绾君心 2021-01-13 13:45

Hi i have being able to write a Mat object in to a text file. As follows,

std::fstream outputFile;
    outputFile.open( \"myFile.txt\", std::ios::out ) ;

          


        
4条回答
  •  一个人的身影
    2021-01-13 14:35

    try something like this:

    initialize these two outside the while loop

    int k=0;
    int l=0;
    

    and instead of using the for loop

    if(j(k,l) = ::atof(str.c_str());
    }else{
        k=0;
        l++;
        des_object1.at(k,l) = ::atof(str.c_str());
    }
    j++;
    

提交回复
热议问题