O'Reilly logo

OpenCV By Example by Vinícius Godoy, David Millán Escrivá, Prateek Joshi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Other basic object types

We have learned about the Mat and Vec3b classes, but we need to learn about other classes as well.

In this section, we will learn about the most basic object types required in most of the projects:

  • Vec
  • Scalar
  • Point
  • Size
  • Rect
  • RotatedRect

The vec object type

vec is a template class that is used mainly for numerical vectors. We can define any type of vectors and a number of components:

Vec<double,19> myVector;

Or we can use any of the predefined types:

typedef Vec<uchar, 2> Vec2b; typedef Vec<uchar, 3> Vec3b; typedef Vec<uchar, 4> Vec4b; typedef Vec<short, 2> Vec2s; typedef Vec<short, 3> Vec3s; typedef Vec<short, 4> Vec4s; typedef Vec<int, 2> Vec2i; typedef Vec<int, 3> Vec3i; typedef Vec<int, 4> Vec4i; typedef Vec<float, 2> Vec2f; typedef ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required