rectangle,boundingRect和Rect

1 rectangle( rook_image,
2            Point( 0, 7*w/8.0 ),
3      Point( w, w),
4            Scalar( 0, 255, 255 ),
5            1,
6            8 );
  • 矩形将被画到图像 rook_image 上
  • 矩形两个对角顶点为 Point( 0, 7*w/8.0 ) 和 Point( w, w)
  • 矩形的颜色为 Scalar(0, 255, 255) ,既BGR格式下的 黄色
  • 线粗为 1, 如果为负此矩形将被填充为和边框一样的颜色
  • 8 line_type 线条的类型
1 Rect in = boundingRect(InputArray points);

返回值in是点集最小外矩形左定点坐标和矩形的长宽;

int a = in.height;//矩形的高

int b=in.width;//表示矩形的宽

原文地址:https://www.cnblogs.com/hsy1941/p/9003978.html