图片中添加文字

//图像和视频的输入/输出均在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; } */
原文地址:https://www.cnblogs.com/rosekin/p/2487286.html