Ejemplo n.º 1
0
def calib(opts):
    from calibtools.calib import tool

    try:
        cb_shape = tuple(int(x) for x in opts['--shape'].split('x'))
        assert len(cb_shape) == 2
    except (ValueError, AssertionError):
        log.error('Could not parse checkerboard size: "{0}"'.format(
            opts['--shape']))
        return 1

    try:
        kwargs = {
            'start': parse(opts['--start'], int, 'starting index'),
            'duration': parse(opts['--duration'], int, 'duration'),
            'skip': parse(opts['--skip'], int, 'frame skip'),
            'threshold': parse(opts['--threshold'], float, 'threshold'),
            'output': opts['<output>'],
        }
        video = opts['<video>']
        autostop = not parse(opts['--no-stop'], bool, 'no stop flag')
    except ValueError:
        return 1

    return tool(video, cb_shape, autostop=autostop, **kwargs)
Ejemplo n.º 2
0
def undistort(opts):
    from calibtools.undistort import tool

    try:
        kwargs = {
            'start': parse(opts['--start'], int, 'starting index'),
            'duration': parse(opts['--duration'], int, 'duration'),
        }
        video = opts['<video>']
        output = opts['<output>']
        calibration = opts['<calibration>']
    except ValueError:
        return 1

    return tool(calibration, video, output, **kwargs)
Ejemplo n.º 3
0
def undistort(opts):
    from calibtools.undistort import tool

    try:
        kwargs = {
            'start':    parse(opts['--start'], int, 'starting index'),
            'duration': parse(opts['--duration'], int, 'duration'),
        }
        video = opts['<video>']
        output = opts['<output>']
        calibration = opts['<calibration>']
    except ValueError:
        return 1

    return tool(calibration, video, output, **kwargs)
Ejemplo n.º 4
0
def calib(opts):
    from calibtools.calib import tool

    try:
        cb_shape = tuple(int(x) for x in opts['--shape'].split('x'))
        assert len(cb_shape) == 2
    except (ValueError, AssertionError):
        log.error('Could not parse checkerboard size: "{0}"'.format(opts['--shape']))
        return 1

    try:
        kwargs = {
            'start':        parse(opts['--start'], int, 'starting index'),
            'duration':     parse(opts['--duration'], int, 'duration'),
            'skip':         parse(opts['--skip'], int, 'frame skip'),
            'threshold':    parse(opts['--threshold'], float, 'threshold'),
            'output':       opts['<output>'],
        }
        video = opts['<video>']
        autostop = not parse(opts['--no-stop'], bool, 'no stop flag')
    except ValueError:
        return 1

    return tool(video, cb_shape, autostop=autostop, **kwargs)