camera: transformer un laptop en camera de surveillance pour appartement

This commit is contained in:
2025-08-29 09:09:39 +02:00
commit f3fc2590a7
5 changed files with 65 additions and 0 deletions

24
camera2.py Normal file
View File

@@ -0,0 +1,24 @@
# program to capture single image from webcam in python
# importing OpenCV library
import cv2
# initialize the camera
# If you have multiple camera connected with
# current device, assign a value in cam_port
# variable according to that
cam_port = 0
cam = cv2.VideoCapture(cam_port)
# reading the input using the camera
result, image = cam.read()
# If image will detected without any error,
# show result
if result:
# saving image in local storage
cv2.imwrite("GeeksForGeeks.png", image)
# If captured image is corrupted, moving to else part
else:
print("No image detected. Please! try again")