[](https://www.npmjs.com/package/@haseeamarathunga/face-detect) [](https://www.npmjs.com/package
npm install @haseeamarathunga/face-detect

Faces and Iris detection using web-cam
^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0^5.0.0 || ^6.0.0npm install --save ngx-webcam
2) Install ng-open-cv library via standard npm command:
npm install ng-open-cv
3) Install face-detect library via standard npm command:
npm install @haseeamarathunga/face-detect
2) Import the FaceDetectModule into your Angular module:
``typescript`
import {FaceDetectModule} from '@haseeamarathunga/face-detect';
import {NgOpenCVModule, OpenCVOptions} from 'ng-open-cv';
import {WebcamModule} from 'ngx-webcam';
@NgModule({
imports: [
NgOpenCVModule,
WebcamModule,
FaceDetectModule,
...
],
...
})
export class AppModule { }
3) Use the FaceDetectComponent on your pages:
In .html file
`html
`
In .ts file
`typescript
private trigger: Subject
public triggerSnapshot(): void {
this.trigger.next();
}
public get triggerObservable(): Observable
return this.trigger.asObservable();
}
viewChange(event) {
console.log(event);
this.fullFace = event.fullImage;
this.face = event.face;
this.eyeRight = event.eyeRight;
this.eyeLeft = event.eyeLeft;
}
`triggerFace: ObservableOptions and Events
This section describes the basic inputs/outputs of the component. All inputs are optional.$3
* : An Observable to trigger image capturing. When it fires, an image will be captured and emitted (see Outputs).width: number
* : The maximal video width of the webcam live view.height: number
* : The maximal video height of the webcam live view. The actual view will be placed within these boundaries, respecting the aspect ratio of the video stream.
: Whenever an image is captured it return the event object that include fullImage, Face, eyeLeft and eyeRight.`typescript
viewChange(event) {
console.log(event);
this.fullFace = event.fullImage;
this.face = event.face;
this.eyeRight = event.eyeRight;
this.eyeLeft = event.eyeLeft;
}
`Development
Here you can find instructions on how to start developing this library.$3
Run npm run packagr to build the library. The build artifacts will be stored in the dist/ directory.$3
Run npm start to build and run the surrounding webapp with the FaceDetectModule. Essential for live-developing.$3
Run npm run docs to generate the live-demo documentation pages in the docs/ directory.$3
Run npm run test` to run unit-tests.