document body segmentation

master
Vladimir Mandic 2021-06-05 17:51:18 -04:00
parent c9408224d8
commit 9e92e5eec1
2 changed files with 13 additions and 5 deletions

@ -174,8 +174,11 @@ const config: Config = {
}, },
segmentation: { segmentation: {
enabled: false, // if segmentation is enabled, output result.canvas will be augmented enabled: false, // controlls and configures all body segmentation module
// with masked image containing only person output // removes background from input containing person
// if segmentation is enabled it will run as preprocessing task before any other model
// alternatively leave it disabled and use it on-demand using human.segmentation method which can
// remove background or replace it with user-provided background
modelPath: 'selfie.json', // experimental: object detection model, can be absolute path or relative to modelBasePath modelPath: 'selfie.json', // experimental: object detection model, can be absolute path or relative to modelBasePath
// can be 'selfie' or 'meet' // can be 'selfie' or 'meet'
}, },

@ -61,6 +61,7 @@ Example that performs single detection and then draws new interpolated result at
human.image(image, config?) // runs image processing without detection and returns canvas human.image(image, config?) // runs image processing without detection and returns canvas
human.warmup(config, image? // warms up human library for faster initial execution after loading human.warmup(config, image? // warms up human library for faster initial execution after loading
// if image is not provided, it will generate internal sample // if image is not provided, it will generate internal sample
human.models // dynamically maintained list of object of any loaded models
human.tf // instance of tfjs used by human human.tf // instance of tfjs used by human
``` ```
@ -77,11 +78,15 @@ For details, see [embedding documentation](https://github.com/vladmandic/human/w
human.enhance(face) // returns enhanced tensor of a previously detected face that can be used for visualizations human.enhance(face) // returns enhanced tensor of a previously detected face that can be used for visualizations
``` ```
Internal list of modules and objects used by current instance of `Human`: ## Input Segmentation and Backgroun Removal or Replacement
`Human` library can attempt to detect outlines of people in provided input and either remove background from input
or replace it with a user-provided background image
```js ```js
human.models // dynamically maintained list of object of any loaded models const inputCanvas = document.getElementById('my-canvas);
human.classes // dynamically maintained list of classes that perform detection on each model const replacementBackground = document.getElementById('my-background);
human.segmentation(inputCanvas, replacementBackground);
``` ```
## Draw Functions ## Draw Functions