I want to convert mXn IplImage to a vector (m * n) x 1 1D. 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 the shape of the matrix / image without copying data.And the following example converts 3x3 matrices to one 1x9 vector:CvMat* mat = cvCreateMat(3, 3, CV_32F); CvMat row_header, *row; row = cvReshape(mat, &row_header, 0, 1);
CvMat* cvReshape(const CvArr* arr, CvMat* header, int newCn, int newRows=0)
And the following example converts 3x3 matrices to one 1x9 vector:
CvMat* mat = cvCreateMat(3, 3, CV_32F); CvMat row_header, *row; row = cvReshape(mat, &row_header, 0, 1);
Source: https://habr.com/ru/post/1750651/More articles:Trusted certificates become invalid - javaEnumerator problem, any way to avoid two loops? - c #How can I transfer FLV files to IIS7 - flashHow to redirect if javascript is disabled on asp.net mvc main page - javascriptHow can I use listDictionary? - c #How to create closed areas (convex polygons) from many line segments? - c ++ASP.NET and WCF RIA Services - asp.netКак я могу настроить свой пользовательский тип результата с помощью плагина conventions в результате - pluginsjQuery Select and drag a Chrome issue - jqueryMySql too many connections - javaAll Articles