
1、ubuntu需要安装环境sudo apt install libfreetype6-dev libharfbuzz-dev2、opencv和opencv_contril编译勾选下面按钮3、下载字体库https://github.com/StellarCN/scp_zh/tree/master/fonts下载SimHei.ttf4、代码#include opencv2/freetype.hpp auto ft cv::freetype::createFreeType2(); ft-loadFontData(SimHei.ttf, 0); ft-putText(drawimg, text, text_pos, 22, // 字体大小 cv::Scalar(0, 0, 255), // 颜色 -1, cv::LINE_8, false);