capacitor-face-detect
v0.0.5
Published
A plugin that can detect faces for mobile devices using BlazeFace of Google AI Edge.
Downloads
641
Readme
capacitor-face-detect
Your simple, lightweighted plugin that can detect faces for mobile devices using BlazeFace of Google AI Edge.
Update
It seems like I made a mistake, Mediapipe Solutions which is the model source provider, only support for Cocoapods on iOS. So I have changed to using Cocoapods instead. On android the plugin works fine, though. If you are using my plugin, please update to the latest version doing:
npm install capacitor-face-detect@latest
npx cap sync iosIf the Podfile does not generate for some reason, try:
cd ios/your-app-name
pod init
npx cap sync ios
pod installRemember always open the project in .xcworkspace
Install
To use npm
npm install capacitor-face-detectTo use yarn
yarn add capacitor-face-detectSync native files
npx cap syncExample
const result = await
FaceDetect.detect({
path: image.path,
minDetectionConfidence: 0.5,
});API
detect(...)
detect(options: DetectOptions) => Promise<DetectResult>Phát hiện khuôn mặt trong một ảnh tĩnh.
| Param | Type |
| ------------- | ------------------------------------------------------- |
| options | DetectOptions |
Returns: Promise<DetectResult>
Since: 0.0.1
Interfaces
DetectResult
| Prop | Type |
| --------------------- | --------------------------- |
| faces | DetectedFace[] |
| imageWidth | number |
| imageHeight | number |
| inferenceTimeMs | number |
DetectedFace
| Prop | Type | Description |
| --------------- | --------------------------------------------------------------------- | ------------------------------------------------------------------------------------ |
| box | { x: number; y: number; width: number; height: number; } | Toạ độ chuẩn hoá 0..1 theo kích thước ảnh |
| score | number | |
| keypoints | { x: number; y: number; }[] | 6 điểm, toạ độ 0..1: mắt phải, mắt trái, chóp mũi, miệng, tragion phải, tragion trái |
DetectOptions
| Prop | Type | Description |
| ---------------------------- | ------------------- | ------------------------------------------------------------------ |
| path | string | Đường dẫn file ảnh trên thiết bị (photo.path từ @capacitor/camera) |
| minDetectionConfidence | number | Ngưỡng tin cậy tối thiểu, mặc định 0.5 |
