@vundl/react-native-uvc-camera
v1.0.0
Published
UVC Camera implementation for React Native
Maintainers
Readme
React Native UVC Camera
A React Native module for UVC camera access with face detection capabilities.
Installation
npm install react-native-uvc-camera
# or
yarn add react-native-uvc-cameraUsage
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:
FaceDetector.detectFacesAsync(uri, options)uri: string - The URI of the image to processoptions: object - Detection options
License
MIT
