mirror of https://github.com/vladmandic/human
added face3d demo
parent
b4c4364953
commit
49a9717b90
|
@ -11,6 +11,7 @@ Repository: **<git+https://github.com/vladmandic/human.git>**
|
|||
|
||||
### **HEAD -> main** 2021/03/29 mandic00@live.com
|
||||
|
||||
- enable buffering
|
||||
- new icons
|
||||
- new serve module and demo structure
|
||||
|
||||
|
|
13
README.md
13
README.md
|
@ -16,8 +16,8 @@
|
|||
JavaScript module using TensorFlow/JS Machine Learning library
|
||||
|
||||
- **Browser**:
|
||||
Compatible with *CPU*, *WebGL*, *WASM* backends
|
||||
Compatible with both desktop and mobile platforms
|
||||
Compatible with *CPU*, *WebGL*, *WASM* backends
|
||||
Compatible with *WebWorker* execution
|
||||
- **NodeJS**:
|
||||
Compatible with both software *tfjs-node* and
|
||||
|
@ -27,9 +27,14 @@ Check out [**Live Demo**](https://vladmandic.github.io/human/demo/index.html) fo
|
|||
|
||||
<br>
|
||||
|
||||
## Demos
|
||||
|
||||
- [**Demo Application**](https://vladmandic.github.io/human/demo/index.html)
|
||||
- [**Face Extraction, Description, Identification and Matching**](https://vladmandic.github.io/human/demo/facematch.html)
|
||||
- [**Face Extraction and 3D Rendering**](https://vladmandic.github.io/human/demo/face3d.html)
|
||||
|
||||
## Project pages
|
||||
|
||||
- [**Live Demo**](https://vladmandic.github.io/human/demo/index.html)
|
||||
- [**Code Repository**](https://github.com/vladmandic/human)
|
||||
- [**NPM Package**](https://www.npmjs.com/package/@vladmandic/human)
|
||||
- [**Issues Tracker**](https://github.com/vladmandic/human/issues)
|
||||
|
@ -98,6 +103,10 @@ As presented in the demo application...
|
|||
|
||||

|
||||
|
||||
**Face3D OpenGL Rendering:**
|
||||
|
||||

|
||||
|
||||
**468-Point Face Mesh Defails:**
|
||||
|
||||

|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
"@vladmandic/pilogger": "^0.2.15",
|
||||
"chokidar": "^3.5.1",
|
||||
"dayjs": "^1.10.4",
|
||||
"esbuild": "^0.11.0",
|
||||
"esbuild": "^0.11.2",
|
||||
"eslint": "^7.23.0",
|
||||
"eslint-config-airbnb-base": "^14.2.1",
|
||||
"eslint-plugin-import": "^2.22.1",
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// @ts-nocheck
|
||||
|
||||
import { log } from '../helpers';
|
||||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
import * as fxImage from './imagefx';
|
||||
|
||||
|
@ -17,6 +16,9 @@ let fx = null;
|
|||
export function process(input, config): { tensor: tf.Tensor, canvas: OffscreenCanvas | HTMLCanvasElement } {
|
||||
let tensor;
|
||||
if (!input) throw new Error('Human: Input is missing');
|
||||
if (!(input instanceof tf.Tensor) && !(input instanceof ImageData) && !(input instanceof ImageBitmap) && !(input instanceof HTMLVideoElement) && !(input instanceof HTMLCanvasElement) && !(input instanceof OffscreenCanvas)) {
|
||||
throw new Error('Human: Input type is not recognized');
|
||||
}
|
||||
if (input instanceof tf.Tensor) {
|
||||
tensor = tf.clone(input);
|
||||
} else {
|
||||
|
@ -36,10 +38,7 @@ export function process(input, config): { tensor: tf.Tensor, canvas: OffscreenCa
|
|||
else if (config.filter.height > 0) targetWidth = originalWidth * (config.filter.height / originalHeight);
|
||||
if (config.filter.height > 0) targetHeight = config.filter.height;
|
||||
else if (config.filter.width > 0) targetHeight = originalHeight * (config.filter.width / originalWidth);
|
||||
if (!targetWidth || !targetHeight) {
|
||||
log('Human: invalid input', input);
|
||||
return { tensor: null, canvas: null };
|
||||
}
|
||||
if (!targetWidth || !targetHeight) throw new Error('Human: Input cannot determine dimension');
|
||||
if (!inCanvas || (inCanvas.width !== targetWidth) || (inCanvas.height !== targetHeight)) {
|
||||
inCanvas = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(targetWidth, targetHeight) : document.createElement('canvas');
|
||||
if (inCanvas.width !== targetWidth) inCanvas.width = targetWidth;
|
||||
|
|
2
wiki
2
wiki
|
@ -1 +1 @@
|
|||
Subproject commit df23c6e6fdd3aedd5da6ee08d90d61983a761e91
|
||||
Subproject commit 8bca078ef07d67c623bd2cb1a207a4bc8d743a60
|
Loading…
Reference in New Issue