Javadoc link

The video streamer service can stream a video source in MJPEG format.  In order to stream the video, it needs to be attached to a video source.  By default it will stream to port 9090.  Most "real" browsers have the ability to display the video feed.

If you have a webcam, you can start an OpenCV service which will be the video source.  Start the video streamer and attach it to the OpenCV service.  Start a browser and go to http://localhost:9090/output , you should be able to see the video from the camera.

[[VideoStreamer.py]]

Example code (from branch develop):
from org.myrobotlab.service import Runtime
from org.myrobotlab.service import OpenCV
from org.myrobotlab.service import VideoStreamer
from time import sleep
from org.myrobotlab.net import BareBonesBrowserLaunch
 
# create a video source (opencv) & a video streamer
opencv = runtime.start("opencv","OpenCV")
streamer = runtime.start("streamer","VideoStreamer")
 
# attache them
streamer.attach(opencv)
 
# add a pyramid down filter and gray to minimize the data
opencv.addFilter("pyramidDown", "PyramidDown");
opencv.addFilter("gray", "Gray");
 
# start the camera
opencv.capture();
#added sleep in order to give opencv the time to "warm up" the cam
sleep(3)
 
 
# go to http://localhost:9090/output
BareBonesBrowserLaunch.openURL("http://localhost:9090")

Alessandruino

11 years 6 months ago

This is the beginning of the "revolution"... The problem of obsolete examples and projects is resolved !!!

GroG, You ROCK !!!

We will be happy monkeys... Yeah for WORKY examples!!!

Alessandruino

11 years 6 months ago

THIS SISSY SCRIPT DOESN'T WORK :D

HERE IS THE WORKY ONE :D

 

from org.myrobotlab.service import OpenCV
from org.myrobotlab.opencv import OpenCVData
from java.lang import String
from java.lang import Class
opencv = runtime.createAndStart("opencv","OpenCV")
opencv.addFilter("pd","PyramidDown")
opencv.setDisplayFilter("pd")
opencv.addFilter("gray","Gray")
opencv.setDisplayFilter("gray")
opencv.capture()
streamer = runtime.createAndStart("streamer","VideoStreamer")
streamer.setPort(9090)
streamer.start()
streamer.attach(opencv)
Example configuration (from branch develop):
!!org.myrobotlab.service.config.ServiceConfig
listeners: null
peers: null
type: VideoStreamer