I want to create a vector of cv::Matrix in a c++ program and on each index i want to copy the submatrix of an image, for example;
vector<Mat> VectorMat;
VectorMat[i]=threshImage(cv::Rect(x,y,max.x-min.x,max.y-min.y));
But this is not working, I also tried to use loop method in which I am using mat.at<uchar>(row,col) to copy the matrix data in sub matrix, but program hangs.
What is the best way to get the submatrix in opencv and copy it in a vector of cv::Mat
Thank You
To make a real copy you can do
or