OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Thu, 24 Jan 2013 15:21:41 -0600copy selected row of a matrix to anotherhttp://answers.opencv.org/question/6460/copy-selected-row-of-a-matrix-to-another/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]
**Update:**
The error has disappeared. However, the program still crashes in the middle. And the debug shows error in memcpy.asm
UnwindUp2: mov eax,[esi+ecx*4-8] ;U(entry)/V(not) - get dword from source ;V(entry) - spare
What was the underlying reason for this issue?southparkThu, 24 Jan 2013 15:21:41 -0600http://answers.opencv.org/question/6460/