def findbodies(image, faces):
bodies = np.zeros_like(faces)
bodiesindex = 0
#for each face, draw a body
for (x, y, facewidth, faceheight) in faces:
#3*faceheight, 7/3 * facewidth, .5*faceheight below the face.
bodyheight = 3 * faceheight
bodywidth = 7/3 * facewidth
y_body = y + faceheight + .5 * faceheight
x_body = x + .5 * facewidth - .5 * bodywidth
bodies[bodiesindex] = (x_body,y_body, bodywidth, bodyheight)
bodiesindex = bodiesindex + 1
#cv2.rectangle(image, (x_body, y_body), (x_body+bodywidth, y_body+bodyheight), (0, 255, 0), 2)
return bodies
评论列表
文章目录