Exemple #1
0
def calibration(rows,cols,square_size,pattern_type,n_obs,video):
    plasm = ecto.Plasm()
    pattern_show = highgui.imshow(name="pattern", waitKey=10, autoSize=True)
    rgb2gray = imgproc.cvtColor(flag=7)
    circle_detector = calib.PatternDetector(rows=rows, cols=cols,pattern_type=pattern_type,square_size=square_size )
    ecto.print_module_doc(circle_detector)
    circle_drawer = calib.PatternDrawer(rows=rows, cols=cols)
    camera_calibrator = calib.CameraCalibrator(output_file_name="camera.yml",n_obs=n_obs)
    
    plasm.connect(video, "image", rgb2gray, "input")
    plasm.connect(rgb2gray, "out", circle_detector, "input")
    plasm.connect(video, "image", circle_drawer, "input")
    plasm.connect(video, "image", camera_calibrator, "image")
    plasm.connect(circle_detector, "out", circle_drawer, "points")
    plasm.connect(circle_detector, "found", circle_drawer, "found")
    plasm.connect(circle_drawer, "out", pattern_show, "input")
    plasm.connect(circle_detector, "ideal", camera_calibrator,"ideal")
    plasm.connect(circle_detector, "out", camera_calibrator,"points")
    plasm.connect(circle_detector, "found", camera_calibrator, "found")
    
    print plasm.viz()
    ecto.view_plasm(plasm)
    
    while(pattern_show.outputs.out != 27 and camera_calibrator.outputs.calibrated == False):
        plasm.execute(1)
Exemple #2
0
def test_doc():
    scatter = ecto_test.Scatter(n=6, x=3)
    gather = ecto_test.Gather(n=3)
    gather2 = ecto_test.Gather(n=3)
    plasm = ecto.Plasm()
    for t,f in zip(gather.inputs.keys(), scatter.outputs.keys()):
        plasm.connect(scatter, f, gather, t)
    for t,f in zip(gather2.inputs.keys(), scatter.outputs.keys()[3:]):
        plasm.connect(scatter, f, gather2, t)
    sched = ecto.schedulers.Singlethreaded(plasm)
    sched.execute()
    result = gather.outputs.out
    assert(result == 9) # 3 * 3
    
    ecto.print_module_doc(scatter)
    ecto.print_module_doc(gather)
    print plasm.viz()
Exemple #3
0
#import ecto_opencv.cv_bp as opencv
from ecto_opencv import highgui, calib, imgproc, line_mod

debug = True

plasm = ecto.Plasm()  #Constructor for Plasm
video = highgui.VideoCapture(video_device=1)
bin_color = line_mod.ColorMod(thresh_bw=20)
db_color = line_mod.ColorMod();
coded_color = highgui.imshow(name="coded_color", waitKey=10, autoSize=True)
raw_image = highgui.imshow(name="raw image", waitKey= -1, autoSize=True)
highgui_db_color = highgui.imshow(name="db_color", waitKey= -1, autoSize=True)


if debug:
    ecto.print_module_doc(video)
    ecto.print_module_doc(coded_color)

plasm.connect(video, "image", bin_color, "image")
plasm.connect(video, "image", raw_image, "input")
plasm.connect(bin_color, "output", coded_color, "input")
plasm.connect(bin_color, "output", db_color, "input")
plasm.connect(db_color, "output", highgui_db_color, "input")

if debug:
    ecto.view_plasm(plasm)

thresh_gt = 10
bin_color.params.thresh_gt = thresh_gt;

bin_color.configure()