如何将文本放在OpenCV C 中的图像中
How to put a text in an image in opencv c++
我当前正在处理我的作业,并在其中加载图像并在其中显示相同的图像。问题是我不知道如何使用putText函数。
这是我现在拥有的代码:
cvInitFont(CV_FONT_HERSHEY_SIMPLEX, 1.0, 1.0, 0.0, 1, 8);
cvPutText(img, "You are drinking a lot of water. You may want to cut back.", cvPoint(20, 20), CV_FONT_HERSHEY_SIMPLEX, cvScalar(255, 0, 0));
请帮助我。预先感谢。
尝试这样的东西:
cv::Mat img(512, 512, CV_8UC3, cv::Scalar(0));
cv::putText(img, //target image
"Hello, OpenCV!", //text
cv::Point(10, img.rows / 2), //top-left position
cv::FONT_HERSHEY_DUPLEX,
1.0,
CV_RGB(118, 185, 0), //font color
2);
cv::imshow("Hello!", img);
cv::waitKey();
在512 * 512黑色图像上,代码写下"你好,opencv!"
此代码与OpenCV 2.x和3.x。
相关文章:
- C++,OpenCV,尝试显示图像时"OpenCV(4.3.0) Error: Assertion failed (size.width>0 && size.height>0)"此错误
- 如何使用OpenCV将RBG图像转换为HSV,并将H、S和V值保存为C++中的3个独立图像
- OpenCV EqualizeHist()从彩色图像创建黑白图像
- 如何使用 OpenCV 解码在两个 UWP 应用之间发送的图像字节?
- 如果不在窗口 10 中声明名为 openCV 的 openCV namedWindow,QT 图像显示将无法正常工作
- 在本地网络中通过OpenCV(C++)实时流式传输图像
- 如何在 OpenCV 中将图像与另一个图像相关联
- 如何在 OpenCV c++ 中压缩 TIFF 格式的图像?
- OpenCV - 如何在灰度图像上应用 Kmeans?
- 阅读和处理图像(OpenCV/C )
- cv::findContours 正在修改源图像 OpenCV 2.3
- 将图像替换为更大尺寸的图像 (OpenCV)
- 显示像素值已更改的图像openCV
- 具有积分图像的快速模糊图像(OpenCV)
- 扫描图像OpenCV上的文档检测
- 使用cv::Mat图像(opencv)如何检测对象
- 写作和展示图像OpenCV
- 从文件夹中读取图像(OpenCV)
- 无法保存从网络摄像头捕获的图像(OpenCV 2.3 的 imwrite 编译错误)
- 旋转不变的多个模板出现在图像Opencv