react-native-vision-camera-face-detector
Version:
Frame Processor Plugin to detect faces using MLKit Vision Face Detector for React Native Vision Camera!
32 lines (29 loc) • 759 B
JavaScript
;
import { useMemo } from 'react';
import { createFaceDetector } from '../factory';
// types
/**
* Use a {@linkcode FaceDetector}.
*
* A {@linkcode FaceDetector} can be used to detect
* {@linkcode Face}s in a {@linkcode Frame} in a Frame
* Processor.
*
* @example
* ```ts
* const FaceDetector = useFaceDetector({...})
* const frameOutput = useFrameOutput({
* onFrame(frame) {
* 'worklet'
* const faces = FaceDetector.detectFaces(frame)
* console.log(`Detected ${faces.length} faces!`)
* frame.dispose()
* }
* })
* ```
*/
export function useFaceDetector(options) {
return useMemo(() => createFaceDetector(options), [options]);
}
export default useFaceDetector;
//# sourceMappingURL=useFaceDetector.js.map