OpenCV: IplImage versus Mat, which to use?

后端 未结 11 1118
一整个雨季
一整个雨季 2020-12-13 01:56

I\'m pretty new to OpenCV (about 2 months now). I have the book Learning OpenCV by Bradski and Kaehler. My question is, if I want to do everything in a 2.0+ manner, when sho

11条回答
  •  时光说笑
    2020-12-13 02:07

    IplImage has been in OpenCV since the very beginning. It is a part of the C interface for OpenCV. You need to allocate and deallocate memory for IplImage structures yourself. (remember the cvReleaseImage commands?)

    The new Mat structure is a part of the C++ structure. So obviously it is object oriented. Also, it manages all memory for you! It keeps a track of references to it. Then the number of references goes to zero, it deallocates automatically. This is one superb feature!

    Go for Mat. It should be easy to translate code from the IplImage thingy to the Mat thingy if you are using some IDE that has Intellisense (it drops down a list of possible functions, variables, etc as you type)

提交回复
热议问题