본문 바로가기

Opencv

how to put text message on images using opencv library on C

반응형

** C/C++에서 opencv로 영상에 text 글자 삽입하기 **


CvFont font;
char buffer[64];

// cvInitFont(CvFont*, int fontFace, double Hscale, double Vscale, double Shear, int thickness, int lineType);
cvInitFont(&font, CV_FONT_HERSHEY_SIMPLEX, 0.5, 0.5, 0, 1.5, CV_AA);

// display just character
cvPutText(screenRGB, "Target Speed:", cvPoint(10, 80), &font, cvScalar(0, 0, 255, 0));

// display the value of the float variable
int ret = snprintf(buffer, sizeof buffer, "%f", variable);
cvPutText(screenRGB, buffer, cvPoint(130, 80), &font, cvScalar(255, 0, 0, 0));