OpenCV: How to use other font than HERSHEY with cvPutText (like Arial)

后端 未结 2 751
别跟我提以往
别跟我提以往 2020-12-14 20:37

I want to write to an image a formatted text. OpenCV offers only a limited set of default fonts. Is it possible to use others? For example to read them from the *.ttf file (

2条回答
  •  再見小時候
    2020-12-14 20:58

    It's possible to use other fonts but you need to link the Qt library to OpenCV and use the cvAddText function with a cvFontQt

    http://docs.opencv.org/modules/highgui/doc/qt_new_functions.html#addtext

    http://docs.opencv.org/modules/highgui/doc/qt_new_functions.html#fontqt

    There are other solutions you might try, with more or less the same performance as OpenCV. For instance, you can use CAIRO to write fonts into the image.

提交回复
热议问题