Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>IplImage and cv::Mat are different header types for matrix/image data. They're basically compatible with each other, but IplImage is used in OpenCV's C API, while cv::Mat is used in the <strong>new</strong> C++ API.</p> <p>When you decide to use OpenCV's C API, you will mostly use IplImages. Otherwise you will mostly use cv::Mats.</p> <p>Of course, you can convert IplImages and cv::Mats to each other, e.g.</p> <pre><code>cv::Mat mat(myIplImage); </code></pre> <p>In this case, they share the same underlying data, i.e. modifications made through either header will be visible regardless of what header you're using to access the data.</p> <p>Deep-copy (not only header is "transformed"/copied, but also the underlying data) is possible with</p> <pre><code>cv::Mat mat(myIplImage, true) </code></pre> <p>Note that multiple IplImages can also point to the same underlying data, as can multiple cv::Mats.</p> <hr> <p>When working with OpenCV and similar libraries it is important to notice that cv::Mats and IplImages are only "headers" for the actual data. <strong>You could say that cv::Mats and IplImages are basically pointers plus important <em>meta information</em> like number of rows, columns, channels and the datatype used for individual cells/pixels of the matrix/image.</strong> And, like real pointers, they can reference/point to the same <em>real</em> data.</p> <p>For example, look at the definition of IplImage: <a href="http://opencv.willowgarage.com/documentation/basic_structures.html#iplimage">http://opencv.willowgarage.com/documentation/basic_structures.html#iplimage</a></p> <p>The most important member is <code>char *imageData;</code>. This pointer references the <em>actual</em> image data. However, the IplImage <em>as a whole</em> contains meta information about the image as well, like number of rows and columns.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload