Opencv画圆和矩形
//opencv打开摄像头
VideoCapture capture;
capture.open(0);
Mat frame;
//读取当前帧
capture >> frame;
//获取帧宽高
height = frame.rows;
width = frame.cols;
//矩形绘制
nameWindow("add_rect", 0);
//图片中心,50像素范围内绘制矩形
Rect rect(width/2 - 50, height/2 - 50, 100, 100);
rectangle(edge, rect, Scalar(255, 0, 0), 3, LINE_8, 0);
imshow("add_rect",edge);
//圆形绘制
nameWindow("add_circle", 0);
//图片中心90像素范围内绘制圆
circle(frame, Point(width/2, height/2), 90, Scalar(48, 177, 61), 2, LINE_AA, 0);
imshow("add_circle", frame);