masks-and-hats
masks-and-hats copied to clipboard
how can add mask become more realtime?
Thx for sharing this interesting demo. I find that with the increasing number of faces, the step of adding a transparent mask (png) to the original photo consuming much more time, about 0.2s per mask. I think firstly merge these masks to one transparent backgound picture and then add to the original photo will save some time.
for c in range(0,3): out[0:out.shape[0],0:out.shape[1],c] = aligned_mask[:,:,c] * (aligned_mask[:,:,3]/255.0) + out[0:out.shape[0], 0:out.shape[1], c] * (1.0 - aligned_mask[:,:,3]/255.0)
I do not really understand what is the code doing, How can I save some time with multiple faces?