Reputation: 123
I hope that you can help me...
I have an IplImage (reimg_right) 320 X 240, IPL_DEPTH_32F and I want to save it as an image and as an xml file. I use this code:
sprintf(name1,"path1/image.bmp");
sprintf(name2,"path2/feature_image32F.xml");
cvSaveImage(name1,reimg_right);
cvSave(name2, reimg_right, NULL, NULL, cvAttrList(0,0));
all is ok but the problem is that in the xml file I don't have a matrix 320 X 240 but a matrix 19200 X 4 !!! someone knows how to hold the dimensions? thanks gabriele
Upvotes: 0
Views: 2866
Reputation: 93468
I don't know what OpenCV version you are using, but some time ago you could do just:
cvSave("file.xml", my_img);
assuming my_img as:
CvMat* my_img = cvCreateMat(320, 240, CV_32FC1);
But since you are using an IplImage, you could convert them like:
CvMat mat;
CvMat* my_img = cvGetMat(reimg_right, &mat);
cvSave("file.xml", my_img);
Upvotes: 1