Ask Your Question
4

what is the difference of Mat and Iplimage

asked 2013-04-05 13:09:33 -0600

Heshan Sandeepa gravatar image

i am using opencv and c++ for my OCR application. There i am confusing with Mat and Iplimage data structures. i saw following both ways,

  1. IplImage* img = cvLoadImage("C:/MyPic.jpg");
  2. Mat image = imread( argv[1] );

can any one explain what is the c++ code here? Mat or Iplimage?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
13

answered 2013-04-05 14:00:07 -0600

IplImage is the original format for storing image data from the old OpenCV1.x interface which is also called the C - style interface.

Mat is the newer format from the OpenCV2.x versions and on. This is the C++ interface. Largest advantage is that you do not have to take care of pointers anymore. You do not have to deallocate memory, so you do not have to worry that the assigned memory will be locked forever. The garbage collector of the C++ interface will do the work for you :)

I suggest sticking with the newer C++ interface, since it results in much clearer and more understandable code.

edit flag offensive delete link more

Comments

1

hi steven ,thank u very for consideration about my question.

Heshan Sandeepa gravatar imageHeshan Sandeepa ( 2013-04-05 14:12:08 -0600 )edit

Question Tools

Stats

Asked: 2013-04-05 13:09:33 -0600

Seen: 14,320 times

Last updated: Apr 05 '13