opencv displaying variable on video

≯℡__Kan透↙ 提交于 2019-12-23 01:41:20

问题


is it possible to overlay %d on the screen using opencv?

CvPutText()

was tried but that cant be done


回答1:


Let's pretend I didn't explained to you in a comment before.

int number  = 5;
char text[255]; 
sprintf(text, "Score %d", (int)number);

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, text, cvPoint(200,400), &font, cvScalar(255,255,0));



回答2:


cvPutText() draws on an image, but it doesn't do formatting - you need to format the string to be printed using sprintf or similar



来源:https://stackoverflow.com/questions/9503421/opencv-displaying-variable-on-video

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!