luicfrr / react-native-vision-camera-face-detector

Vision Camera Frame Processor Plugin to detect faces using MLKit Face Detector
https://www.npmjs.com/package/react-native-vision-camera-face-detector
MIT License
77 stars 15 forks source link

Original 'Frame' #14

Closed YuriOlepir closed 4 months ago

YuriOlepir commented 4 months ago

Hi, is it possible to get the original 'frame: Frame' from the frameProcessor?

luicfrr commented 4 months ago

Wich method are you using? Recommended or default?

YuriOlepir commented 4 months ago

Wich method are you using? Recommended or default?

I'm using your method 'faceDetectionCallback'. The native 'frameProcessor' method is not working because it's reassigned by 'cameraFrameProcessor' inside your Camera component.

I'm working on the simple ID scanning, so I need to track face and text, that's why I need the original Frame. I made small changes inside your detectFaces function, so now I have the original Frame. it would be good to include this in your next releases.

node_modules/react-native-vision-camera-face-detector/src/FaceDetector.ts

`export function detectFaces( frame: Frame, callback: CallbackType, options?: FaceDetectionOptions ) { 'worklet' if ( plugin == null ) { throw new Error( 'Failed to load Frame Processor Plugin "detectFaces"!' ) }

// @ts-ignore const result = {...plugin.call( frame, options ), originalFrame: frame} as DetectionResult callback( result ) } `

luicfrr commented 4 months ago

@YuriOlepir sure, I’ll add this feat in next release.

In some of my tests I had a problem on ios (there’s an open issue on vision camera about this).

In my case the whole camera freeze after a few frame processor call but this happens only if I try to access any of the original frame data.

I would suggest you to comment on the original vision camera issue to let them know that more people are suffering with this problem.