conversion between CvMat* and cv::Mat
how can I convert CvMat*
to cv::Mat
?
how can I convert CvMat*
to cv::Mat
?
cvarrToMat Converts CvMat, IplImage , or CvMatND to Mat.
Fixed the conversions using new syntax.
CvMat* A = cvCreateMat(10, 10, CV_32F);
cvSetIdentity(A);
IplImage A1;
cvGetImage(A, &A1);
Mat B (A);
Mat B1 (A1);
IplImage C = B.operator IplImage();
CvMat C1 = B1.operator CvMat();
// now A, A1, B, B1, C and C1 are different headers
// for the same 10x10 floating-point array.
// note that you will need to use "&"
// to pass C & C1 to OpenCV functions, for example:
printf("%g\n", cvNorm(&C1, 0, CV_L2));
Asked: Jun 30 '15
Seen: 3,848 times
Last updated: Jun 30 '15
I would suggest not using CvMat... Where do you need it?