Ask Your Question
5

converting from iplimage to cvmat and vise versa

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

Nermeen gravatar image

updated 2017-08-20 04:56:39 -0500

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 -0500

Jawaher Khemakhem gravatar image

updated 2013-05-28 05:28:06 -0500

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 -0500 )edit
2

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

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 -0500 )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 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

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

Seen: 36,539 times

Last updated: May 28 '13