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
If you are using OpenCV 3.x or 4.0, you have to replace CV_AA by LINE_AA. So, the complete call would be:
cv::putText(yourImageMat,
"Text to add",
cv::Point(5,5), // Coordinates
cv::FONT_HERSHEY_COMPLEX_SMALL, // Font
1.0, // Scale. 2.0 = 2x bigger
cv::Scalar(255,255,255), // BGR Color
1, // Line Thickness (Optional)
cv::LINE_AA); // Anti-alias (Optional)
This was posted in this forum.