代码:
#include "opencv2/objdetect.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include <iostream>
using namespace std;
using namespace cv;
int main(int argc,char** argv)
{
char *inputName = argv[1];
cout << "name = " << inputName << endl;
Mat image = imread( inputName, 1 );
CvMat _img = image;
CvFont font;
cvInitFont(&font,CV_FONT_VECTOR0,1,1,0,1,8);
cvPutText(&_img,"I Love you",cvPoint(50,50),&font,CV_RGB(255,255,255));
imshow( inputName, image );
waitKey(0);
return 0;
}