To enhance the last post in face swap, we can make use of the cloning features of the Photo module in OpenCV. The command we use is the seamlessClone() function.
Photo.seamlessClone(warp, im2, mask, centre, output, Photo.NORMAL_CLONE); |
where warp is the accumulation of all warped triangles; im2 is the original target image; mask is the masked image of the convex hull of the face contour; centre is a Point variable of the centre of the target image; output will be the blended final image.
Complete source code is now in the GitHub repository, ml20180820b.