mirror of https://github.com/vladmandic/human
minor rotation calculation fix
parent
9cdae38de1
commit
957872e5a1
|
@ -9,8 +9,10 @@ Repository: **<git+https://github.com/vladmandic/human.git>**
|
||||||
|
|
||||||
## Changelog
|
## 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
|
- rotationmatrixtoeulerangle, and fixes
|
||||||
- experimental: add efficientpose
|
- experimental: add efficientpose
|
||||||
- implement nanodet
|
- implement nanodet
|
||||||
|
|
|
@ -39,24 +39,18 @@ const calculateFaceAngle = (face, image_size): { angle: { pitch: number, yaw: nu
|
||||||
if (r10 < 1) { // YZX calculation
|
if (r10 < 1) { // YZX calculation
|
||||||
if (r10 > -1) {
|
if (r10 > -1) {
|
||||||
thetaZ = Math.asin(r10);
|
thetaZ = Math.asin(r10);
|
||||||
|
thetaY = Math.atan2(-r20, r00);
|
||||||
thetaX = Math.atan2(-r12, r11);
|
thetaX = Math.atan2(-r12, r11);
|
||||||
} else {
|
} else {
|
||||||
thetaZ = -Math.PI / 2;
|
thetaZ = -Math.PI / 2;
|
||||||
|
thetaY = -Math.atan2(r21, r22);
|
||||||
thetaX = 0;
|
thetaX = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
thetaZ = Math.PI / 2;
|
thetaZ = Math.PI / 2;
|
||||||
|
thetaY = Math.atan2(r21, r22);
|
||||||
thetaX = 0;
|
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 };
|
return { pitch: 2 * -thetaX, yaw: 2 * -thetaY, roll: 2 * -thetaZ };
|
||||||
};
|
};
|
||||||
// simple Euler angle calculation based existing 3D mesh
|
// simple Euler angle calculation based existing 3D mesh
|
||||||
|
|
Loading…
Reference in New Issue