mirror of https://github.com/vladmandic/human
34 lines
1.4 KiB
TypeScript
34 lines
1.4 KiB
TypeScript
export const partNames = [
|
|
'nose', 'leftEye', 'rightEye', 'leftEar', 'rightEar', 'leftShoulder',
|
|
'rightShoulder', 'leftElbow', 'rightElbow', 'leftWrist', 'rightWrist',
|
|
'leftHip', 'rightHip', 'leftKnee', 'rightKnee', 'leftAnkle', 'rightAnkle',
|
|
];
|
|
|
|
export const count = partNames.length; // 17 keypoints
|
|
|
|
export const partIds = partNames.reduce((result, jointName, i) => {
|
|
result[jointName] = i;
|
|
return result;
|
|
}, {});
|
|
|
|
const connectedPartNames = [
|
|
['leftHip', 'leftShoulder'], ['leftElbow', 'leftShoulder'],
|
|
['leftElbow', 'leftWrist'], ['leftHip', 'leftKnee'],
|
|
['leftKnee', 'leftAnkle'], ['rightHip', 'rightShoulder'],
|
|
['rightElbow', 'rightShoulder'], ['rightElbow', 'rightWrist'],
|
|
['rightHip', 'rightKnee'], ['rightKnee', 'rightAnkle'],
|
|
['leftShoulder', 'rightShoulder'], ['leftHip', 'rightHip'],
|
|
];
|
|
export const connectedPartIndices = connectedPartNames.map(([jointNameA, jointNameB]) => ([partIds[jointNameA], partIds[jointNameB]]));
|
|
|
|
export const poseChain = [
|
|
['nose', 'leftEye'], ['leftEye', 'leftEar'], ['nose', 'rightEye'],
|
|
['rightEye', 'rightEar'], ['nose', 'leftShoulder'],
|
|
['leftShoulder', 'leftElbow'], ['leftElbow', 'leftWrist'],
|
|
['leftShoulder', 'leftHip'], ['leftHip', 'leftKnee'],
|
|
['leftKnee', 'leftAnkle'], ['nose', 'rightShoulder'],
|
|
['rightShoulder', 'rightElbow'], ['rightElbow', 'rightWrist'],
|
|
['rightShoulder', 'rightHip'], ['rightHip', 'rightKnee'],
|
|
['rightKnee', 'rightAnkle'],
|
|
];
|