VanNguyen1214 commited on
Commit
560cc57
·
verified ·
1 Parent(s): 40c4845

Upload 4 files

Browse files
Files changed (1) hide show
  1. overlay.py +3 -3
overlay.py CHANGED
@@ -3,7 +3,7 @@ from PIL import Image
3
  import mediapipe as mp
4
  import os
5
 
6
- from segmentation import extract_hair_face_full_forehead, extract_hair
7
 
8
  # MediaPipe Face Detection
9
  mp_fd = mp.solutions.face_detection.FaceDetection(model_selection=1,
@@ -182,7 +182,7 @@ def overlay_source(background: Image.Image, source: Image.Image):
182
  )
183
 
184
  # Step 2: Get face from background (with forehead) and overlay onto scaled source
185
- bg_face = extract_hair_face_full_forehead(background) # Extract face with forehead
186
 
187
  # Compute offset to align background face onto scaled source face
188
  offset = compute_offset_to_align_faces(bbox_src_scaled, bbox_bg, 1.0)
@@ -197,7 +197,7 @@ def overlay_source(background: Image.Image, source: Image.Image):
197
  print("✅ Overlaid background face onto scaled source")
198
 
199
  # Step 3: Extract hair+face+forehead from the result
200
- hair_face_result = extract_hair_face_full_forehead(source_with_bg_face)
201
 
202
  # Overlay this onto original background with smoothing -> temp variable
203
  bbox_result = get_face_bbox(source_with_bg_face)
 
3
  import mediapipe as mp
4
  import os
5
 
6
+ from segmentation import get_face, extract_hair
7
 
8
  # MediaPipe Face Detection
9
  mp_fd = mp.solutions.face_detection.FaceDetection(model_selection=1,
 
182
  )
183
 
184
  # Step 2: Get face from background (with forehead) and overlay onto scaled source
185
+ bg_face = get_face(background) # Extract face with forehead
186
 
187
  # Compute offset to align background face onto scaled source face
188
  offset = compute_offset_to_align_faces(bbox_src_scaled, bbox_bg, 1.0)
 
197
  print("✅ Overlaid background face onto scaled source")
198
 
199
  # Step 3: Extract hair+face+forehead from the result
200
+ hair_face_result = get_face(source_with_bg_face)
201
 
202
  # Overlay this onto original background with smoothing -> temp variable
203
  bbox_result = get_face_bbox(source_with_bg_face)