FFmpeg Drawtext函数输出渲染字符的像素位置?

时间:2019-05-12 22:16:38

标签: c ffmpeg computer-vision pyffmpeg

我想创建一个接受Drawtext函数调用并输出每个渲染字符的像素框的python函数。

例如

ffmpeg.drawtext(stream, text='C Illiterate.', fontfile=fontfile, fontcolor='white', fontsize=24, x=0, y=0, escape_text=True)

-->

C[(x,y)(x,y)],  [(x,y)(x,y)], I[(x,y)(x,y)], l[(x,y)(x,y)], l[(x,y)(x,y)], i[(x,y)(x,y)], t[(x,y)(x,y)], e[(x,y)(x,y)], r[(x,y)(x,y)], a[(x,y)(x,y)], t[(x,y)(x,y)], e[(x,y)(x,y)], .[(x,y)(x,y)]

我相信函数输入是:

"max_glyph_a", "ascent",  ///< max glyph ascent
"max_glyph_d", "descent", ///< min glyph descent
"max_glyph_h",            ///< max glyph height
"max_glyph_w",            ///< max glyph width
...
"text_h", "th",           ///< height of the rendered text
"text_w", "tw",           ///< width  of the rendered text
"x",
"y",
...
int use_kerning;                ///< font kerning is used - true/false

由文件https://github.com/FFmpeg/FFmpeg/blob/1a31c2b5df1179fdc1b8e84c8fa89d853e517309/libavfilter/vf_drawtext.c指定

您能帮助我构造此功能/解密输入吗?这是用于机器视觉的应用程序。

0 个答案:

没有答案