Created
March 20, 2018 23:19
-
-
Save parzibyte/eb2c67dd2847e5de4ce12d56e4c7d3c2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Tomar foto con Python y opencv | |
@date 20-03-2018 | |
@author parzibyte | |
@see https://www.parzibyte.me/blog | |
""" | |
import cv2 | |
""" | |
En este caso, 0 quiere decir que queremos acceder | |
a la cámara 0. Si hay más cámaras, puedes ir probando | |
con 1, 2, 3... | |
""" | |
cap = cv2.VideoCapture(0) | |
leido, frame = cap.read() | |
if leido == True: | |
cv2.imwrite("foto.png", frame) | |
print("Foto tomada correctamente") | |
else: | |
print("Error al acceder a la cámara") | |
""" | |
Finalmente liberamos o soltamos la cámara | |
""" | |
cap.release() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment