openCV中cvRectangle与cv::rectangle绘制矩形边框
常见的变化参数:
thickness:
线的粗细,从1开始,增大线就变粗,3已经很粗了,会挡住物体,建议值:2,
-1代表填充
Rect格式:(x,y,w,h)。左上角 坐标x0,y0,w h代表框的宽高。
数据类型,int类型,不能是float、double类型
颜色:Scalar(0, 0, 0) 框的rgb颜色,可以自行修改
例子:
cv::rectangle(image_new, Rect(last_x, 16, x_new- last_x, 32), Scalar(0, 0, 0), -1, 1,0);
cvRentangle和cv::rectangle函数原型对比:
C: void cvRectangle(CvArr* img, CvPoint pt1, CvPoint pt2, CvScalar color, int thickness=1, int line_typ