Update app.py
Browse files
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 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 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 |
|