繁体   English   中英

如何获取dlib中dets的边界框坐标?

[英]How to get the coordinates of bounding box for dets in dlib?

我正在尝试获取 dets 的坐标,以便使用 dlib 库在检测到的面部上方写入名称。

import dlib

detector = dlib.get_frontal_face_detector()

dets = detector(img, 1)

你可以参考下面的源码

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)

使用 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM