I am using opencv 2.1. In my code I have a few images stored as Mat objects initialized like this:
Mat img1 = imread(\"img/stuff.pgm\", CV_LOAD_IMAGE_GRAYSCA
putText(img1, "TextString123", cvPoint(50,200), FONT_HERSHEY_SCRIPT_SIMPLEX, 2.5, cvScalar(255,0,0,255), 3, CV_AA);
You can find more information here: http://docs.opencv.org/2.4.9/modules/core/doc/drawing_functions.html
The main diference between this answer and the answers from above is the value of the 7-th parameter, the thickness level. With thickness==1 this function have not worked for me.