Ask Your Question
5

converting from iplimage to cvmat and vise versa

asked 2013-05-28 03:30:48 -0600

Nermeen gravatar image

updated 2020-11-30 03:25:26 -0600

could anybody please tell me how can i convert iplimage to mat and convert mat to iplimage

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
7

answered 2013-05-28 04:48:02 -0600

Jawaher Khemakhem gravatar image

updated 2013-05-28 05:28:06 -0600

To convert from Mat to IplImage :

 Mat mat_img;
IplImage ipl_img = mat_img;

For example to use ipl_img you will write ,

cvNot(&ipl_img ,&ipl_img );

To convert from IplImage to Mat :

IplImage ipl_img;
Mat mat_img(ipl_img );
edit flag offensive delete link more

Comments

that's simple, understandable and helpful.... thank u

Nermeen gravatar imageNermeen ( 2013-05-28 05:57:47 -0600 )edit
2

answered 2013-05-28 04:31:06 -0600

Check OpenCV C++ Cheatsheet. It can be helpful.

edit flag offensive delete link more

Comments

2

(taken from the sheet)

// Assuming somewhere IplImage *iplimg; exists

// and has been allocated and cv::Mat Mimg has been defined

Mat imgMat(iplimg); //Construct an Mat image "img" out of an IplImage

Mimg = iplimg; //Or just set the header of pre existing cv::Mat

//Ming to iplimg's data (no copying is done)

//Convert to IplImage or CvMat, no data copying

IplImage ipl_img = img;

CvMat cvmat = img; // convert cv::Mat -> CvMat

poti gravatar imagepoti ( 2013-05-28 04:53:36 -0600 )edit

thank u but I'm new to opencv and i thought that was complicated to me :(

Nermeen gravatar imageNermeen ( 2013-05-28 06:07:49 -0600 )edit

Question Tools

Stats

Asked: 2013-05-28 03:30:48 -0600

Seen: 38,261 times

Last updated: May 28 '13