函数putText()在图片上写文字

 1 #include <iostream>
 2 #include <opencv2/opencv.hpp>
 3 using namespace std;
 4 using namespace cv;
 5 int main()
 6 {
 7     Mat img = imread("e.bmp");
 8     imshow("原图", img);
 9     char tem[50];
10     sprintf(tem, "%s","Where are you?");
11     //img原图像,tem输出内容,Point输出位置,0.9文字大小Scalar()颜色,1字体粗细,
12     putText(img, tem, Point(40, 250), FONT_HERSHEY_SIMPLEX, 0.9, Scalar(255, 255, 200),1,3);//在图片上写文字
13     namedWindow("效果图");
14     imshow("效果图", img);
15     waitKey();
16     return 0;
17 }

   

猜你喜欢

转载自www.cnblogs.com/hsy1941/p/9082286.html