[英]How to get the coordinates of bounding box for dets in dlib?
I am trying to get the coordinates of dets in order to write name above the detected face using dlib library.我正在尝试获取 dets 的坐标,以便使用 dlib 库在检测到的面部上方写入名称。
import dlib
detector = dlib.get_frontal_face_detector()
dets = detector(img, 1)
You can refer to the below source code你可以参考下面的源码
detector = dlib.get_frontal_face_detector()
dets = detector(img, 1)
for (i, det) in enumerate(dets):
#you can draw name based on faceRect
#to get top left point
top_left_point= det.tl_corner
print (top_left_point.x, top_left_point.y)
use imutils.face_utils rect_to_bb to declare the coordinates使用 imutils.face_utils rect_to_bb 来声明坐标
for det in dets:
(x, y, w, h) = rect_to_bb(det)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.