I want to convert a mXn IplImage into a (m*n) x 1 1D vector. Can this be done with any function in OpenCV?
Any help is greatly appreciated.
cvReshape
CvMat* cvReshape(const CvArr* arr, CvMat* header, int newCn, int newRows=0)Changes shape of matrix/image without copying data.
And the next example converts a 3x3 matrix to a single 1x9 vector:
CvMat* mat = cvCreateMat(3, 3, CV_32F); CvMat row_header, *row; row = cvReshape(mat, &row_header, 0, 1);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With