Scene Class Reference

class MultiViewTracks.Scene(model_path, tracks_path, fisheye, verbose=True)

This is a class for triangulating tracks using the camera parameters of a COLMAP reconstruction.

model_path

Path to the COLMAP model .bin files

Type:str
tracks_path

Path to the tracks .pkl files

Type:str
fisheye

Did you use OPENCV_FISHEYE in COLMAP reconstruction?

Type:bool
verbose

Do you want a bit of verbosity?

Type:bool
extrinsics

Stores COLMAP extrinsic camera parameters

Type:dict
intrinsics

Stores COLMAP intrinsic camera parameters

Type:dict
cameras

Stores Camera class instance for each reconstructed camera

Type:dict
tracks

Stores tracks for each camera

Type:dict
tracks_triangulated

Stores the triangulated multiple-view tracks, otherwise None

Type:dict
tracks_projected

Stores the projected single-view tracks, otherwise None

Type:dict
tracks_3d

Stores the combined 3d tracks, otherwise None

Type:dict
point_cloud

Stores the sparse or dense COLMAP point cloud otherwise None

Type:np.ndarray
get_cameras()

Creates Camera objects for each unique image prefix with COLMAP reconstruction parameters.

get_extrinsics()

Read the COLMAP extxrinsic camera parameters.

See https://github.com/colmap/colmap/blob/dev/scripts/python/read_model.py for reference.

get_intrinsics()

Read the COLMAP intrinsic camera parameters. Camera model should be OPENCV or OPENCV_FISHEYE.

See https://github.com/colmap/colmap/blob/dev/scripts/python/read_model.py for reference.

get_pointcloud()

Tries to read a dense point cloud (.ply file) from the model path. Otherwise reads the sparse point cloud from the COLMAP reconstruction.

See https://github.com/colmap/colmap/blob/dev/scripts/python/read_model.py for reference.

get_reprojection_errors()

Computes the minimum reprojection error for each triangulated 3D point.

Reprojection errors are stored in tracks_triangulated attribute.

get_tracks()

Read the tracks .pkl files. The file names should match the camera name, but can have a prefix (i.e. prefix[camera_name].pkl)

get_tracks_3d()

Combine triangulated multiple-view trajectories and projected single-view tracks.

interpolate_cameras()

Interpolates the camera paths of the Scene using Camera.interpolate.

project_singleview_tracks()

Project all trajectory points that are observed in only one view to an interpolated detph. Use this if the tracks are mostly planar and uncomplete.

project_tracks()

Projects the tracks of all cameras using Camera.project_tracks.

rotate(camera_ids=[])

Rotates the tracks and 3d point cloud using PCA, so that the first two principal components of the camera paths are x and y.

If reprojection errors were computed for the triangulated trajectories, they remain stored in tracks_triangulated.

Parameters:camera_ids (list, optional) – The ids of the cameras used to calculated the two main axes of view point positions. Defaults to all cameras
scale(camera_ids, world_distance)

Scales the tracks and 3d point cloud according to a known camera-to-camera distance.

If reprojection errors were computed for the triangulated trajectories, they remain stored in tracks_triangulated.

Parameters:
  • camera_ids ((int, int)) – The camera ids used to calculated the distance for scaling
  • world_distance (float) – The known real-world distance between the two specified cameras
Returns:

The reconstruction errors calculated as the difference between reconstruted and measured distance

Return type:

np.ndarray

triangulate_multiview_tracks()

Triangulate all trajectory points that are observed in more than one view.

undistort_tracks()

Undistorts the tracks of all cameras using Camera.undistort_tracks.