def test_command_line_args2(): import argparse from ecto.opts import cell_options, CellYamlFactory import yaml parser = argparse.ArgumentParser() bb_factory = cell_options(parser, MyBlackBox, 'bb') args = parser.parse_args(['--bb_start', '102']) mm = bb_factory(args) assert mm.params.start == 102
def parse_args(): import argparse parser = argparse.ArgumentParser(description='Test orb on images.') parser.add_argument('-i,--input', dest='input', help='The input dir. %(default)s', default='./images') parser.add_argument('-o,--output', dest='output', type=str, help='The output directory for this template. Default: %(default)s', default='./') factory = cell_options(parser, ORB, 'ORB') scheduler_options(parser.add_argument_group('Scheduler'), default_niter=1) options = parser.parse_args() options.niter = 1 options.orb_factory = factory return options
#!/usr/bin/env python from ecto import Constant from ecto_test import Multiply import argparse from ecto.opts import cell_options parser = argparse.ArgumentParser(description='My awesome program thing.') #add our cells to the parser multiply_factory = cell_options(parser, Multiply, prefix='mult') const_factory = cell_options(parser, Constant(value=0.50505), prefix='const') args = parser.parse_args() #use the factories in conjunction with the parsed arguments, to create our cells. c = const_factory(args) m = multiply_factory(args) # ... construct graph do whatever else...
def test_command_line_args(): import argparse from ecto.opts import cell_options parser = argparse.ArgumentParser() bb_factory = cell_options(parser, MyBlackBox, 'bb') parser.print_help()
#!/usr/bin/env python import ecto from ecto_opencv.highgui import imshow, NiConverter, FPSDrawer from ecto_opencv.imgproc import ConvertTo from ecto_opencv.cv_bp import CV_8UC1 from ecto_openni import OpenNICapture, DEPTH_RGB import argparse from ecto.opts import cell_options parser = argparse.ArgumentParser(description='My awesome program thing.') #add our cells to the parser camera_factory = cell_options(parser, OpenNICapture) args = parser.parse_args() print args #use the factories in conjunction with the parsed arguments, to create our cells. capture = camera_factory(args) fps = FPSDrawer('fps') plasm = ecto.Plasm() plasm.connect( capture['image'] >> fps[:], fps[:] >> imshow('image display', name='image')[:], capture['depth'] >> imshow('depth display', name='depth')[:], ) sched = ecto.schedulers.Singlethreaded(plasm) sched.execute()
#!/usr/bin/env python import ecto from ecto_opencv.highgui import imshow, NiConverter, FPSDrawer from ecto_opencv.imgproc import ConvertTo from ecto_opencv.cv_bp import CV_8UC1 from ecto_openni import OpenNICapture, DEPTH_RGB import argparse from ecto.opts import cell_options parser = argparse.ArgumentParser(description='My awesome program thing.') #add our cells to the parser camera_factory = cell_options(parser, OpenNICapture) args = parser.parse_args() print args #use the factories in conjunction with the parsed arguments, to create our cells. capture = camera_factory(args) fps = FPSDrawer('fps') plasm = ecto.Plasm() plasm.connect(capture['image'] >> fps[:], fps[:] >> imshow('image display', name='image')[:], capture['depth'] >> imshow('depth display', name='depth')[:], ) sched = ecto.schedulers.Singlethreaded(plasm) sched.execute()