OpenCV putText UTF-8 characters

ascii, opencv, utf-8

Solution

If OpenCV was built with Qt support you can use `cv::addText()` to write that string:

cv::Mat img = cv::imread("C:\\snowflake.jpg");
if (img.empty())
{
    std::cout << "!!! Failed imread()" << std::endl;
    return;
}

cv::addText(img, "áéőúöüóí", cv::Point(100, 50), cv::fontQt("Times"));

However, if OpenCV was built without Qt support, calling `cv::addText()` will crash your application and the following error will be printed to the console:

OpenCV Error: The function/feature is not implemented (The library is compiled without QT support) in cv::fontQt, file C:\builds\2_4_PackSlave-win32-vc12-shared\opencv\modules\highgui\src\window.cpp, line 409

Problem

Does anybody have alternative to `OpenCV` putText (with UTF-8 characters supported) ? As already said, `putText` is only working for ASCII characters, but not for `UTF-8` such as `šŠčČžŽ`?

Original source

Related problems