Skip to Content
Computer Vision with OpenCV 3 and Qt5
book

Computer Vision with OpenCV 3 and Qt5

by Amin Ahmadi Tazehkandi
January 2018
Intermediate to advanced content levelIntermediate to advanced
486 pages
11h 28m
English
Packt Publishing
Content preview from Computer Vision with OpenCV 3 and Qt5

The Mat_<_Tp> class

The Mat_<_Tp> class is a subclass of the Mat class (and a template class) with identical members, but it can be quite helpful when the type of the matrix (or elements in an image) is known at <indexentry content="Mat class:Mat_ class" dbid="256603" state="mod"> compile time. It also provides a better access method (more readable, so to speak) than the at function of the Mat class. Here's a short example:

    Mat_<Vec3b> imageCopy(image); // image is a Mat class 
    imageCopy(10, 10) = Vec3b(0,0,0); // imageCopy can use () 

Provided that you are careful about the types, you can pass a Mat_<_Tp> class to any function that accepts a Mat class, without any issues.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering OpenCV 4 - Third Edition

Mastering OpenCV 4 - Third Edition

Roy Shilkrot, David Millán Escrivá
Hands-On Computer Vision with TensorFlow 2

Hands-On Computer Vision with TensorFlow 2

Benjamin Planche, Eliot Andres
OpenCV 4 with Python Blueprints - Second Edition

OpenCV 4 with Python Blueprints - Second Edition

Dr. Menua Gevorgyan, Michael Beyeler (USD), Arsen Mamikonyan, Michael Beyeler

Publisher Resources

ISBN: 9781788472395Supplemental Content