博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

图片中添加文字

Posted on 2012-05-07 13:50  小新786  阅读(217)  评论(0编辑  收藏  举报
//图像和视频的输入/输出均在HighGUI 模块中 #include "stdafx.h" #include #include #include int main(int argc, char* argv[]) { IplImage *img = cvCreateImage( cvSize( 500, 500), 8, 3 ); cvZero( img ); cvNamedWindow( "hello", 1 ); CvFont font = cvFont( 3, 3 ); while (1){ cvPutText( img, "hello xiao luo !", cvPoint( 50, 50 ), &font, CV_RGB( 255, 0, 0 ) ); cvShowImage( "hello", img ); char c = cvWaitKey( ); if ( c == 27 ) break; } return 0; } //注释:(字体大小, 线粗) /* CvFont cvFont( double scale, int thickness CV_DEFAULT(1) ) { CvFont font; cvInitFont( &font, CV_FONT_HERSHEY_PLAIN, scale, scale, 0, thickness, CV_AA ); return font; } */