1// just some valid rectangle arguments
2int x = 0;
3int y = 0;
4int width = 10;
5int height = 20;
6// our rectangle...
7cv::Rect rect(x, y, width, height);
8// and its top left corner...
9cv::Point pt1(x, y);
10// and its bottom right corner.
11cv::Point pt2(x + width, y + height);
12// These two calls...
13cv::rectangle(img, pt1, pt2, cv::Scalar(0, 255, 0));
14// essentially do the same thing
15cv::rectangle(img, rect, cv::Scalar(0, 255, 0))
16