OpenCV Study, Write text on the image, cvPutText, putText

cvPutText, IplImage case.
CvFont * font = new CvFont;
cvInitFont(font, CV_FONT_VECTOR0, 0.5f, 1.0f, 0, 1, 8); //rate of width and height is 1:2

char szText[8];
sprintf(szText, "TextOut");  //make string

cvPutText(Image, szText, CenterPoint, font, CV_RGB(255, 255, 255)); //draw text on the IplImage* (Image)

putText, Mat case.
char TestStr[100]; 
sprintf(TestStr,"total time : %lf sec", 0.001 );
putText(OutImg, TestStr, Point(100,250), CV_FONT_NORMAL, 1, Scalar(255,255,255),1,1); //OutImg is Mat class;


1 comment:

  1. Hi, thank you for sharing. I'm also using this tool http://ipiccy.com/feature/add-text-to-pictures to add text on picture. I recommend to use it for those who don't want to learn how to use other professional apps.