Hi,
Thanks for answering my previous question. I have one more related issue.
I am still a little confused with the at operator for unknown type matrix.
// copy select rows into a new matrix
Mat indices; // n*1 matrix storing the row index, up to index 165600
Mat dst;
Mat src; // n*2 matrix
void copy_matrix(Mat &src, Mat &dst, Mat &indices)
{
for (int i=0; i<indices.rows; i++)
{
// now copy the row vector
Mat M1;
src.row(indices.at<unsigned int>(i,1)).copyTo(M1);
dst.push_back(M1);
}
}
The above code can pass the debug procedure. However, when I run the code, it gives the following error. The matrix indices has the data type int ( 0 to 4294967295). Therefore, the return type should be correct. I don't know which part goes wrong. I also tried at<int>, at<uchar> or other data types. But the error remains. Much appreciated for your help.
Error: assertion failed, <dims <="2" &&="" data="" &&="" <unsigned=""> i0 << unsigned >size.p[0]