reshaping a matrix failed in OpenCV 2.4.3

后端 未结 1 1009
借酒劲吻你
借酒劲吻你 2021-01-07 11:09

I am using OpenCV 2.4.3 to create and reshape a matrix like this:

cv::Mat testMat = cv::Mat::zeros ( 500, 200, CV_8UC3 );
std::cout << \"size of testM         


        
相关标签:
1条回答
  • 2021-01-07 11:57

    reshape returns a new Mat header

    cv::Mat testMat = cv::Mat::zeros ( 500, 200, CV_8UC3 );
    std::cout << "size of testMat: " << testMat.rows << " x " << testMat.cols << std::endl;
    
    cv::Mat result = testMat.reshape ( 0, 1 );
    std::cout << " size of original testMat: " << testMat.rows << " x " << testMat.cols << std::endl;
    std::cout << " size of reshaped testMat: " << result.rows << " x " << result.cols << std::endl;
    
    0 讨论(0)
提交回复
热议问题