Seth
Published

Recording and USB Web Cameras with the BBAI and OpenCV

Did you ever want to record video from your USB Camera with the AI with OpenCV?

BeginnerProtip1 hour9,506
Recording and USB Web Cameras with the BBAI and OpenCV

Things used in this project

Hardware components

BeagleBone AI
BeagleBoard.org BeagleBone AI
×1
USB Camera
×1
BeagleBoard.org FanCape
×1

Software apps and online services

Python
OpenCV
OpenCV
Debian

Story

Read more

Schematics

BBAI

https://github.com/beagleboard/beaglebone-ai/wiki/System-Reference-Manual

Code

Camera Source in Python for your USB Camera!

Python
import cv2
import time

cap = cv2.VideoCapture(0)
fourcc = cv2.VideoWriter_fourcc(* 'XVID')
out = cv2.VideoWriter('output.avi', fourcc, 20.0, (350, 350))

while True:
    ret, frame = cap.read()
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    out.write(frame)
    cv2.imshow('gray', gray)
    if cv2.waitKey(10) == 27:
        break

cap.release()
out.release()
cv2.destroyAllWindows()

Credits

Seth

Seth

32 projects • 12 followers
Stay there and someone will find you...
Thanks to The book, "Mastering BeagleBone Robotics.", https://pythonprogramming.net/loading-images-python-opencv-tutorial/, and BeagleBoard.org.

Comments