Skip to content

Instantly share code, notes, and snippets.

@walkoncross
walkoncross / mount_ntfs_drive_on_macos.sh
Last active December 8, 2022 21:09
mount writable NTFS drive on MacOS
# list all drive and find the one you want to mount with the following cmd
# diskutil list
export mount_dir=/Volumes/ntfs_drive
export disk_dir=/dev/disk4s1
# try to unmount
echo "Try to umount ${disk_dir}"
umount ${disk_dir}
@walkoncross
walkoncross / install_mayavi_on_mac_m1.md
Last active July 25, 2023 14:05
How to install mayavi on MacBook Pro M1
@walkoncross
walkoncross / transform_matrix_in_blender.txt
Last active August 9, 2021 15:18
Different transform matrices in blender: Object matrix_basis/matrix_local/matrix_world/matrix_parent_inverse; Bone matrix/matrix_local; PoseBone matrix/matrix_local/matrix_channel;
# Different transform matrices in blender
Object matrix_basis/matrix_local/matrix_world/matrix_parent_inverse; Bone matrix/matrix_local; PoseBone matrix/matrix_local/matrix_channel;
## 1. Object matrix
"""
Refer to:
https://docs.blender.org/api/current/bpy.types.Object.html?highlight=object#bpy.types.Object
"""
从smplx轴角到bvh文件
from scipy.spatial.transform import Rotation as R
r = R.from_rotvec(np.pi/2 * np.array([0, 0, 1]))
euler = r.as_euler(‘ZYX’, degrees=True) # 大写表示intrinsic rotation
write_order_string = ‘Zrotation Yrotation Xrotation’
write_euler_string = ‘ ’.join([str(euler[I] for I in range(3)]
@walkoncross
walkoncross / bvh文件里的旋转顺序.txt
Created August 4, 2021 21:02
Bvh文件里的旋转顺序(rotation order)用的是intrinsic rotation
Bvh文件里的旋转顺序(rotation order)
Bvh内的旋转用的是intrinsic rotation,举例:
Bvh文件里面的旋转顺序如果是“Zrotation Xrotation Yrotation”,说明是先绕Z转,然后绕“一次旋转后“、“新的”X轴转,然后绕“两次旋转后“、“新的”Y轴转。因为intrinsic rotation跟extrinsic rotation有“逆序等价”的关系,并且extrinsic rotation三次旋转的旋转矩阵可以直接连乘,所以整体的旋转:
v_rot = M_whole * v_ori
M_whole = M_z * M_x * M_y * v_ori
从以下两个bvh的介绍文档里面可以推理出上述结论:
1. Biovision BVH
https://research.cs.wisc.edu/graphics/Courses/cs-838-1999/Jeff/BVH.html
@walkoncross
walkoncross / blender_euler_vs_scipy_rotaion_euler.py
Created August 4, 2021 19:43
rotmat_scipy_extrinsic_xyz = rotmat_blender_euler_XYZ
# author: zhaoyafei0210@gmail.com
# date: Aug 04, 2021
import numpy as np
from scipy.spatial.transform import Rotation as R
import mathutils
import math
xyz_deg = np.array([45, 30, 60])
xyz_rad = np.deg2rad(xyz_deg)

How to visualize the body part segmentation?

This script lets you to visualize the body part segmentation labels of SMPL, SMPL-H, and SMPL-X body models. Follow the instructions to be able to run this script.

Instructions

  1. Download the body models you would like to visualize.
  2. Install the requirements
  3. Run python visualize_body_part_segmentation.py <body_model> <body_model_path>
@walkoncross
walkoncross / Mixamo.js
Created August 6, 2020 18:27 — forked from gnuton/Mixamo.js
Script which downloads all mixamo animations for one character.
// Mixamo Animation downloadeer
// The following script make use of mixamo2 API to download all anims for a single character that you choose.
// The animations are saved with descriptive long names instead of the short ones used by default by mixamo UI.
//
// This script has been written by gnuton@gnuton.org and the author is not responsible of its usage
//
// How to use this script
// 1. Browse mixamo.com
// 2. Log in
// 3. Open JS console (F12 on chrome)