IplImage or CvMat to Mat
- Library/opencv
- 2012. 11. 21.
IplImage or CvMat to Mat
> IplImage or CvMat -----> cv::Mat:
> from definition of cv::Mat
// converts old-style CvMat to the new matrix; the data is not copied by default Mat(const CvMat* m, bool copyData=false); // converts old-style IplImage to the new matrix; the data is not copied by default Mat(const IplImage* img, bool copyData=false); IplImage *myIplImage = cvCreateImage(...); Mat myIplImageMat=Mat(myIplImage,true); //true if you wish an independent copy else it will change myIplImage data
Vice-Versa:
//again, from the definition of cv::Mat // converts header to CvMat; no data is copied operator CvMat() const; // converts header to IplImage; no data is copied operator IplImage() const;
That is:
Mat myMat=Mat(...); IplImage myIplImageMat=myMat; //without * !!! vWhatEverOldCFunction(&myMat,...other arguments); // or Mat mat ... IplImage *trans = &IplImage(mat);
Reference
[1] opencv-users
http://opencv-users.1802565.n2.nabble.com/IplImage-lt-gt-cv-Mat-td5317470.html
'Library > opencv' 카테고리의 다른 글
groupRectangles (0) | 2012.11.23 |
---|---|
Rectangle Detection (0) | 2012.11.21 |
opencv2.4.3 for android (win,mac, ubuntu) (0) | 2012.11.20 |
opencv Mat 를 이용한 데이터 저장 (FileStorage) 사용. (2) | 2012.10.21 |
[CUDA] CUDA4.2.9 Setting with Visual studio 2010 (0) | 2012.10.16 |