Function: useFrameProcessor()
useFrameProcessor(
frameProcessor
,dependencies
):ReadonlyFrameProcessor
Returns a memoized Frame Processor function wich you can pass to the <Camera>
.
(See "Frame Processors")
Make sure to add the 'worklet'
directive to the top of the Frame Processor function, otherwise it will not get compiled into a worklet.
Parameters​
• frameProcessor
The Frame Processor
• dependencies: DependencyList
The React dependencies which will be copied into the VisionCamera JS-Runtime.
Returns​
The memoized Frame Processor.
Worklet​
Example​
const frameProcessor = useFrameProcessor((frame) => {
'worklet'
const faces = scanFaces(frame)
console.log(`Faces: ${faces}`)
}, [])
Defined in​
hooks/useFrameProcessor.ts:42