Spaces:
Paused
Paused
Fix bug in the code
Browse files
third_part/GPEN/align_faces.py
CHANGED
@@ -248,13 +248,13 @@ def warp_and_crop_face(src_img,
|
|
248 |
raise FaceWarpException(
|
249 |
'facial_pts and reference_pts must have the same shape')
|
250 |
|
251 |
-
if align_type
|
252 |
tfm = cv2.getAffineTransform(src_pts[0:3], ref_pts[0:3])
|
253 |
tfm_inv = cv2.getAffineTransform(ref_pts[0:3], src_pts[0:3])
|
254 |
-
elif align_type
|
255 |
tfm, _ = cv2.estimateAffinePartial2D(src_pts[0:3], ref_pts[0:3])
|
256 |
tfm_inv, _ = cv2.estimateAffinePartial2D(ref_pts[0:3], src_pts[0:3])
|
257 |
-
elif align_type
|
258 |
tfm = get_affine_transform_matrix(src_pts, ref_pts)
|
259 |
tfm_inv = get_affine_transform_matrix(ref_pts, src_pts)
|
260 |
else:
|
|
|
248 |
raise FaceWarpException(
|
249 |
'facial_pts and reference_pts must have the same shape')
|
250 |
|
251 |
+
if align_type == 'cv2_affine':
|
252 |
tfm = cv2.getAffineTransform(src_pts[0:3], ref_pts[0:3])
|
253 |
tfm_inv = cv2.getAffineTransform(ref_pts[0:3], src_pts[0:3])
|
254 |
+
elif align_type == 'cv2_rigid':
|
255 |
tfm, _ = cv2.estimateAffinePartial2D(src_pts[0:3], ref_pts[0:3])
|
256 |
tfm_inv, _ = cv2.estimateAffinePartial2D(ref_pts[0:3], src_pts[0:3])
|
257 |
+
elif align_type == 'affine':
|
258 |
tfm = get_affine_transform_matrix(src_pts, ref_pts)
|
259 |
tfm_inv = get_affine_transform_matrix(ref_pts, src_pts)
|
260 |
else:
|