简体   繁体   English

IplImage与CvMat

[英]IplImage vs CvMat

I know many people are interested in the technical difference between IplImage and CvMat . 我知道很多人对IplImageCvMat之间的技术差异感兴趣。 (Yes, NOT cv::Mat (*), but CvMat .) So, let's clear the differences with a practical focus. (是的,不是cv::Mat (*),而是CvMat 。)所以,让我们以实际为重点来区分差异。

Is CvMat the refcounted version of IplImage ? CvMatIplImage版本吗? Is CvMat only a wrapper around IplImage ? CvMat只是IplImage的包装器吗? If so, why did they also develop CvMat ? 如果是这样,为什么他们也开发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. 我问了这些问题,因为我看到IplImage在整体搜索中是最受欢迎的,在我看来它也是最多的帖子。

What is the benefit of still using IplImage instead of newer structures? 仍然使用IplImage而不是更新的结构有什么好处

(*)(I have put also c++ tag here as many people are using it also with c++, and also some libraries prefer IplImage .) (*)(我在这里也提出了c ++标签,因为许多人也在使用c ++,而且有些库更喜欢IplImage 。)

I recommend you to read paragraph OpenCV Primitive Data Types from the book Learning OpenCV . 我建议您阅读Learning OpenCV一书中的OpenCV Primitive Data Types段落。 There's a big and good explanation about difference between these two datatypes. 关于这两种数据类型之间的差异有一个很好的解释。

IplImage came from the Intel Image Processing library, according to the docs: http://opencv.willowgarage.com/documentation/basic_structures.html#iplimage IplImage来自英特尔图像处理库,根据文档: 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? 这个问题也解决了CvMat结构,你可能会注意到: OpenCV的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. 至于哪个更有益:虽然在各种情况下CvMatIplImage在这里或那里可能存在轻微的速度差异 - 这取决于你想要做什么。 Eg 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.) (从理论上讲, IplImage提供的一个优势是,由于它的谱系,它通常与现有的实现更兼容,正如您所指出的那样。)

Answering your question: 回答你的问题:

What is the benefit of still using IplImage instead of newer structures? 仍然使用IplImage而不是更新的结构有什么好处?

Maybe none. 也许没有。 It has been deprecated by the devs for some reason, I would guess that the reason why you still find it a lot is because of legacy code; 由于某些原因它已被开发者弃用了,我猜你仍然会发现它的原因很多是因为遗留代码; because people still follow old code samples not being aware that the structure is deprecated and because "Learning OpenCV first edition " is outdated with regards to the opencv functions signatures and data structures but it is still followed by a lot of people starting with opencv. 因为人们仍然遵循旧的代码示例而不知道该结构已被弃用,并且因为“学习OpenCV 第一版 ”在opencv函数签名和数据结构方面已经过时,但仍然有许多人以opencv开头。

As a reference, Learning OpenCV 2nd edition is supposed to be out March 2013, but don't quote me on that ;) 作为参考, 学习OpenCV第二版应该是2013年3月,但不要引用我;)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM