昨晚在床上看 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, int fontFace, double hscale, doublevscale, double shear=0, int thickness=1, intlineType=8 )