Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created February 13, 2021 21:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/194608d6281a06a8b13778f3c4f9ee89 to your computer and use it in GitHub Desktop.
Save parzibyte/194608d6281a06a8b13778f3c4f9ee89 to your computer and use it in GitHub Desktop.
def obtener_frame_camara():
ok, frame = camara.read()
if not ok:
return False, None
agregar_fecha_hora_frame(frame)
# Escribir en el vídeo en caso de que se esté grabando
if grabando and archivo_video is not None:
archivo_video.write(frame)
# Codificar la imagen como JPG
_, bufer = cv2.imencode(".jpg", frame)
imagen = bufer.tobytes()
return True, imagen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment