Skip to content

Instantly share code, notes, and snippets.

View ethanrublee's full-sized avatar

Ethan Rublee ethanrublee

  • Watsonville, Ca
View GitHub Profile
@ethanrublee
ethanrublee / sporesdecl.cpp
Created September 10, 2011 07:16
A sample of what spore decl might look like
struct Add
{
static void declare_io(const ecto::tendrils& p, ecto::tendrils& i, ecto::tendrils& o)
{
i.declare(&Add::left_,"left");
i.declare(&Add::right_,"right");
o.declare(&Add::out_,"out");
}
typedef enum
{
XN_IO_IMAGE_FORMAT_BAYER = 0,
XN_IO_IMAGE_FORMAT_YUV422 = 1,
XN_IO_IMAGE_FORMAT_JPEG = 2,
XN_IO_IMAGE_FORMAT_JPEG_420 = 3,
XN_IO_IMAGE_FORMAT_JPEG_MONO = 4,
XN_IO_IMAGE_FORMAT_UNCOMPRESSED_YUV422 = 5,
XN_IO_IMAGE_FORMAT_UNCOMPRESSED_BAYER = 6,
} XnIOImageFormats;
#!/usr/bin/env python
import ecto
from ecto_X import Sink
from ecto_opencv.highgui import imshow, FPSDrawer
video = Sink(url='localhost', port=2932)
fps = FPSDrawer()
video_display = imshow(name='video_cap', waitKey=2)
plasm = ecto.Plasm()
#!/usr/bin/env python
import ecto
from ecto_X import Source
from ecto_opencv.highgui import VideoCapture
video_cap = VideoCapture(video_device=0, width=640, height=480)
source = Source(port=2932)
plasm = ecto.Plasm()
plasm.connect(video_cap['image'] >> source['in'],
usage: vidcap.py [-h] [-d,--device DEVICE_ID] [--width WIDTH]
[--height HEIGHT] [--scheduler SCHEDULER_TYPE]
[--nthreads NUMBER_OF_THREADS] [--niter ITERATIONS] [--shell]
Capture a video from the device and display it.
optional arguments:
-h, --help show this help message and exit
-d,--device DEVICE_ID
The device ID of a video camera. Take the number off
#!/usr/bin/env python
#
# Simple vid cap
#
import ecto
import ecto.opts
from ecto_opencv import highgui, calib, imgproc
def video_capture_plasm(device=0, width=640, height=480):
@ethanrublee
ethanrublee / blackbox.py
Created June 19, 2011 03:53
Black Box api sketch
class MyModule(ecto.BlackBox):
def __init__(self, start, step):
ecto.BlackBox.__init__(self)
self.generate = ecto_test.Generate(start=start, step=step)
self.inc = ecto_test.Increment()
def _outputs(self):
return {"out":self.inc["out"]}
def _parameters(self):
return {
"start":self.generate["start"],