Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -31,5 +31,19 @@ def apply_effects(frame):
|
|
| 31 |
|
| 32 |
return frame
|
| 33 |
|
| 34 |
-
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
return frame
|
| 33 |
|
| 34 |
+
cap = cv2.VideoCapture(0) # Open the webcam
|
| 35 |
+
|
| 36 |
+
while True:
|
| 37 |
+
ret, frame = cap.read() # Read a frame from the webcam
|
| 38 |
+
if not ret:
|
| 39 |
+
break
|
| 40 |
+
|
| 41 |
+
processed_frame = apply_effects(frame) # Apply effects to the frame
|
| 42 |
+
|
| 43 |
+
cv2.imshow("Webcam with Effects", processed_frame) # Display the processed frame
|
| 44 |
+
|
| 45 |
+
if cv2.waitKey(1) & 0xFF == ord('q'): # Press 'q' to exit
|
| 46 |
+
break
|
| 47 |
+
|
| 48 |
+
cap.release() # Release the webcam
|
| 49 |
+
cv2.destroyAllWindows() # Close all windows
|