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

后端 未结 7 1032
广开言路
广开言路 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条回答
  •  無奈伤痛
    2020-12-29 22:21

    putText(result, "Differencing the two images.", cvPoint(30,30), 
        FONT_HERSHEY_COMPLEX_SMALL, 0.8, cvScalar(200,200,250), 1, CV_AA);
    

    In the above line "result" should be a cvArr* or an IplImage*. but from the code provided here, I guess you are passing a cv::Mat object. So, you either need to convert it using cvarrToMat() or pass &result instead of result.

    Hope it helps

提交回复
热议问题