Added Lanczos to warpAffine
This commit is contained in:
@@ -172,13 +172,15 @@ class WarpFaceBack:
|
||||
crop, mask, warp = list(zip(*[x[1:] for x in values]))
|
||||
warped_masks = [cv2.warpAffine(single_mask.numpy(),
|
||||
cv2.invertAffineTransform(single_warp),
|
||||
image.shape[1::-1])
|
||||
image.shape[1::-1],
|
||||
flags=cv2.INTER_LANCZOS4)
|
||||
for single_warp, single_mask in zip(warp, mask)]
|
||||
full_mask = np.add.reduce(warped_masks, axis=0)[...,None]
|
||||
swapped = np.add.reduce([
|
||||
cv2.warpAffine(single_crop.cpu().numpy(),
|
||||
cv2.invertAffineTransform(single_warp),
|
||||
image.shape[1::-1]
|
||||
image.shape[1::-1],
|
||||
flags=cv2.INTER_LANCZOS4
|
||||
) * single_mask[..., None]
|
||||
for single_crop, single_mask, single_warp in zip(crop, warped_masks, warp)
|
||||
], axis=0) / np.maximum(1, full_mask)
|
||||
|
||||
Reference in New Issue
Block a user