OpenCV:如何使用其他字体而不是HERSHEY与cvPutText(如Arial) [英] OpenCV: How to use other font than HERSHEY with cvPutText (like Arial)

查看:592
本文介绍了OpenCV:如何使用其他字体而不是HERSHEY与cvPutText(如Arial)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想写一张图片格式化的文字。 OpenCV仅提供一组有限的默认字体。是否可以使用其他人?例如从* .ttf文件中读取它们(在Ubuntu中)?

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 (in Ubuntu)?

推荐答案

可以使用其他字体但是你需要将Qt库链接到OpenCV并将cvAddText函数与cvFontQt一起使用

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

您可以尝试其他解决方案,其性能与OpenCV大致相同。例如,您可以使用CAIRO将字体写入图像。

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.

这篇关于OpenCV:如何使用其他字体而不是HERSHEY与cvPutText(如Arial)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆