Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rodgomesc/vision-camera-face-detector
VisionCamera Frame Processor Plugin to detect faces using MLKit Vision Face Detector
https://github.com/rodgomesc/vision-camera-face-detector
Last synced: 4 days ago
JSON representation
VisionCamera Frame Processor Plugin to detect faces using MLKit Vision Face Detector
- Host: GitHub
- URL: https://github.com/rodgomesc/vision-camera-face-detector
- Owner: rodgomesc
- License: mit
- Created: 2021-08-17T13:07:21.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-05-21T03:13:48.000Z (8 months ago)
- Last Synced: 2024-12-25T00:53:01.620Z (11 days ago)
- Language: Java
- Size: 1.65 MB
- Stars: 97
- Watchers: 8
- Forks: 66
- Open Issues: 36
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# vision-camera-face-detector
VisionCamera Frame Processor Plugin to detect faces using MLKit Vision Face Detector
## Installation
```sh
yarn add 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 'vision-camera-face-detector';export default function App() {
const [hasPermission, setHasPermission] = React.useState(false);
const [faces, setFaces] = React.useState();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 ? (
) : null;
}```
## Contributing
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
## License
MIT