NeuralFalcon commited on
Commit
3462216
·
verified ·
1 Parent(s): 33d53a7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -12
app.py CHANGED
@@ -66,21 +66,20 @@ def face_point(results, frame):
66
  for id, lm in enumerate(face_landmarks):
67
  x, y = int(lm.x * iw), int(lm.y * ih)
68
  face.append([id, x, y])
69
- ## FIX: Indentation was wrong. It should be inside the loop to capture all faces.
70
  faces.append(face)
71
  return faces
72
 
73
- def letterbox(image, target_width, target_height):
74
- """Resize image keeping aspect ratio, pad with black to fit target size."""
75
- ih, iw = image.shape[:2]
76
- scale = min(target_width / iw, target_height / ih)
77
- nw, nh = int(iw * scale), int(ih * scale)
78
- resized = cv2.resize(image, (nw, nh), interpolation=cv2.INTER_AREA)
79
- canvas = np.zeros((target_height, target_width, 3), dtype=np.uint8)
80
- x_offset = (target_width - nw) // 2
81
- y_offset = (target_height - nh) // 2
82
- canvas[y_offset:y_offset+nh, x_offset:x_offset+nw] = resized
83
- return canvas
84
 
85
 
86
 
 
66
  for id, lm in enumerate(face_landmarks):
67
  x, y = int(lm.x * iw), int(lm.y * ih)
68
  face.append([id, x, y])
 
69
  faces.append(face)
70
  return faces
71
 
72
+ # def letterbox(image, target_width, target_height):
73
+ # """Resize image keeping aspect ratio, pad with black to fit target size."""
74
+ # ih, iw = image.shape[:2]
75
+ # scale = min(target_width / iw, target_height / ih)
76
+ # nw, nh = int(iw * scale), int(ih * scale)
77
+ # resized = cv2.resize(image, (nw, nh), interpolation=cv2.INTER_AREA)
78
+ # canvas = np.zeros((target_height, target_width, 3), dtype=np.uint8)
79
+ # x_offset = (target_width - nw) // 2
80
+ # y_offset = (target_height - nh) // 2
81
+ # canvas[y_offset:y_offset+nh, x_offset:x_offset+nw] = resized
82
+ # return canvas
83
 
84
 
85