Opencv画图操作
1. 画矩形
MyRect rect;
rect.left = 5;
rect.top = 5;
rect.right = 100;
rect.bottom = 100;
IplImage * pColorImage = cvCreateImage(cvSize(width, height), 8, 3); cvRectangle(pColorImage, cvPoint(rect.left, rect.top), cvPoint(rect.right, rect.bottom), cvScalar(0, 255, 255), 1, 1, 0);
cv::Rect rect; rect.x = 5; rect.y = 5; rect.width = 100; rect.height = 100;
cv::Mat dst(rows, cols, CV_8UC1); cv::rectangle(dst, rect, cv::Scalar(0, 0, 255), 1, 1, 0); string text = "rectangel1"; cv::putText(dst, text, cv::Point(rect.x, rect.y), cv::FONT_HERSHEY_COMPLEX, 2, cv::Scalar(0, 255, 255), 2, 8, 0);
putText属性:
第一个参数是:需要写字的原图像,
第二个:需要写的内容,string类型的;
第三个:需要写的内容的左下角的坐标
第五个:字体大小
第六个:颜色
第七个:字体的厚度
第八个:默认8