Skip to content
rseetham edited this page Feb 9, 2016 · 5 revisions

WebCam is a library for PyBBIO to stream video and take snapshots from a webcam connected to the beaglebone black.
It should work for any webcam that is compatible with the v4l2 driver.
It has been tested to work with the following cameras :
Logitech C270
Logitech C920
Logitech C930
Example for using this library can be found here
Example for using this library to embed the video in BBIOServer can be found here

EDIT : GStreamer has to be downloaded for this to work
apt-get install python-gst0.10
apt-get install gstreamer0.10-plugins


API

WebCam((optional)video_device_num)

Initialises the WebCam object.
video_device_num corresponds to the /dev/video number (eg. /dev/video1). It defaults to 0.
This switches on your camera until stopPipeline() is called.

WebCam.takeSnapshot(filename)

takes a snap shot and stores it in filename.jpeg

WebCam.startStreaming((optional)port)

starts streaming video from the webcam to http://your_bbb's_ip_address:port
port defaults to 5000
NOTE : Once port no. is set trying to change it will show an error.

WebCam.stopStreaming()

stops the streaming

WebCam.stopPipeline()

Switches off your camera.
Same instance can't be used to switch the camera back on after calling this function.

Using library with BBIOServer

Use the Page.add_video() function to embed the video stream using HTML in the BBIOServer example can be found here
Documentation for BBIOServer can be found here

Clone this wiki locally