添加文字
bool opencvTool::addText(cv::Mat& image, const std::string text, const cv::Point& position, double fontScale, cv::Scalar color, int thickness, int fontFace)
{
cv::putText(image, text, position, fontFace, fontScale, color, thickness);
return true;
}
添加水印
bool opencvTool::addWatermark(cv::Mat& image, const std::string text, const cv::Point& position, double fontScale, cv::Scalar color, int thickness, int fontFace)
{
cv::Mat watermark = cv::Mat::zeros(image.size(), image.type());
cv::putText(watermark, text, position, fontFace, fontScale, color, thickness);
cv::addWeighted(image, 1.0, watermark, 0.5, 0.0, image);
return true;
}