added app3.py and coba.py
This commit is contained in:
19
coba.py
Executable file
19
coba.py
Executable file
@ -0,0 +1,19 @@
|
||||
import cv2
|
||||
|
||||
# Initialize the webcam
|
||||
video_capture = cv2.VideoCapture(-1)
|
||||
|
||||
while True:
|
||||
# Capture a single frame from the webcam
|
||||
ret, frame = video_capture.read()
|
||||
|
||||
# Display the resulting image
|
||||
cv2.imshow('Video', frame)
|
||||
|
||||
# Exit the loop if the 'q' key is pressed
|
||||
if cv2.waitKey(1) & 0xFF == ord('q'):
|
||||
break
|
||||
|
||||
# Release the webcam and close all windows
|
||||
video_capture.release()
|
||||
cv2.destroyAllWindows()
|
||||
Reference in New Issue
Block a user