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. Hi, thank you for sharing. I'm also using this tool to add text on picture. I recommend to use it for those who don't want to learn how to use other professional apps.


Post a Comment

Popular posts from this blog

OpenCV Stitching example (Stitcher class, Panorama)

(OpenCV Study) Background subtractor MOG, MOG2, GMG example source code (BackgroundSubtractorMOG, BackgroundSubtractorMOG2, BackgroundSubtractorGMG)

Example source code of extract HOG feature from images, save descriptor values to xml file, using opencv (using HOGDescriptor )

Real-time N camera stitching Class.

8 point algorithm (Matlab source code) / The method to get the Fundamental Matrix and the Essential matrix

Optical Flow sample source code using OpenCV

Video Stabilization example source code, (using cvFindHomography, cvWarpPerspective functions in openCV)

(OpenCV Study) calcOpticalFlowFarneback example source code ( dense optical flow )

yuv422(YUYV) to RGB and RGB to yuv422(YUYV), (Using OpenCV and TBB)

(C, C++) TinyXML , xml read & write