matthewearl / faceswap

Python script to put facial features from one face onto another
MIT License
1.4k stars 496 forks source link

TypeError: points data type = 9 is not supported #15

Open SleepyGinger opened 6 years ago

SleepyGinger commented 6 years ago

Was wondering if anyone else got this error...

Here is the full traceback:

File "./faceswap.py", line 208, in mask = get_face_mask(im2, landmarks2) File "./faceswap.py", line 120, in get_face_mask color=1) File "./faceswap.py", line 111, in draw_convex_hull points = cv2.convexHull(points) TypeError: points data type = 9 is not supported

anne27 commented 6 years ago

Faced the same issue.

Try adding the following line points=points.astype(numpy.int32) to the draw_convex_hull function.

def draw_convex_hull(im, points, color):         points=points.astype(numpy.int32)         points = cv2.convexHull(points)         cv2.fillConvexPoly(im, points, color=color)

This is to make the data type compatible with the cv2 function.