Skip to main content

API Reference

React Native

Add the Rogue Vision SDK and Movement models to to your React Native project.

yarn add @rogue/rogue-vision @rogue/rogue-vision-movements
import { Vision } from '@rogue/rogue-vision'
import { Movements } from '@rogue/rogue-vision-movements'

const { RepCounter } = Vision

Update your application manifest for camera permissions.

Enumerate the available models

<ul style={{ columns: 4 }}>
{Movements.movements.map((movement) => (
<li>
<strong>{movement.name}</strong>
</li>
))}
</ul>

Start the camera and begin with specific models


function App() {
const [repCount, setCount] = useState({
pushups: 0,
cleans: 0
});

const repCounter = useFrameProcessor((frame) => {
'worklet'
try {
RepCounter.process(frame) // non-blocking, runs async
}
catch (e) {
console.log(`Error: ${e.message}`)
}

}, [])

useEffect(() => {
RepCounter.addListener((frameResult) => {
const repEvent = frameResult.repEvent
if (repEvent.event == RepEventType.RepCompleted) {

// increment the rep count for the detected movement
const newRepCount = repCount
newRepcount[repEvent.movement.name] = (repcount[repEvent.moement.name] || 0) + 1
setCount(newRepCount)

// update the pose Display
if (Settings.SHOW_POSE_OVERLAY) updatePose(frameResult.pose)

} else if (repEvent.event == RepEventType.NoRep) {
console.log("No rep")
}
})
}, [])

return (
<Camera
frameProcessor={repCounter}
frameProcessorFPS={30}

{...cameraProps} />
)
}

iOS (Native)

Android (Native)