Esempio n. 1
0
def test_load_config(path_archiv_2016, config):
    dts = video_archiv.Video_Archiv(year='2016',
                                    root_dir=path_archiv_2016,
                                    config=config)
    assert dts.config is not None
    assert dts.root_dir == path_archiv_2016
    assert dts.dir_format == config['2016']['DIR_FORMAT']
    assert dts.video_ext == config['2016']['VIDEO_EXT']
Esempio n. 2
0
def video_archiv_2016(path_archiv_2016):
    return video_archiv.Video_Archiv(year='2016', root_dir=path_archiv_2016)
Esempio n. 3
0
def test_load_default_config(config):
    dts = video_archiv.Video_Archiv(year='2016')
    assert dts.config is not None
    assert dts.root_dir == config['2016']['ROOT_DIR']
    assert dts.dir_format == config['2016']['DIR_FORMAT']
    assert dts.video_ext == config['2016']['VIDEO_EXT']
YEAR = '2016'
PATH = './06_Cam_23_intervals_pair.json'
LOG_PATH = 'log_23.txt'

logging.basicConfig(filename=LOG_PATH,
                    level=logging.DEBUG,
                    format='%(asctime)s - %(levelname)s - %(message)s')

with open(PATH) as data_file:
    intervals = json.load(data_file)

out_year = os.path.join(ROOT_OUT, YEAR)
if not os.path.exists(out_year):
    os.makedirs(out_year)

va = va_core.Video_Archiv(YEAR)

for interval in intervals:
    out_interval_id = os.path.join(out_year, str(interval['id']).zfill(2))
    if not os.path.exists(out_interval_id):
        os.mkdir(out_interval_id)
    for key in ['left', 'right']:
        if interval[key] is None:
            logging.warning(
                'The side {side} of the Interval {id} is None'.format(
                    side=key, id=interval['id']))
            continue

        path_start = va.get_abs_path_by_name(interval[key]['start_video_name'])
        frame_start = vr.get_first_frame(path_start)
        name_start = '{Cam_id_ts}.jpg'.format(