1

I really don't know what to use for the next projects: IplImage? or Cv::Mat?

Knowing that I want :

  • a better performance
  • considerable speed response regarding the different tools to use (multiplication of mat, different computations / image processing tools ...)
  • less use of memories

If so, shall I change all my previous IplImages to cv::Mat?

user2354422
  • 169
  • 1
  • 2
  • 8

1 Answers1

6

Neither of them is faster or lighter than the other. At least in any measurable way. (maybe cv::Mat has 4 bytes more than an IplImage, which won't hurt compared to the 12.000.000 bytes you need to store an image data into it)

Neither of them offer faster computations, nor more tools to process it.

All they offer is a pointer to some data, and some extra info regarding the image width, height, step and type.

But cv::Mat (and the rest of the C++ interface) is way easier and safer to use. You write less code, in less time. You have less bugs to fix. That allows you to focus on improving your algorithms on both speed and memory consumption.

And for this fact, yes, cv::Mat is much faster and lighter - if you put it to good use.

Also, check this similar one OpenCV: C++ and C performance comparison

Community
  • 1
  • 1
Sam
  • 19,708
  • 4
  • 59
  • 82
  • 3
    I'd say if the poster is going for C++ he also uses the C++ api and therefore saves him/herself some troubles in the future, and should therefore choose cv::Mat. Performance wise it doesn't really make a difference like you say. – hetepeperfan May 24 '13 at 13:03