pybvh 0.1.0__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.
- pybvh-0.1.0/LICENSE +21 -0
- pybvh-0.1.0/MANIFEST.in +5 -0
- pybvh-0.1.0/PKG-INFO +74 -0
- pybvh-0.1.0/README.md +52 -0
- pybvh-0.1.0/pybvh/__init__.py +9 -0
- pybvh-0.1.0/pybvh/bvh.py +875 -0
- pybvh-0.1.0/pybvh/bvhnode.py +180 -0
- pybvh-0.1.0/pybvh/df_to_bvh.py +308 -0
- pybvh-0.1.0/pybvh/plot.py +392 -0
- pybvh-0.1.0/pybvh/read_bvh_file.py +221 -0
- pybvh-0.1.0/pybvh/rotations.py +697 -0
- pybvh-0.1.0/pybvh/spatial_coord.py +202 -0
- pybvh-0.1.0/pybvh/tools.py +83 -0
- pybvh-0.1.0/pybvh.egg-info/PKG-INFO +74 -0
- pybvh-0.1.0/pybvh.egg-info/SOURCES.txt +18 -0
- pybvh-0.1.0/pybvh.egg-info/dependency_links.txt +1 -0
- pybvh-0.1.0/pybvh.egg-info/requires.txt +9 -0
- pybvh-0.1.0/pybvh.egg-info/top_level.txt +1 -0
- pybvh-0.1.0/pyproject.toml +34 -0
- pybvh-0.1.0/setup.cfg +4 -0
pybvh-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 yho67
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
pybvh-0.1.0/MANIFEST.in
ADDED
pybvh-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pybvh
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: BVH reader/writer and kinematics utilities
|
|
5
|
+
Author-email: Victor Schneider <victor.schneider67@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/VictorS-67/pybvh
|
|
8
|
+
Project-URL: Repository, https://github.com/VictorS-67/pybvh
|
|
9
|
+
Project-URL: Issues, https://github.com/VictorS-67/pybvh/issues
|
|
10
|
+
Keywords: bvh,motion capture,kinematics,animation
|
|
11
|
+
Requires-Python: >=3.9
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: numpy>=1.21
|
|
15
|
+
Requires-Dist: matplotlib>=3.7
|
|
16
|
+
Provides-Extra: pandas
|
|
17
|
+
Requires-Dist: pandas>=1.5; extra == "pandas"
|
|
18
|
+
Provides-Extra: dev
|
|
19
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
20
|
+
Requires-Dist: pandas>=1.5; extra == "dev"
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
## UPDATE :
|
|
24
|
+
- 2025-03-26: Added a bone size scaling method.
|
|
25
|
+
- 2025-02-28: Added the possibility to use another skeleton than the one in the bvh file itself. Separated the tutorial into multiple files, for readability, and updated the content.
|
|
26
|
+
- 2025-01-25: Change the parameter "local" in the functions to get spatial coordinates and to plot the bvh. The new parameter is "centered", with three modes:
|
|
27
|
+
- "skeleton": equivalent to previous local = True, root pos always 0, 0, 0:
|
|
28
|
+
- "world": equivalent to previous local = False, root at coordinates as in saved in bvh frames
|
|
29
|
+
- "first": the first frame root position is 0, 0, 0. From there, the skeleton moves in the space normally.
|
|
30
|
+
|
|
31
|
+
# pybvh
|
|
32
|
+
Python library to work with bvh files
|
|
33
|
+
|
|
34
|
+
The main point of this library is a Bvh class, which contains all the necesseray information found in a bvh file.
|
|
35
|
+
Through the use of this object, it is easy to read and write a bvh file, but also to convert it to a Pandas Dataframe, and conversely to transform a Dataframe into a bvh object.
|
|
36
|
+
|
|
37
|
+
See the jupyter file 'tutorial' for example of use.
|
|
38
|
+
|
|
39
|
+
## Installation
|
|
40
|
+
- Stable release from PyPI: `pip install pybvh`
|
|
41
|
+
- With pandas helpers (optional): `pip install "pybvh[pandas]"`
|
|
42
|
+
|
|
43
|
+
## Notes about data and notebooks
|
|
44
|
+
- Example BVH files and tutorial notebooks are **not** bundled in the PyPI package to keep the wheel slim.
|
|
45
|
+
- You can find the sample BVH data and notebooks in the GitHub repository under `bvh_data/` and `tutorials/`.
|
|
46
|
+
|
|
47
|
+
### Curent functionality
|
|
48
|
+
- Bvh class
|
|
49
|
+
- parameters :
|
|
50
|
+
- bvhobject.nodes: a list of all the nodes in the Hierarchy. The nodes are BvhRoot, BvhJoint or BvhNode objects for respectively the root, the joints and the end sites.
|
|
51
|
+
- bvhobject.frames: the rotational data as a 2D numpy array.
|
|
52
|
+
- bvhobject.frame_frequency: the frames frequency as can be found in a bvh file.
|
|
53
|
+
- bvhobject.frame_template: the organized name of each column of the bvhobject.frames.
|
|
54
|
+
- bvhobject.frame_count: the number of frames (=the number of lines of the bvhobject.frames parameter).
|
|
55
|
+
- bvhobject.root: the root of the Hierarchy, aka bvhobject.nodes[0].
|
|
56
|
+
- methods :
|
|
57
|
+
- to_bvh_file(filepath, verbose=True): save a bvh object to a bvh file at the location filepath (str or Path object).
|
|
58
|
+
- get_spatial_coord(frame_num=-1, centered="world"): get the spatial coordinates of every joints for all frames or only one.
|
|
59
|
+
- get_df_constructor(mode = 'euler', centered="world"): get a list of dictionnary that can be transmitted to a pd.Dataframe() constructor to directly obtain a Dataframe. Can construct a DataFrame with euler angles or spatial coordinates.
|
|
60
|
+
- hierarchy_info_as_dict(): get a dictionnary describing the organisation of the Hierarchy in the bvh object.
|
|
61
|
+
- change_skeleton(new_skeleton, inplace=False): copy the nodes offset from the 'new_skeleton' bvh object.
|
|
62
|
+
- scale_skeleton(scale, inplace=False): scale the nodes offset.
|
|
63
|
+
|
|
64
|
+
- read_bvh_file(filepath) : read a .bvh file at the filepath location (str or Path object), and create a Bvh object
|
|
65
|
+
|
|
66
|
+
- df_to_bvh(hier, df) : df is a pandas DataFrame, containing joints rotational data. hier is either a dictionnary describing the hierarchy, or a list of nodes. Will create a bvh object based on those two arguments.
|
|
67
|
+
|
|
68
|
+
- plot.plot_frame(bvh_object, frame) : plot a matplotlib projection3d that shows the frame passed as a parameter.
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
### TODO:
|
|
72
|
+
- making direct changes to rot_channels and pos_channels impossible/regulated. Needs to go through a class method, so that we can also change the frames columns order (and value!) at the same time.
|
|
73
|
+
- class method to transform euler angle directly (different Euler angle order, transformation to rotation matrix etc.)
|
|
74
|
+
- change docstrings to Numpy/Scipy standard
|
pybvh-0.1.0/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
## UPDATE :
|
|
2
|
+
- 2025-03-26: Added a bone size scaling method.
|
|
3
|
+
- 2025-02-28: Added the possibility to use another skeleton than the one in the bvh file itself. Separated the tutorial into multiple files, for readability, and updated the content.
|
|
4
|
+
- 2025-01-25: Change the parameter "local" in the functions to get spatial coordinates and to plot the bvh. The new parameter is "centered", with three modes:
|
|
5
|
+
- "skeleton": equivalent to previous local = True, root pos always 0, 0, 0:
|
|
6
|
+
- "world": equivalent to previous local = False, root at coordinates as in saved in bvh frames
|
|
7
|
+
- "first": the first frame root position is 0, 0, 0. From there, the skeleton moves in the space normally.
|
|
8
|
+
|
|
9
|
+
# pybvh
|
|
10
|
+
Python library to work with bvh files
|
|
11
|
+
|
|
12
|
+
The main point of this library is a Bvh class, which contains all the necesseray information found in a bvh file.
|
|
13
|
+
Through the use of this object, it is easy to read and write a bvh file, but also to convert it to a Pandas Dataframe, and conversely to transform a Dataframe into a bvh object.
|
|
14
|
+
|
|
15
|
+
See the jupyter file 'tutorial' for example of use.
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
- Stable release from PyPI: `pip install pybvh`
|
|
19
|
+
- With pandas helpers (optional): `pip install "pybvh[pandas]"`
|
|
20
|
+
|
|
21
|
+
## Notes about data and notebooks
|
|
22
|
+
- Example BVH files and tutorial notebooks are **not** bundled in the PyPI package to keep the wheel slim.
|
|
23
|
+
- You can find the sample BVH data and notebooks in the GitHub repository under `bvh_data/` and `tutorials/`.
|
|
24
|
+
|
|
25
|
+
### Curent functionality
|
|
26
|
+
- Bvh class
|
|
27
|
+
- parameters :
|
|
28
|
+
- bvhobject.nodes: a list of all the nodes in the Hierarchy. The nodes are BvhRoot, BvhJoint or BvhNode objects for respectively the root, the joints and the end sites.
|
|
29
|
+
- bvhobject.frames: the rotational data as a 2D numpy array.
|
|
30
|
+
- bvhobject.frame_frequency: the frames frequency as can be found in a bvh file.
|
|
31
|
+
- bvhobject.frame_template: the organized name of each column of the bvhobject.frames.
|
|
32
|
+
- bvhobject.frame_count: the number of frames (=the number of lines of the bvhobject.frames parameter).
|
|
33
|
+
- bvhobject.root: the root of the Hierarchy, aka bvhobject.nodes[0].
|
|
34
|
+
- methods :
|
|
35
|
+
- to_bvh_file(filepath, verbose=True): save a bvh object to a bvh file at the location filepath (str or Path object).
|
|
36
|
+
- get_spatial_coord(frame_num=-1, centered="world"): get the spatial coordinates of every joints for all frames or only one.
|
|
37
|
+
- get_df_constructor(mode = 'euler', centered="world"): get a list of dictionnary that can be transmitted to a pd.Dataframe() constructor to directly obtain a Dataframe. Can construct a DataFrame with euler angles or spatial coordinates.
|
|
38
|
+
- hierarchy_info_as_dict(): get a dictionnary describing the organisation of the Hierarchy in the bvh object.
|
|
39
|
+
- change_skeleton(new_skeleton, inplace=False): copy the nodes offset from the 'new_skeleton' bvh object.
|
|
40
|
+
- scale_skeleton(scale, inplace=False): scale the nodes offset.
|
|
41
|
+
|
|
42
|
+
- read_bvh_file(filepath) : read a .bvh file at the filepath location (str or Path object), and create a Bvh object
|
|
43
|
+
|
|
44
|
+
- df_to_bvh(hier, df) : df is a pandas DataFrame, containing joints rotational data. hier is either a dictionnary describing the hierarchy, or a list of nodes. Will create a bvh object based on those two arguments.
|
|
45
|
+
|
|
46
|
+
- plot.plot_frame(bvh_object, frame) : plot a matplotlib projection3d that shows the frame passed as a parameter.
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
### TODO:
|
|
50
|
+
- making direct changes to rot_channels and pos_channels impossible/regulated. Needs to go through a class method, so that we can also change the frames columns order (and value!) at the same time.
|
|
51
|
+
- class method to transform euler angle directly (different Euler angle order, transformation to rotation matrix etc.)
|
|
52
|
+
- change docstrings to Numpy/Scipy standard
|