def warp_image(img, tM, shape):
out = np.zeros(shape, dtype=img.dtype)
# cv2.warpAffine(img,
# tM[:2],
# (shape[1], shape[0]),
# dst=out,
# borderMode=cv2.BORDER_TRANSPARENT,
# flags=cv2.WARP_INVERSE_MAP)
cv2.warpPerspective(img, tM, (shape[1], shape[0]), dst=out,
borderMode=cv2.BORDER_TRANSPARENT,
flags=cv2.WARP_INVERSE_MAP)
return out
# TODO: Modify this method to get a better face contour mask
评论列表
文章目录