How to overlay text on image when working with cv::Mat type

后端 未结 7 1036
广开言路
广开言路 2020-12-29 21:57

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         


        
7条回答
  •  梦毁少年i
    2020-12-29 22:23

    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.

提交回复
热议问题