核心函数:cvInitFont,cvPutText

程序:

wKiom1PsX_HwWVxhAAC5mZdqiPU182.jpg

代码:

#include "cv.h"
#include "cxcore.h"
#include "highgui.h"
#include 
int PutText(int argc,char** argv)
{
IplImage* src=cvLoadImage("e:\\picture\\11.jpg");
cvNamedWindow("src");
cvShowImage("src",src);
CvFont font;
cvInitFont(&font,CV_FONT_HERSHEY_COMPLEX,1.0,1.0,0,2,8);  //初始化字体
cvPutText(src,"hello",cvPoint(250,250),&font,cvScalar(0,0,255,NULL));  //显示文字
cvNamedWindow("dst");
cvShowImage("dst",src);
cvWaitKey(0);
cvDestroyWindow("src");
cvDestroyWindow("dst");
cvReleaseImage(&src);
return 0;
}