mirror of https://github.com/vladmandic/human
rebuild full
parent
649a3a17b5
commit
312f51f07e
|
@ -11,6 +11,7 @@ Repository: **<git+https://github.com/vladmandic/human.git>**
|
||||||
|
|
||||||
### **HEAD -> main** 2021/08/17 mandic00@live.com
|
### **HEAD -> main** 2021/08/17 mandic00@live.com
|
||||||
|
|
||||||
|
- improve face box caching
|
||||||
- strict type checks
|
- strict type checks
|
||||||
- add webgu checks
|
- add webgu checks
|
||||||
- experimental webgpu support
|
- experimental webgpu support
|
||||||
|
|
10
src/face.ts
10
src/face.ts
|
@ -70,7 +70,9 @@ const calculateFaceAngle = (face, imageSize): {
|
||||||
const rotationMatrixToEulerAngle = (r) => {
|
const rotationMatrixToEulerAngle = (r) => {
|
||||||
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
|
||||||
const [r00, r01, r02, r10, r11, r12, r20, r21, r22] = r;
|
const [r00, r01, r02, r10, r11, r12, r20, r21, r22] = r;
|
||||||
let thetaX; let thetaY; let thetaZ;
|
let thetaX: number;
|
||||||
|
let thetaY: number;
|
||||||
|
let thetaZ: number;
|
||||||
if (r10 < 1) { // YZX calculation
|
if (r10 < 1) { // YZX calculation
|
||||||
if (r10 > -1) {
|
if (r10 > -1) {
|
||||||
thetaZ = Math.asin(r10);
|
thetaZ = Math.asin(r10);
|
||||||
|
@ -86,9 +88,9 @@ const calculateFaceAngle = (face, imageSize): {
|
||||||
thetaY = Math.atan2(r21, r22);
|
thetaY = Math.atan2(r21, r22);
|
||||||
thetaX = 0;
|
thetaX = 0;
|
||||||
}
|
}
|
||||||
if (!isNaN(thetaX)) thetaX = 0;
|
if (isNaN(thetaX)) thetaX = 0;
|
||||||
if (!isNaN(thetaY)) thetaY = 0;
|
if (isNaN(thetaY)) thetaY = 0;
|
||||||
if (!isNaN(thetaZ)) thetaZ = 0;
|
if (isNaN(thetaZ)) thetaZ = 0;
|
||||||
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