UNPKG

@vundl/react-native-uvc-camera

Version:
76 lines (56 loc) 2.31 kB
# React Native UVC Camera [![npm version](http://img.shields.io/npm/v/react-native-uvc-camera.svg?style=flat-square)](https://npmjs.org/package/react-native-uvc-camera "View this project on npm") [![npm downloads](http://img.shields.io/npm/dm/react-native-uvc-camera.svg?style=flat-square)](https://npmjs.org/package/react-native-uvc-camera "View this project on npm") [![npm licence](http://img.shields.io/npm/l/react-native-uvc-camera.svg?style=flat-square)](https://npmjs.org/package/react-native-uvc-camera "View this project on npm") [![Platform](https://img.shields.io/badge/platform-android-989898.svg?style=flat-square)](https://npmjs.org/package/react-native-uvc-camera "View this project on npm") A React Native module for UVC camera access with face detection capabilities. ## Installation ```sh npm install react-native-uvc-camera # or yarn add react-native-uvc-camera ``` ## Usage ```javascript import { UVCCamera, FaceDetector } from 'react-native-uvc-camera'; // Using the camera component const App = () => { const handleFacesDetected = ({ faces }) => { console.log('Detected faces:', faces); }; return ( <UVCCamera style={{ flex: 1 }} onFacesDetected={handleFacesDetected} faceDetectionMode={FaceDetector.Constants.Mode.FAST} /> ); }; // Using the face detector const detectFaces = async (imageUri) => { const faces = await FaceDetector.detectFacesAsync(imageUri, { mode: FaceDetector.Constants.Mode.ACCURATE, detectLandmarks: FaceDetector.Constants.Landmarks.ALL, runClassifications: FaceDetector.Constants.Classifications.ALL, }); console.log('Detected faces:', faces); }; ``` ## API Reference ### UVCCamera Component | Prop | Type | Description | |------|------|-------------| | deviceId | string | ID of the camera device to use | | onFacesDetected | function | Callback that is invoked when faces are detected | | faceDetectionMode | string | 'fast' or 'accurate' | | faceDetectionLandmarks | string | 'none' or 'all' | | faceDetectionClassifications | string | 'none' or 'all' | ### FaceDetector Static method to detect faces in an image: ```javascript FaceDetector.detectFacesAsync(uri, options) ``` - `uri`: string - The URI of the image to process - `options`: object - Detection options ## License MIT