pose2sim 0.1.0__tar.gz → 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. Pose2Sim-0.1.1/PKG-INFO +564 -0
  2. Pose2Sim-0.1.1/Pose2Sim.egg-info/PKG-INFO +564 -0
  3. {Pose2Sim-0.1.0 → Pose2Sim-0.1.1}/Pose2Sim.egg-info/SOURCES.txt +1 -0
  4. Pose2Sim-0.1.1/Pose2Sim.egg-info/not-zip-safe +1 -0
  5. {Pose2Sim-0.1.0 → Pose2Sim-0.1.1}/Pose2Sim.egg-info/requires.txt +1 -1
  6. Pose2Sim-0.1.1/setup.cfg +49 -0
  7. Pose2Sim-0.1.0/PKG-INFO +0 -16
  8. Pose2Sim-0.1.0/Pose2Sim.egg-info/PKG-INFO +0 -16
  9. Pose2Sim-0.1.0/setup.cfg +0 -36
  10. {Pose2Sim-0.1.0 → Pose2Sim-0.1.1}/LICENSE +0 -0
  11. {Pose2Sim-0.1.0 → Pose2Sim-0.1.1}/Pose2Sim/Pose2Sim.py +0 -0
  12. {Pose2Sim-0.1.0 → Pose2Sim-0.1.1}/Pose2Sim/__init__.py +0 -0
  13. {Pose2Sim-0.1.0 → Pose2Sim-0.1.1}/Pose2Sim/calibrate_cams.py +0 -0
  14. {Pose2Sim-0.1.0 → Pose2Sim-0.1.1}/Pose2Sim/common.py +0 -0
  15. {Pose2Sim-0.1.0 → Pose2Sim-0.1.1}/Pose2Sim/filter_3d.py +0 -0
  16. {Pose2Sim-0.1.0 → Pose2Sim-0.1.1}/Pose2Sim/skeletons.py +0 -0
  17. {Pose2Sim-0.1.0 → Pose2Sim-0.1.1}/Pose2Sim/track_2d.py +0 -0
  18. {Pose2Sim-0.1.0 → Pose2Sim-0.1.1}/Pose2Sim/triangulate_3d.py +0 -0
  19. {Pose2Sim-0.1.0 → Pose2Sim-0.1.1}/Pose2Sim.egg-info/dependency_links.txt +0 -0
  20. {Pose2Sim-0.1.0 → Pose2Sim-0.1.1}/Pose2Sim.egg-info/top_level.txt +0 -0
  21. {Pose2Sim-0.1.0 → Pose2Sim-0.1.1}/README.md +0 -0
  22. {Pose2Sim-0.1.0 → Pose2Sim-0.1.1}/Utilities/DLC_to_Openpose.py +0 -0
  23. {Pose2Sim-0.1.0 → Pose2Sim-0.1.1}/Utilities/__init__.py +0 -0
  24. {Pose2Sim-0.1.0 → Pose2Sim-0.1.1}/Utilities/c3d_to_trc.py +0 -0
  25. {Pose2Sim-0.1.0 → Pose2Sim-0.1.1}/Utilities/calib_from_checkerboard.py +0 -0
  26. {Pose2Sim-0.1.0 → Pose2Sim-0.1.1}/Utilities/calib_qca_to_toml.py +0 -0
  27. {Pose2Sim-0.1.0 → Pose2Sim-0.1.1}/Utilities/calib_toml_to_qca.py +0 -0
  28. {Pose2Sim-0.1.0 → Pose2Sim-0.1.1}/Utilities/calib_toml_to_yml.py +0 -0
  29. {Pose2Sim-0.1.0 → Pose2Sim-0.1.1}/Utilities/calib_yml_to_toml.py +0 -0
  30. {Pose2Sim-0.1.0 → Pose2Sim-0.1.1}/Utilities/json_display_with_img.py +0 -0
  31. {Pose2Sim-0.1.0 → Pose2Sim-0.1.1}/Utilities/json_display_without_img.py +0 -0
  32. {Pose2Sim-0.1.0 → Pose2Sim-0.1.1}/Utilities/trc_Zup_to_Yup.py +0 -0
  33. {Pose2Sim-0.1.0 → Pose2Sim-0.1.1}/Utilities/trc_desample.py +0 -0
  34. {Pose2Sim-0.1.0 → Pose2Sim-0.1.1}/Utilities/trc_filter.py +0 -0
  35. {Pose2Sim-0.1.0 → Pose2Sim-0.1.1}/Utilities/trc_gaitevents.py +0 -0
  36. {Pose2Sim-0.1.0 → Pose2Sim-0.1.1}/Utilities/trc_plot.py +0 -0
  37. {Pose2Sim-0.1.0 → Pose2Sim-0.1.1}/pyproject.toml +0 -0
  38. {Pose2Sim-0.1.0 → Pose2Sim-0.1.1}/setup.py +0 -0
@@ -0,0 +1,564 @@
1
+ Metadata-Version: 2.1
2
+ Name: Pose2Sim
3
+ Version: 0.1.1
4
+ Summary: Perform a markerless kinematic analysis from multiple calibrated views as a unified workflow from an OpenPose input to an OpenSim result.
5
+ Home-page: https://gitlab.inria.fr/perfanalytics/pose2sim
6
+ Author: David Pagnon
7
+ Author-email: contact@david-pagnon.com
8
+ License: BSD 3-Clause License
9
+ Project-URL: Bug Tracker, https://github.com/davidpagnon/pose2sim/issues
10
+ Keywords: markerless,kinematics,OpenPose,OpenSim,3D human pose,biomechanics
11
+ Platform: any
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: License :: OSI Approved :: BSD License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Topic :: Scientific/Engineering
18
+ Classifier: Topic :: Scientific/Engineering :: Image Processing
19
+ Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
20
+ Requires-Python: <4,>=3.8
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+
24
+ <!--
25
+ * @Date: 2021-03-19 15:52:32
26
+ * @Author: David Pagnon
27
+ * @LastEditors: David Pagnon
28
+ * @LastEditTime: 2021-03-19 15:52:32
29
+ * @FilePath: /Openpose-to-Opensim/Readme.md
30
+ -->
31
+
32
+ <!-- [![PyPI version](https://badge.fury.io/py/anipose.svg)](https://badge.fury.io/py/anipose) -->
33
+
34
+
35
+ # Pose2Sim
36
+ This Python repository offers a way to perform a markerless kinematic analysis from multiple calibrated views as a unified workflow from an OpenPose input to an OpenSim result. \
37
+ It has been tested on Windows 10 but should work similarly on Linux or MacOS.\
38
+ Pull requests and suggestions are very welcome.
39
+
40
+
41
+ ## Contents
42
+ 1. [Installation and Demonstration](#installation-and-demonstration)
43
+ 2. [Use on your own data](#use-on-your-own-data)
44
+ 1. [Prepare for running on your own data](#prepare-for-running-on-your-own-data)
45
+ 2. [2D pose estimation](#2d-pose-estimation)
46
+ 3. [Cameras calibration](#cameras-calibration)
47
+ 4. [2D Tracking of person](#2d-tracking-of-person)
48
+ 5. [3D triangulation](#3d-triangulation)
49
+ 6. [3D filtering](#3d-filtering)
50
+ 7. [OpenSim kinematics](#opensim-kinematics)
51
+ 3. [Utilities](#utilities)
52
+ 4. [How to cite and others](#how-to-cite-and-others)
53
+
54
+ ## Installation and Demonstration
55
+
56
+ 1. Install OpenPose (instructions [there](https://github.com/CMU-Perceptual-Computing-Lab/openpose#installation)).\
57
+ Install OpenSim ([there](https://simtk.org/frs/index.php?group_id=91)).\
58
+ Install Anaconda or [Miniconda](https://docs.conda.io/en/latest/miniconda.html).
59
+ 2. Clone the Pose2Sim repository.
60
+ 3. Install requirements: Open an Anaconda terminal in the cloned folder.
61
+ ```
62
+ conda create --name Pose2Sim -c conda-forge --file requirements.txt
63
+ conda activate Pose2Sim
64
+ ```
65
+ 4. Add the directory where Pose2Sim is installed to your PYTHONPATH environment variable (or append it to the sys.path).
66
+ 5. This Demo provides an example of the processing of a set of OpenPose input data for a 4 cameras experiment of a person balancing on a beam. Open an Anaconda terminal in the `Demo` folder of the cloned directory and try the following code in a Python session :
67
+ ```
68
+ from Pose2Sim import Pose2Sim
69
+ Pose2Sim.calibrateCams()
70
+ Pose2Sim.track2D()
71
+ Pose2Sim.triangulate3D()
72
+ Pose2Sim.filter3D()
73
+ ```
74
+ You should obtain a plot of all the trajectories of 3D coordinates. Results are stored as .trc files in the Demo/pose-3d directory. You can check the logs in`Demo\Users\logs.txt`.\
75
+ Default parameters have been provided in `Demo\Users\Config.toml` but can be edited.\
76
+ Section [Opensim kinematics](#opensim-kinematics) describes how to obtain 3D joint angles.
77
+
78
+ ## Use on your own data
79
+
80
+ ### Prepare for running on your own data
81
+ > _**Get ready.**_
82
+
83
+ 1. Edit the `Config.toml` file as needed, especially regarding the path to your project. The file is located by default in the `User` folder of your cloned repository, but you can copy-paste it anywhere (e.g. in your data directory).
84
+ 2. Set up project hierarchy (in your data directory).
85
+
86
+ ```
87
+ Project
88
+ │
89
+ ├──opensim
90
+ │ ├──Model_Pose2Sim_Body25b.osim
91
+ │ ├──Scaling_Setup_Pose2Sim_Body25b.xml
92
+ │ └──IK_Setup_Pose2Sim_Body25b.xml
93
+ │
94
+ └── raw-2d
95
+ ├──raw_cam1_img
96
+ ├──...
97
+ └──raw_camN_img
98
+ ```
99
+
100
+ ### 2D pose estimation
101
+ > _**Estimate 2D pose from images with Openpose.**_
102
+
103
+ Open a command prompt in your **OpenPose** directory. \
104
+ Launch OpenPose for each raw image folder:
105
+ ```
106
+ bin\OpenPoseDemo.exe --model_pose BODY_25B --image_dir <PATH_TO_PROJECT_DIR>\raw-2d\raw_cam1_img --write_json <PATH_TO_PROJECT_DIR>\pose-2d\pose_cam1_json
107
+ ```
108
+
109
+ * *N.B.:* The [BODY_25B model](https://github.com/CMU-Perceptual-Computing-Lab/openpose_train/tree/master/experimental_models) has more accurate results; however, feel free to use any OpenPose model (BODY_25B, BODY_25, COCO, with face and/or hands, etc), and to work with videos instead of image files.
110
+ * *N.B.:* You can also use [DeepLabCut](https://github.com/DeepLabCut/DeepLabCut), or other 2D pose estimators instead. \
111
+ If you decide to do so, you'll have to (1) translate the format to json files (with `DLC_to_OpenPose.py` script, see [Utilities](#utilities)); (2) report the model keypoints in the 'skeleton.py' file; (3) create an OpenSim model if you need 3D joint angles.
112
+
113
+ <img src="Content/Pose2D.png" width="760">
114
+
115
+ N.B.: Markers are not needed and are used only for validation
116
+
117
+
118
+ <details>
119
+ <summary>The project hierarchy becomes: (CLICK TO SHOW)</summary>
120
+ <pre>
121
+ Project
122
+ │
123
+ ├──opensim
124
+ │ ├──Model_Pose2Sim_Body25b.osim
125
+ │ ├──Scaling_Setup_Pose2Sim_Body25b.xml
126
+ │ └──IK_Setup_Pose2Sim_Body25b.xml
127
+ │
128
+ <i><b>├──pose-2d
129
+ │ ├──pose_cam1_json
130
+ │ ├──...
131
+ │ └──pose_camN_json</i></b>
132
+ │
133
+ └── raw-2d
134
+ ├──raw_cam1_img
135
+ ├──...
136
+ └──raw_camN_img
137
+ </pre>
138
+ </details>
139
+
140
+ ### Cameras calibration
141
+ > _**Calibrate your cameras.**_
142
+
143
+ 1. If you already have a calibration file (.qca.txt from Qualisys for example):
144
+ - copy it in the `calib-2d` folder
145
+ - set [calibration] type to 'qca' in your `Config.toml` file.
146
+
147
+ or
148
+
149
+ 2. If you have taken pictures or videos of a checkerboard with your cameras:
150
+ - create a folder for each camera in your `calib-2d` folder,
151
+ - copy there the images or videos of the checkerboard
152
+ - set [calibration] type to 'checkerboard' in your `Config.toml` file, and adjust other parameters.
153
+
154
+ Open an Anaconda prompt or a terminal. \
155
+ By default, `calibrateCams()` will look for `Config.toml` in the `User` folder of your current directory. If you want to store it somewhere else (e.g. in your data directory), specify this path as an argument: `Pose2Sim.calibrateCams(r'path_to_config.toml')`.
156
+
157
+ ```
158
+ from Pose2Sim import Pose2Sim
159
+ Pose2Sim.calibrateCams()
160
+ ```
161
+
162
+ Output:\
163
+ <img src="Content/Calib2D.png" width="760">
164
+
165
+ <img src="Content/CalibFile.png" width="760">
166
+
167
+
168
+ <details>
169
+ <summary>The project hierarchy becomes: (CLICK TO SHOW)</summary>
170
+ <pre>
171
+ Project
172
+ │
173
+ ├──<i><b>calib-2d
174
+ │ └──Calib.toml</i></b>
175
+ │
176
+ ├──opensim
177
+ │ ├──Model_Pose2Sim_Body25b.osim
178
+ │ ├──Scaling_Setup_Pose2Sim_Body25b.xml
179
+ │ └──IK_Setup_Pose2Sim_Body25b.xml
180
+ │
181
+ ├──pose-2d
182
+ │ ├──pose_cam1_json
183
+ │ ├──...
184
+ │ └──pose_camN_json
185
+ │
186
+ └── raw-2d
187
+ ├──raw_cam1_img
188
+ ├──...
189
+ └──raw_camN_img
190
+ </pre>
191
+ </details>
192
+
193
+ ### 2D tracking of person
194
+ > _**Track the person viewed by the most cameras, in case of several detections by OpenPose.**_ \
195
+ *N.B.: Skip this step if only one person is in the field of view.*
196
+
197
+ Open an Anaconda terminal
198
+ By default, `track2D()` will look for `Config.toml` in the `User` folder of your current directory. If you want to store it somewhere else (e.g. in your data directory), specify this path as an argument: `Pose2Sim.track2D(r'path_to_config.toml')`.
199
+ ```
200
+ from Pose2Sim import Pose2Sim
201
+ Pose2Sim.track2D()
202
+ ```
203
+
204
+ Check printed output. If results are not satisfying, try and release the constraints in the `Config.toml` file.
205
+
206
+ Output:\
207
+ <img src="Content/Track2D.png" width="760">
208
+
209
+
210
+ <details>
211
+ <summary>The project hierarchy becomes: (CLICK TO SHOW)</summary>
212
+ <pre>
213
+ Project
214
+ │
215
+ ├──calib-2d
216
+ │ ├──calib_cam1_img
217
+ │ ├──...
218
+ │ ├──calib_camN_img
219
+ │ └──Calib.toml
220
+ │
221
+ ├──opensim
222
+ │ ├──Model_Pose2Sim_Body25b.osim
223
+ │ ├──Scaling_Setup_Pose2Sim_Body25b.xml
224
+ │ └──IK_Setup_Pose2Sim_Body25b.xml
225
+ │
226
+ ├──pose-2d
227
+ │ ├──pose_cam1_json
228
+ │ ├──...
229
+ │ └──pose_camN_json
230
+ │
231
+ <i><b>├──pose-2d-tracked
232
+ │ ├──tracked_cam1_json
233
+ │ ├──...
234
+ │ └──tracked_camN_json</i></b>
235
+ │
236
+ └── raw-2d
237
+ ├──raw_cam1_img
238
+ ├──...
239
+ └──raw_camN_img
240
+ </pre>
241
+ </details>
242
+
243
+ ### 3D triangulation
244
+ > _**Triangulate your 2D coordinates in a robust way.**_
245
+
246
+ Open an Anaconda terminal.
247
+ By default, `triangulate3D()` will look for `Config.toml` in the `User` folder of your current directory. If you want to store it somewhere else (e.g. in your data directory), specify this path as an argument: `Pose2Sim.triangulate3D(r'path_to_config.toml')`.
248
+
249
+ ```
250
+ from Pose2Sim import Pose2Sim
251
+ Pose2Sim.triangulate3D()
252
+ ```
253
+
254
+ Check printed output, and vizualise your trc in OpenSim.\
255
+ If your triangulation is not satisfying, try and release the constraints in the `Config.toml` file.
256
+
257
+ Output:\
258
+ <img src="Content/Triangulate3D.png" width="760">
259
+
260
+
261
+ <details>
262
+ <summary>The project hierarchy becomes: (CLICK TO SHOW)</summary>
263
+ <pre>
264
+ Project
265
+ │
266
+ ├──calib-2d
267
+ │ ├──calib_cam1_img
268
+ │ ├──...
269
+ │ ├──calib_camN_img
270
+ │ └──Calib.toml
271
+ │
272
+ ├──opensim
273
+ │ ├──Model_Pose2Sim_Body25b.osim
274
+ │ ├──Scaling_Setup_Pose2Sim_Body25b.xml
275
+ │ └──IK_Setup_Pose2Sim_Body25b.xml
276
+ │
277
+ ├──pose-2d
278
+ │ ├──pose_cam1_json
279
+ │ ├──...
280
+ │ └──pose_camN_json
281
+ │
282
+ ├──pose-2d-tracked
283
+ │ ├──tracked_cam1_json
284
+ │ ├──...
285
+ │ └──tracked_camN_json
286
+ │
287
+ <i><b>├──pose-3d
288
+ └──Pose-3d.trc</i></b>>
289
+ │
290
+ └── raw-2d
291
+ ├──raw_cam1_img
292
+ ├──...
293
+ └──raw_camN_img
294
+ </pre>
295
+ </details>
296
+
297
+
298
+ ### 3D Filtering
299
+ > _**Filter your 3D coordinates.**_
300
+
301
+ Open an Anaconda terminal.
302
+ By default, `filter3D()` will look for `Config.toml` in the `User` folder of your current directory. If you want to store it somewhere else (e.g. in your data directory), specify this path as an argument: `Pose2Sim.filter3D(r'path_to_config.toml')`.
303
+
304
+ ```
305
+ from Pose2Sim import Pose2Sim
306
+ Pose2Sim.filter3D()
307
+ ```
308
+
309
+ Check your filtration with the displayed figures, and vizualise your trc in OpenSim. If your filtering is not satisfying, try and change the parameters in the `Config.toml` file.
310
+
311
+ Output:\
312
+ <img src="Content/FilterPlot.png" width="760">
313
+
314
+ <img src="Content/Filter3D.png" width="760">
315
+
316
+
317
+ <details>
318
+ <summary>The project hierarchy becomes: (CLICK TO SHOW)</summary>
319
+ <pre>
320
+ Project
321
+ │
322
+ ├──calib-2d
323
+ │ ├──calib_cam1_img
324
+ │ ├──...
325
+ │ ├──calib_camN_img
326
+ │ └──Calib.toml
327
+ │
328
+ ├──opensim
329
+ │ ├──Model_Pose2Sim_Body25b.osim
330
+ │ ├──Scaling_Setup_Pose2Sim_Body25b.xml
331
+ │ └──IK_Setup_Pose2Sim_Body25b.xml
332
+ │
333
+ ├──pose-2d
334
+ │ ├──pose_cam1_json
335
+ │ ├──...
336
+ │ └──pose_camN_json
337
+ │
338
+ ├──pose-2d-tracked
339
+ │ ├──tracked_cam1_json
340
+ │ ├──...
341
+ │ └──tracked_camN_json
342
+ │
343
+ <i><b>├──pose-3d
344
+ │ ├──Pose-3d.trc
345
+ │ └──Pose-3d-filtered.trc</i></b>
346
+ │
347
+ └── raw-2d
348
+ ├──raw_cam1_img
349
+ ├──...
350
+ └──raw_camN_img
351
+ </pre>
352
+ </details>
353
+
354
+
355
+ ### OpenSim kinematics
356
+ > _**Obtain 3D joint angles.**_
357
+
358
+ #### Scaling
359
+ In the same vein as you would do with marker-based kinematics, start with scaling your model.
360
+ 1. Use the previous steps to capture a static pose, typically a T-pose (example file: `Standing_for_Scaling.trc`.)
361
+ 2. Open the provided `Model_Pose2Sim_Body25b.osim` model from `Pose2Sim/Demo/opensim`. *(File -> Open Model)*
362
+ 3. Load the provided `Scaling_Setup_Pose2Sim_Body25b.xml` scaling file from `Pose2Sim/Demo/opensim`. *(Tools -> Scale model -> Load)*
363
+ 4. Replace the example static .trc file with your own data if needed.
364
+ 5. Run
365
+ 6. Save the new scaled OpenSim model.
366
+
367
+ #### Inverse kinematics
368
+ 1. Use Pose2Sim to generate 3D trajectories (example file: `Balancing_for_IK.trc`.)
369
+ 2. Load the provided `IK_Setup_Pose2Sim_Body25b.xml` scaling file from `Pose2Sim/Demo/opensim`. *(Tools -> Inverse kinematics -> Load)*
370
+ 3. Replace the example .trc file with your own data if needed, and specify the path to your angle kinematics output file.
371
+ 4. Run
372
+ 5. Motion results will appear as .mot file in the Demo/opensim directory (automatically saved).
373
+
374
+ <img src="Content/OpenSim.JPG" width="380">
375
+
376
+
377
+ #### Batch processing
378
+ Alternatively, you can use command-line tools:
379
+ Open an Anaconda terminal in your OpenSim/bin directory, typically `C:\OpenSim <Version>\bin`.\
380
+ You'll need to adjust the `time_range`, `output_motion_file` and `marker_file` in your setup file.
381
+ ```
382
+ opensim-cmd run-tool <PATH_TO_POSE2SIM>/OpenSim/Setup/<YOUR SCALING OR IK SETUP FILE>.xml
383
+ ```
384
+
385
+
386
+ <details>
387
+ <summary>The project hierarchy becomes: (CLICK TO SHOW)</summary>
388
+ <pre>
389
+ Project
390
+ │
391
+ ├──calib-2d
392
+ │ ├──calib_cam1_img
393
+ │ ├──...
394
+ │ ├──calib_camN_img
395
+ │ └──Calib.toml
396
+ │
397
+ ├──<i><b>opensim</i></b>
398
+ │ ├──Model_Pose2Sim_Body25b.osim
399
+ │ ├──Scaling_Setup_Pose2Sim_Body25b.xml
400
+ │ ├──<i><b>Model_Pose2Sim_Body25b_Scaled.osim</i></b>
401
+ │ ├──IK_Setup_Pose2Sim_Body25b.xml
402
+ │ └──<i><b>IK_result.mot</i></b>
403
+ │
404
+ ├──pose-2d
405
+ │ ├──pose_cam1_json
406
+ │ ├──...
407
+ │ └──pose_camN_json
408
+ │
409
+ ├──pose-2d-tracked
410
+ │ ├──tracked_cam1_json
411
+ │ ├──...
412
+ │ └──tracked_camN_json
413
+ │
414
+ ├──pose-3d
415
+ │ ├──Pose-3d.trc
416
+ │ └──Pose-3d-filtered.trc
417
+ │
418
+ └── raw-2d
419
+ ├──raw_cam1_img
420
+ ├──...
421
+ └──raw_camN_img
422
+ </pre>
423
+ </details>
424
+
425
+ ## Utilities
426
+ A list of standalone tools, which can be both run as scripts or imported as functions. Check usage in the docstrings of each python file.\
427
+ Optional: If you want to execute them systemwide, add the path to your environment variables: \
428
+ `Windows -> Environment Variables -> New -> Name: PYTHONPATH, Value: <PATH_TO_POSE2SIM>/Utilities` \
429
+
430
+ <details>
431
+ <summary><b>Converting files and Calibrating</b> (CLICK TO SHOW)</summary>
432
+ <pre>
433
+
434
+ `DLC_to_OpenPose.py`
435
+ Converts a DeepLabCut (h5) 2D pose estimation file into OpenPose (json) files.
436
+
437
+ `c3d_to_trc.py`
438
+ Converts 3D point data of a .c3d file to a .trc file compatible with OpenSim. No analog data (force plates, emg) nor computed data (angles, powers, etc) are retrieved.
439
+
440
+ `calib_from_checkerboard.py`
441
+ Calibrates cameras with images or a video of a checkerboard, saves calibration in a Pose2Sim .toml calibration file.
442
+
443
+ `calib_qca_to_toml.py`
444
+ Converts a Qualisys .qca.txt calibration file to the Pose2Sim .toml calibration file (similar to what is used in [AniPose](https://anipose.readthedocs.io/en/latest/)).
445
+
446
+ `calib_toml_to_qca.py`
447
+ Converts a Pose2Sim .toml calibration file (e.g., from a checkerboard) to a Qualisys .qca.txt calibration file.
448
+
449
+ `calib_yml_to_toml.py`
450
+ Converts OpenCV intrinsic and extrinsic .yml calibration files to an OpenCV .toml calibration file.
451
+
452
+ `calib_toml_to_yml.py`
453
+ Converts an OpenCV .toml calibration file to OpenCV intrinsic and extrinsic .yml calibration files.
454
+ </pre>
455
+ </details>
456
+
457
+ <details>
458
+ <summary><b>Plotting tools</b> (CLICK TO SHOW)</summary>
459
+ <pre>
460
+
461
+ `json_display_with_img.py`
462
+ Overlays 2D detected json coordinates on original raw images. High confidence keypoints are green, low confidence ones are red.
463
+
464
+ `json_display_without_img.py`
465
+ Plots an animation of 2D detected json coordinates.
466
+
467
+ `trc_plot.py`
468
+ Displays X, Y, Z coordinates of each 3D keypoint of a TRC file in a different matplotlib tab.
469
+ </pre>
470
+ </details>
471
+
472
+ <details>
473
+ <summary><b>Other trc tools</b> (CLICK TO SHOW)</summary>
474
+ <pre>
475
+
476
+ `trc_desample.py`
477
+ Undersamples a trc file.
478
+
479
+ `trc_Zup_to_Yup.py`
480
+ Changes Z-up system coordinates to Y-up system coordinates.
481
+
482
+ `trc_filter.py`
483
+ Filters trc files. Available filters: Butterworth, Butterworth on speed, Gaussian, LOESS, Median.
484
+
485
+ `trc_gaitevents.py`
486
+ Detects gait events from point coordinates according to [Zeni et al. (2008)](https://www.sciencedirect.com/science/article/abs/pii/S0966636207001804?via%3Dihub).
487
+ </pre>
488
+ </details>
489
+
490
+
491
+ ## How to cite and others
492
+ #### How to cite
493
+ If you use this code or data, please cite [Pagnon et al., 2022](https://www.mdpi.com/1424-8220/22/7/2712) or [Pagnon et al., 2021](https://www.mdpi.com/1424-8220/21/19/6530).
494
+
495
+ @Article{Pagnon_2022_Pose2Sim,
496
+ AUTHOR = {Pagnon, David and Domalain, Mathieu and Reveret, Lionel},
497
+ TITLE = {Pose2Sim: An End-to-End Workflow for 3D Markerless Sports Kinematics—Part 2: Accuracy},
498
+ JOURNAL = {Sensors},
499
+ YEAR = {2022},
500
+ PUBLISHER = {Multidisciplinary Digital Publishing Institute},
501
+ URL = {https://www.mdpi.com/1424-8220/22/7/2712}
502
+ }
503
+
504
+ @Article{Pagnon_2021_Pose2Sim,
505
+ AUTHOR = {Pagnon, David and Domalain, Mathieu and Reveret, Lionel},
506
+ TITLE = {Pose2Sim: An End-to-End Workflow for 3D Markerless Sports Kinematics—Part 1: Robustness},
507
+ JOURNAL = {Sensors},
508
+ YEAR = {2021},
509
+ PUBLISHER = {Multidisciplinary Digital Publishing Institute},
510
+ URL = {https://www.mdpi.com/1424-8220/21/19/6530},
511
+ }
512
+
513
+ #### Contributers
514
+ David Pagnon (maintainer, developer), contact@david-pagnon.com\
515
+ Lionel Reveret, lionel.reveret@inria.fr\
516
+ Mathieu Domalain, mathieu.domalain@univ-poitiers.fr
517
+
518
+ #### To do list
519
+ * Pip or conda install
520
+ * Make Docker image
521
+ * Multiple persons kinematics (triangulating multiple persons, and sorting them in time)
522
+ * Solve limb swapping
523
+ * Implement normalized DLT and RANSAC triangulation
524
+ * Implement optimal fixed-interval Kalman smoothing
525
+ * Implement OpenSim London Lumbar Spine Model (validated for a wide range of daily tasks)
526
+ * Calibrate with Aruco, Charuco, etc
527
+ * Utilities: convert Vicon xcp calibration file to toml
528
+ * Run from command line via click or typer
529
+ * Make GUI interface
530
+ * Catch errors
531
+
532
+ Pull requests and suggestions are always welcome!
533
+
534
+ BSD 3-Clause License
535
+
536
+ Copyright (c) 2021, David PAGNON
537
+ All rights reserved.
538
+
539
+ Redistribution and use in source and binary forms, with or without
540
+ modification, are permitted provided that the following conditions are met:
541
+
542
+ 1. Redistributions of source code must retain the above copyright notice, this
543
+ list of conditions and the following disclaimer.
544
+
545
+ 2. Redistributions in binary form must reproduce the above copyright notice,
546
+ this list of conditions and the following disclaimer in the documentation
547
+ and/or other materials provided with the distribution.
548
+
549
+ 3. Neither the name of the copyright holder nor the names of its
550
+ contributors may be used to endorse or promote products derived from
551
+ this software without specific prior written permission.
552
+
553
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
554
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
555
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
556
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
557
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
558
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
559
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
560
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
561
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
562
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
563
+
564
+