OpenCV3绘制字体
原创
©著作权归作者所有:来自51CTO博客作者高万禄的原创作品,请联系作者获取转载授权,否则将追究法律责任
putText(img, “1234567890”, Point(200, 200), FONT_HERSHEY_SIMPLEX,1,Scalar(255, 0, 0));
#include<iostream>
#include<opencv2/opencv.hpp>
#include<opencv2/highgui.hpp>
using namespace std;
using namespace cv;
int main(int argc, char** argv) {
const char* file = "./00187_1.mp4";
VideoCapture capture;
capture.open(0);
while (1) {
Mat img;
capture >> img;//读入视频的帧
if (img.empty()) {
break;
}
//进行色彩空间转换
cvtColor(img, img, CV_BGR2GRAY);
//进行高斯滤波
GaussianBlur(img, img, Size(3, 3),0);
resize(img, img, Size(1000, 1000));
putText(img, "1234567890", Point(200, 200), FONT_HERSHEY_SIMPLEX,1,Scalar(255, 0, 0));
namedWindow("img",WINDOW_GUI_NORMAL);
imshow("img", img);
waitKey(100);
}
waitKey(0);
return 0;
}