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))
评论列表
文章目录