minor rotation calculation fix

pull/94/head
Vladimir Mandic 2021-03-28 08:49:56 -04:00
parent a836113aa8
commit 6b516ee72d
14 changed files with 209 additions and 213 deletions

View File

@ -9,8 +9,10 @@ Repository: **<git+https://github.com/vladmandic/human.git>**
## Changelog
### **HEAD -> main** 2021/03/28 animethemegadget@gmail.com
### **HEAD -> main** 2021/03/28 mandic00@live.com
- new face rotation calculations
- cleanup
- rotationmatrixtoeulerangle, and fixes
- experimental: add efficientpose
- implement nanodet

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

112
dist/human.esm.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

112
dist/human.js vendored

File diff suppressed because one or more lines are too long

4
dist/human.js.map vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

12
dist/human.node.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -39,24 +39,18 @@ const calculateFaceAngle = (face, image_size): { angle: { pitch: number, yaw: nu
if (r10 < 1) { // YZX calculation
if (r10 > -1) {
thetaZ = Math.asin(r10);
thetaY = Math.atan2(-r20, r00);
thetaX = Math.atan2(-r12, r11);
} else {
thetaZ = -Math.PI / 2;
thetaY = -Math.atan2(r21, r22);
thetaX = 0;
}
} else {
thetaZ = Math.PI / 2;
thetaY = Math.atan2(r21, r22);
thetaX = 0;
}
if (r02 < 1) { // compensate Y rotation which is not accurate and too small in YZX calculation
if (r02 > -1) {
thetaY = Math.asin(r02);
} else {
thetaY = -Math.PI / 2;
}
} else {
thetaY = Math.PI / 2;
}
return { pitch: 2 * -thetaX, yaw: 2 * -thetaY, roll: 2 * -thetaZ };
};
// simple Euler angle calculation based existing 3D mesh