MCPcopy Index your code
hub / github.com/DeepLabCut/DeepLabCut / triangulate

Function triangulate

deeplabcut/pose_estimation_3d/triangulation.py:27–469  ·  view source on GitHub ↗

This function triangulates the detected DLC-keypoints from the two camera views using the camera matrices (derived from calibration) to calculate 3D predictions. Parameters ---------- config : string Full path of the config.yaml file as a string. video_path : string/lis

(
    config,
    video_path,
    videotype="",
    filterpredictions=True,
    filtertype="median",
    gputouse=None,
    destfolder=None,
    save_as_csv=False,
    track_method="",
)

Source from the content-addressed store, hash-verified

25# other API (i.e. videotype: str -> video_extensions: str | Sequence[str] | None)
26# this requires updating get_camerawise_videos (matching `collect_video_paths`)
27def triangulate(
28 config,
29 video_path,
30 videotype="",
31 filterpredictions=True,
32 filtertype="median",
33 gputouse=None,
34 destfolder=None,
35 save_as_csv=False,
36 track_method="",
37):
38 """This function triangulates the detected DLC-keypoints from the two camera views
39 using the camera matrices (derived from calibration) to calculate 3D predictions.
40
41 Parameters
42 ----------
43 config : string
44 Full path of the config.yaml file as a string.
45
46 video_path : string/list of list
47 Full path of the directory where videos are saved. If the user wants to analyze
48 only a pair of videos, the user needs to pass them as a list of list of videos,
49 i.e. [['video1-camera-1.avi','video1-camera-2.avi']]
50
51 videotype: string, optional
52 Checks for the extension of the video in case the input to the video is a directory.\n
53 Only videos with this extension are analyzed.
54 If left unspecified, videos with common extensions ('avi', 'mp4', 'mov', 'mpeg', 'mkv') are kept.
55
56
57 filterpredictions: Bool, optional
58 Filter the predictions with filter specified by "filtertype". If specified it
59 should be either ``True`` or ``False``.
60
61 filtertype: string
62 Select which filter, 'arima' or 'median' filter (currently supported).
63
64 gputouse: int, optional. Natural number indicating the number of your GPU (see number in nvidia-smi).
65 If you do not have a GPU put None.
66 See: https://nvidia.custhelp.com/app/answers/detail/a_id/3751/~/useful-nvidia-smi-queries
67
68 destfolder: string, optional
69 Specifies the destination folder for analysis data (default is the path of the video)
70
71 save_as_csv: bool, optional
72 Saves the predictions in a .csv file. The default is ``False``
73
74 Example
75 -------
76 Linux/MacOS
77 To analyze all the videos in the directory:
78 >>> deeplabcut.triangulate(config,'/data/project1/videos/')
79
80 To analyze only a few pairs of videos:
81 >>> deeplabcut.triangulate(config,[['/data/project1/videos/video1-camera-1.avi',
82 ... '/data/project1/videos/video1-camera-2.avi'],['/data/project1/videos/video2-camera-1.avi',
83 ... '/data/project1/videos/video2-camera-2.avi']])
84

Callers

nothing calls this directly

Calls 9

analyze_videosFunction · 0.90
undistort_pointsFunction · 0.85
formatMethod · 0.80
keysMethod · 0.80
uniqueMethod · 0.80
insertMethod · 0.80
read_configMethod · 0.45
getMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected