Search code examples
c++copencvmatrixiplimage

IplImage vs CvMat


I know many people are interested in the technical difference between IplImage and CvMat. (Yes, NOT cv::Mat(*), but CvMat.) So, let's clear the differences with a practical focus.

Is CvMat the refcounted version of IplImage? Is CvMat only a wrapper around IplImage? If so, why did they also develop CvMat?

I asked these questions because I saw IplImage being far and away the most popular at the overall searches and in my opinion it also has the most posts.

What is the benefit of still using IplImage instead of newer structures?

(*)(I have put also c++ tag here as many people are using it also with c++, and also some libraries prefer IplImage.)


Solution

  • IplImage came from the Intel Image Processing library, according to the docs: http://opencv.willowgarage.com/documentation/basic_structures.html#iplimage

    This question also addresses the CvMat structure, which may be of note to you: What is the memory structure of OpenCV's cvMat?

    As regards which is more beneficial: while there may be slight speed differences here or there with either CvMat or IplImage in various contexts — it depends on what you want to do. E.g. do you need to share a matrix structure in memory? Do you need to efficiently serialize, or search, etc? The application matters.

    (Theoretically, one advantage offered by IplImage is that due to its pedigree, it's generally more compatible with existing implementations, as you noted.)