O'Reilly logo

Learn OpenCV 4 by Building Projects - Second Edition by Prateek Joshi, Vinicius G. Mendonca, David Millan Escriva

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

Size object type

Another template class that is very important and widely used in OpenCV is the template class for specifying the size of an image or rectangle—Size. This class adds two members, width and height, and the useful area() function. In the following sample, we can see a number of ways of using size:

Size s(100,100);Mat img=Mat::zeros(s, CV_8UC1); // 100 by 100 single channel matrixs.width= 200;int area= s.area(); returns 100x200

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