Utils Reference¶
-
MultiViewTracks.utils.
compute_reprojection_errors
(tracks, tracks_reprojected, identities=[])¶ Computes point-wise reprojection errors (distances) between tracks and their reprojections.
Parameters: - tracks (dict) – A dictionary containing the original tracks
- tracks_reprojected (dict) – A dictionary containing the reprojected tracks
- identities (list, optional) – A list of trajectory identities for which the reprojection errors should be computed
Returns: - list – A list of arrays containing the reprojection errors for each identity
- array – An array containing the respective identities
-
MultiViewTracks.utils.
load
(file_name)¶ Loads a python object from a .pkl file
Parameters: file_name (str) – File path of saved object Returns: Loaded python object Return type: object
-
MultiViewTracks.utils.
plot_tracks_2d
(tracks, ax=None, figsize=(30, 30), show=True, style='scatter', size=1.0)¶ Plots the x and y components of tracks. Can be used to visualize reprojection errors.
Parameters: - tracks (dict) – A dictionary containing the tracks
- ax (matplotlib.pyplot.Axes, optional) – Axes for plotting
- figsize ((int, int), optional) – Size of the matplotlib output if ax is not specified. Defaults to (30, 30)
- show (bool, optional) – Show plot calling plt.show. Defaults to True.
- style (str, optional) – Plot style, one of “line”, “scatter” or “errors”. Defaults to “scatter”.
- size (float, optional) – Line width or marker size. Defaults to 1.0.
Returns: Return type: matplotlib.pyplot.Axes
-
MultiViewTracks.utils.
pointcloud_to_ply
(point_cloud)¶ Returns pre-formatted ply points from input points, use Scene.get_pointcloud
-
MultiViewTracks.utils.
read_next_bytes
(fid, num_bytes, format_char_sequence, endian_character='<')¶ Read next bytes of a COLMAP .bin file.
See https://github.com/colmap/colmap/blob/dev/scripts/python/read_model.py for reference.
-
MultiViewTracks.utils.
save
(dump, file_name)¶ Save to a .pkl file
Parameters: - dump (object) – Python object to save
- file_name (str) – File path of saved object
Returns: Successful save?
Return type: bool
-
MultiViewTracks.utils.
tracks_to_ply
(tracks, uniform_color=None)¶ Prepare tracks for ply file save.
Parameters: - tracks (dict) – A tracks dictionary, not a pooled dictionary, must contain z component
- uniform_color ((int, int, int), optional) – A shared color used for all tracks, otherwise random RGB generation
Returns: A list of lists of per individual pre-formatted ply points (x y z r g b a)
Return type: list
-
MultiViewTracks.utils.
triangulate_point
(pts_2d, views)¶ Triangulate points from multiple views using either OpenCV.triangulatePoints or DLT.
See https://github.com/opencv/opencv_contrib/blob/master/modules/sfm/src/triangulation.cpp for reference.
-
MultiViewTracks.utils.
write_ply
(pts_ply, file_name)¶ Write points to a .ply file for visualization
Parameters: - pts_ply (list) – The prepared points in ply format, for example using tracks_to_ply
- file_name (str) – The file name of the saved file
Returns: Successful save?
Return type: bool