(path_cameras, rec)
Imports cameras from a COLMAP reconstruction cameras.bin file
Imports cameras from a COLMAP reconstruction cameras.bin file
Imports cameras from a COLMAP reconstruction cameras . bin file
def import_cameras_reconstruction(path_cameras, rec):
    """
    Imports cameras from a COLMAP reconstruction cameras.bin file
    """
    logger.info("Importing cameras from {}".format(path_cameras))
    with open(path_cameras, "rb") as f:
        n_cameras = unpack("<Q", f.read(8))[0]
        for _ in range(n_cameras):
            camera_id = unpack("<i", f.read(4))[0]
            camera_model_id = unpack("<i", f.read(4))[0]
            width = unpack("<Q", f.read(8))[0]
            height = unpack("<Q", f.read(8))[0]
            params = []
            n_params = camera_models[camera_model_id][1]
            for _ in range(n_params):
                params.append(unpack("<d", f.read(8))[0])
            cam = cam_from_colmap_params(camera_model_id, width, height, params)
            cam.id = str(camera_id)
            rec.add_camera(cam)
def import_cameras_reconstruction ( path_cameras , rec ) : logger . info ( "Importing cameras from {}" . format ( path_cameras ) ) with open ( path_cameras , "rb" ) as f : n_cameras = unpack ( "<Q" , f . read ( 8 ) ) [ 0 ] for _ in range ( n_cameras ) : camera_id = unpack ( "<i" , f . read ( 4 ) ) [ 0 ] camera_model_id = unpack ( "<i" , f . read ( 4 ) ) [ 0 ] width = unpack ( "<Q" , f . read ( 8 ) ) [ 0 ] height = unpack ( "<Q" , f . read ( 8 ) ) [ 0 ] params = [ ] n_params = camera_models [ camera_model_id ] [ 1 ] for _ in range ( n_params ) : params . append ( unpack ( "<d" , f . read ( 8 ) ) [ 0 ] ) cam = cam_from_colmap_params ( camera_model_id , width , height , params ) cam . id = str ( camera_id ) rec . add_camera ( cam )