facefinder.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:gulper 作者: QuantifiedSelfless 项目源码 文件源码
def find_faces_url(url, hash_face=False, upsample=1):
    """
    Given a URL to an image, find all the faces.  The returned list has
    dictionaries with the following fields:
        rect -> bounding rectangle around the face
        score -> score of the face detection (higher == better)
        pose -> index of sub-detector matched which roughly corresponds to pos
                (0 is best)
    """
    try:
        image_req = yield httpclient.fetch(url, request_timeout=30.0)
    except HTTPError as e:
        print("Exception while fetching image URL: {}: {}".format(url, e))
        return []
    if image_req.code != 200:
        return []
    image_fd = BytesIO(image_req.body)
    return (yield find_faces_buffer(image_fd, hash_face=hash_face,
                                    upsample=upsample))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号