核心函数:cvInitFont,cvPutText
程序:
代码:
#include "cv.h" #include "cxcore.h" #include "highgui.h" #include <iostream> 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; }
PutText 在图像上显示文字,布布扣,bubuko.com
时间: 2024-12-11 03:01:39