Example #1
0
def main(args):
    colmap_data = {}
    reference_data = None
    if detect_database(args.input):
        # if input is database file do read database
        print("reading database")
        colmap_data = database_reader_bfs(args.input,
                                          shift_point3d=[
                                              args.shift_point3d_x,
                                              args.shift_point3d_y,
                                              args.shift_point3d_z
                                          ])
        if 'reference_camera_pose' in args and len(
                args.reference_camera_pose) > 0:
            print("use reference")
            filetype = '.bin' if detect_model(args.reference_camera_pose,
                                              filetype='.bin') else '.txt'
            reference_data = binary_reader(args.reference_camera_pose,
                                           filetype)

    elif detect_model(args.input, filetype='.bin'):
        colmap_data = binary_reader(args.input, filetype='.bin')
    elif detect_model(args.input, filetype='.txt'):
        colmap_data = binary_reader(args.input, filetype='.txt')
    else:
        raise RuntimeError(
            'input isn\'t valid colmap model (.bin) directory or database(.db)'
        )
    write_file(args.output, colmap_data, reference_data)
def main(args):
    colmap_data = {}
    if detect_database(args.input):
        # if input is database file do read database
        print("reading database")
        colmap_data = database_reader_bfs(args.input,
                                          shift_point3d=[
                                              args.shift_point3d_x,
                                              args.shift_point3d_y,
                                              args.shift_point3d_z
                                          ])
    else:
        raise RuntimeError('input isn\'t valid database(.db)')
    write_file(args.output, colmap_data)
Example #3
0
def test_detect_db_failed_file_not_exist(tmpdir):
    path = os.path.join(tmpdir, 'penguinguy_cam004_matched.db')
    assert detect_database(path) == False
Example #4
0
def test_detect_db_failed_invalid_ext(tmpdir):
    path = os.path.join(tmpdir, 'hello.txt')
    assert detect_database(path) == False
Example #5
0
def test_detect_db():
    path = 'tests/assets/penguinguy_cam004_matched.db'
    assert detect_database(path) == True