opencv 如何在图像输入字幕
来源:互联网 发布:软件项目开发进度计划 编辑:程序博客网 时间:2024/05/20 01:10
昨晚在床上看 opencv 看到了如何在图像输入字幕,其实前段时间我已经学过了,只是没认真琢磨,昨晚看了,尽早赶紧写了一下。哼~~~不错!
代码如下:
IplImage *img=cvCreateImage(cvSize(640,480),8,1);CvFont font;double hScale=1.0;double vScale=1.0;int lineWidth=1;cvInitFont(&font, CV_FONT_HERSHEY_SIMPLEX | CV_FONT_ITALIC, hScale, vScale, 0, lineWidth );cvPutText(img, "hellow world",cvPoint(100,100),&font, cvScalar(255,0,0) );cvShowImage("qq", img);cvWaitKey(0);return 0;
效果图:
参数:
cvInitFont(CvFont*font, intfontFace, double hscale, doublevscale, doubleshear=0, int thickness=1, intlineType=8)¶
- font – Pointer to the font structure initialized by the function
- fontFace –
Font name identifier. Only a subset of Hershey fonts http://sources.isc.org/utils/misc/hershey-font.txt are supported now:
- CV_FONT_HERSHEY_SIMPLEX normal size sans-serif font
- CV_FONT_HERSHEY_PLAIN small size sans-serif font
- CV_FONT_HERSHEY_DUPLEX normal size sans-serif font (more complex than CV_FONT_HERSHEY_SIMPLEX )
- CV_FONT_HERSHEY_COMPLEX normal size serif font
- CV_FONT_HERSHEY_TRIPLEX normal size serif font (more complex than CV_FONT_HERSHEY_COMPLEX )
- CV_FONT_HERSHEY_COMPLEX_SMALL smaller version of CV_FONT_HERSHEY_COMPLEX
- CV_FONT_HERSHEY_SCRIPT_SIMPLEX hand-writing style font
- CV_FONT_HERSHEY_SCRIPT_COMPLEX more complex variant of CV_FONT_HERSHEY_SCRIPT_SIMPLEX
The parameter can be composited from one of the values above and an optional CV_FONT_ITALIC flag, which indicates italic or oblique font.
- hscale – Horizontal scale. If equal to 1.0f , the characters have the original width depending on the font type. If equal to 0.5f , the characters are of half the original width.
- vscale – Vertical scale. If equal to 1.0f , the characters have the original height depending on the font type. If equal to0.5f , the characters are of half the original height.
- shear – Approximate tangent of the character slope relative to the vertical line. A zero value means a non-italic font, 1.0f means about a 45 degree slope, etc.
- thickness – Thickness of the text strokes
- lineType – Type of the strokes, see line() description
cvPutText(CvArr*img, const char*text, CvPoint org, const CvFont*font, CvScalarcolor)¶
- img – Image.
- text – Text string to be drawn.
- org – Bottom-left corner of the text string in the image.
- font – CvFont structure initialized usingInitFont().
- fontFace – Font type. One of FONT_HERSHEY_SIMPLEX, FONT_HERSHEY_PLAIN,FONT_HERSHEY_DUPLEX, FONT_HERSHEY_COMPLEX, FONT_HERSHEY_TRIPLEX, FONT_HERSHEY_COMPLEX_SMALL, FONT_HERSHEY_SCRIPT_SIMPLEX, or FONT_HERSHEY_SCRIPT_COMPLEX, where each of the font ID’s can be combined with FONT_HERSHEY_ITALIC to get the slanted letters.
- fontScale – Font scale factor that is multiplied by the font-specific base size.
- color – Text color.
- thickness – Thickness of the lines used to draw a text.
- lineType – Line type. See the line for details.
- bottomLeftOrigin – When true, the image data origin is at the bottom-left corner. Otherwise, it is at the top-left corner.
好了,到此啦。详见opencv manual~~~
- opencv 如何在图像输入字幕
- opencv如何求输入图像的子图像(三种方案)
- opencv求输入图像的子图像
- opencv求输入图像的子图像
- 如何在图片上作滚动字幕
- OpenCV读入的图像如何显示在窗体上
- 在MFC中如何显示OpenCV的图像Mat
- 如何在MFCview视图下显示opencv Mat矩阵图像
- 如何在c++ / opencv 中调用matlab 的图像数据
- 如何在Photoshop CS中输入数码相机的图像?
- opencv学习笔记 在输入图像上寻找并绘制轮廓
- opencv如何截取子图像
- opencv在图像上作画
- 在opencv中输入文字
- 如何将利用OpenCV加载的图像显示在窗口位置?
- OpenCV+MFC快速应用:如何在MFC中显示Mat图像
- 在opencv中,如何将二维数组转化为一副图像进行显示?
- 如何搜索字幕
- 转一篇比较详细的vc编译qt的文
- 转:安卓自动化测试工具MonkeyRunner之使用ID
- xcode4发布测试-打包(Archive)
- QSD8x50開機流程
- Qt 配置 Winpcap 指南
- opencv 如何在图像输入字幕
- hibernate批量更新与批量删除
- uC/OS-II任务调度中判断最高优先级
- Dojo 最佳实践 - 如何防止浏览器内存泄漏
- 详细解释:nginx中ChsHttpUpstreamModule模块配置及各个参数含义
- 查找系统端口占用及占用程序
- 跳表SkipList 简介
- H-因子
- jQuery之浏览器检测