Spaces:
Runtime error
Runtime error
Update src/detection/strategies/geometric.py
Browse files
src/detection/strategies/geometric.py
CHANGED
@@ -26,6 +26,10 @@ class GeometricProcessor(BaseProcessor):
|
|
26 |
self.MOUTH = [61, 291, 39, 181, 0, 17, 84, 178]
|
27 |
|
28 |
def process_frame(self, frame):
|
|
|
|
|
|
|
|
|
29 |
h, w, _ = frame.shape
|
30 |
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
|
31 |
brightness = np.mean(gray)
|
@@ -46,8 +50,7 @@ class GeometricProcessor(BaseProcessor):
|
|
46 |
score = 0
|
47 |
weights = self.settings['indicator_weights']
|
48 |
|
49 |
-
# --- Draw Facial Landmarks
|
50 |
-
# This will draw the green dots for eyes and mouth.
|
51 |
eye_mouth_landmarks = self.L_EYE + self.R_EYE + self.MOUTH
|
52 |
for idx in eye_mouth_landmarks:
|
53 |
lm = landmarks[idx]
|
|
|
26 |
self.MOUTH = [61, 291, 39, 181, 0, 17, 84, 178]
|
27 |
|
28 |
def process_frame(self, frame):
|
29 |
+
# --- CRITICAL FIX ---
|
30 |
+
# Create a writable copy of the frame to prevent read-only errors.
|
31 |
+
frame = frame.copy()
|
32 |
+
|
33 |
h, w, _ = frame.shape
|
34 |
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
|
35 |
brightness = np.mean(gray)
|
|
|
50 |
score = 0
|
51 |
weights = self.settings['indicator_weights']
|
52 |
|
53 |
+
# --- Draw Facial Landmarks ---
|
|
|
54 |
eye_mouth_landmarks = self.L_EYE + self.R_EYE + self.MOUTH
|
55 |
for idx in eye_mouth_landmarks:
|
56 |
lm = landmarks[idx]
|