# @buiducnhat/vision-camera-face-detector

> VisionCamera Frame Processor Plugin to detect faces using MLKit Vision Face Detector, forked from https://github.com/rodgomesc/vision-camera-face-detector

Latest version **0.2.6** (published 2023-07-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install @buiducnhat/vision-camera-face-detector
pnpm add @buiducnhat/vision-camera-face-detector
yarn add @buiducnhat/vision-camera-face-detector
bun add @buiducnhat/vision-camera-face-detector
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.6 |
| Published | 2023-07-02 |
| First published | 2023-06-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 122.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Bùi Đức Nhật |
| Maintainers | buiducnhat |
| Keywords | react-native, ios, android |

## Links

- npm: https://www.npmjs.com/package/@buiducnhat/vision-camera-face-detector
- Repository: https://github.com/buiducnhat/vision-camera-face-detector
- Homepage: https://github.com/buiducnhat/vision-camera-face-detector#readme
- Issues: https://github.com/buiducnhat/vision-camera-face-detector/issues
- npm.io page: https://npm.io/package/@buiducnhat/vision-camera-face-detector

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.2.6 (latest) — 2023-07-02
- 0.2.5 — 2023-06-29
- 0.2.4 — 2023-06-23
- 0.2.3 — 2023-06-22
- 0.2.2 — 2023-06-22
- 0.2.1 — 2023-06-22
- 0.2.0 — 2023-06-22

## README

# @buiducnhat/vision-camera-face-detector

VisionCamera Frame Processor Plugin to detect faces using MLKit Vision Face Detector forked from [bglgwyng/vision-camera-face-detector](https://github.com/bglgwyng/vision-camera-face-detector) - the orignal: [rodgomesc/vision-camera-face-detector](https://github.com/rodgomesc/vision-camera-face-detector)

## Installation

```sh
yarn add @buiducnhat/vision-camera-face-detector
```

## Usage

```js
import * as React from 'react';
import { runOnJS } from 'react-native-reanimated';

import { StyleSheet } from 'react-native';
import {
  useCameraDevices,
  useFrameProcessor,
} from 'react-native-vision-camera';

import { Camera } from 'react-native-vision-camera';
import { scanFaces, Face } from '@buiducnhat/vision-camera-face-detector';

export default function App() {
  const [hasPermission, setHasPermission] = React.useState(false);
  const [faces, setFaces] = React.useState<Face[]>();

  const devices = useCameraDevices();
  const device = devices.front;

  React.useEffect(() => {
    console.log(faces);
  }, [faces]);

  React.useEffect(() => {
    (async () => {
      const status = await Camera.requestCameraPermission();
      setHasPermission(status === 'authorized');
    })();
  }, []);

  const frameProcessor = useFrameProcessor((frame) => {
    'worklet';
    const scannedFaces = scanFaces(frame);
    runOnJS(setFaces)(scannedFaces);
  }, []);

  return device != null && hasPermission ? (
    <Camera
      style={StyleSheet.absoluteFill}
      device={device}
      isActive={true}
      frameProcessor={frameProcessor}
      frameProcessorFps={5}
    />
  ) : null;
}

```

## Contributing

See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.

## License

MIT

---
_Source: https://npm.io/package/@buiducnhat/vision-camera-face-detector · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
