0.1.1 • Published 2 years ago
@rangoon/track v0.1.1
RTX AR Tracking SDK
This SDK is intended for implementing AI-powered tracking for WebAR projects by rangoon.tech.
Installation
First, install the library by running the command
npm install @rangoon/trackIf you're using yarn,
yarn add @rangoon/trackHow to use
The usage of @rangoon/track usually involves two steps.
1. Start a video stream
Initialize the SDK by attaching the @rangoon/track's Webcam component to your React Project. 
The Webcam component will start a video stream which will be used for tracking. 
import { Webcam } from "@rangoon/track"
import { useRef } from "react"
function App() {
  const videoRef = useRef<HTMLVideoElement>(null)
  return (
    <div>
      <Webcam videoReference={videoRef}/>
    </div>
  )
}
export default App2. Initiate a tracking model
Currently, @rangoon/track supports three types of tracking models.
- Hand Tracking (Landmarks)
 - Hand Gesture Tracking (Landmarks + Gestures)
 - Face Tracking
 
By calling the Hook associated with the respective model, you can obtain the tracking data.
Below is an example of obtaining hand-tracking data with useHandTracking Hook.
import { Webcam, useHandTracking } from "@rangoon/track"
import { useEffect, useRef } from "react"
function App() {
  const videoRef = useRef<HTMLVideoElement>(null)
  //Initiate the model by passing the webcam reference
  const handData = useHandTracking({
    videoReference: videoRef
  })
  //Watch the data changes with useEffect
  useEffect(() => {
    console.log(handData)
  }, [handData])
  return (
    <div>
      <Webcam videoReference={videoRef}/>
    </div>
  )
}
export default AppFeedback
If you have any feedback, please reach out to us at waing@rangoon.tech