在dlib图片中写入文字 [英] Write a text in dlib image
问题描述
我正在使用dlib进行人脸检测,我想在图像中写文字。
我已经尝试过这个 win.add_overlay(dets,rgb_pixel(255,0,0), test);
但它不起作用
i'm using dlib for face detection and i would like to write a text in the image.
i've tried this win.add_overlay(dets, rgb_pixel(255,0,0),"test" );
but it's not working
您能帮我吗?
推荐答案
根据< a href = http://dlib.net/dlib/gui_widgets/widgets_abstract.h.html#image_window rel = noreferrer> dlib文档, add_overlay
方法将叠加层作为参数。由于要显示矩形,因此必须创建 overlay_rect
。您应该尝试以下代码:
According to the dlib documentation, the add_overlay
method takes an overlay as a parameter. Since you want to display rectangles you have to create an overlay_rect
. You should try the following code :
win.add_overlay(dlib :: image_window :: overlay_rect(dets,rgb_pixel(255,0,0) , test));
dlib文档确实做得很好(戴维斯·金的道具),您应该花点时间阅读和理解
dlib documentation is really well done (props to Davis King) you should take some time to read and understand it.
这篇关于在dlib图片中写入文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!