@ashleysmart/react-native-vision-camera-face-detector
Version:
Frame Processor Plugin to detect faces using MLKit Vision Face Detector for React Native Vision Camera!
18 lines (17 loc) • 535 B
JavaScript
import { VisionCameraProxy } from '@ashleysmart/react-native-vision-camera';
const plugin = VisionCameraProxy.initFrameProcessorPlugin('detectFaces', {});
/**
* Detect faces on frame
*
* @param {DetectFacesType} props Detect faces prop
*/
export function detectFaces({ frame, callback, options }) {
'worklet';
if (!plugin) {
throw new Error('Failed to load Frame Processor Plugin "detectFaces"!');
}
// @ts-ignore
const result = plugin.call(frame, options);
callback?.(result);
return result;
}