Skip to content

RingFitPlugin

Hand plugin fitting a ring

Plugin fitting a ring object on a pose estimated by @geenee/bodyprocessors!HandProcessor. Using tracking data RingFitPlugin estimates the transformation of a ring 3d object fitting it on the selected finger. Plugin supports rings having unit inner diameter and lying in xz plane, with y axis being a center of the ring’s inner circle and x axis pointing in the ring’s head direction. Offset of a ring from world’s origin along y axis defines how far it will be from the phalanx start. See FingersFitPlugin for additional details.

new RingFitPlugin(): RingFitPlugin

Constructor

RingFitPlugin

HandPlugin.constructor

protected finger: "index" | "middle" | "ring" | "pinky" = "ring"

Finger to put ring on


loaded: boolean

Loaded state

HandPlugin.loaded


protected optional node: Object3D<Object3DEventMap>

Attached scene node


ordinal: number

Ordinal number

HandPlugin.ordinal


protected optional renderer: Renderer<HandResult>

Renderer loaded the plugin

HandPlugin.renderer


protected optional scene: Scene

Reference to a scene instance

HandPlugin.scene

dispose(): void

Dispose video plugin

void

HandPlugin.dispose


protected estimateBones(pose, handedness): BoneTransform[]

Estimate phalanxes positions and orientations

Using detected keypoints approximates transformations of phalanxes. Position of a phalanx is defined by 3D point of the corresponding joint. Its length is the distance between keypoints defining the phalanx. Rotation is defined by its axes that are evaluated using kinematic rules and relative positions of adjacent joint keypoints. Method returns phalanx position & orientation in global world frame.

HandPoint[]

Pose keypoints

number

BoneTransform[]

Phalanx transformations


load(renderer): Promise<void>

Initialize plugin

Prepares or modifies the attached node if required. Reference to the scene object is cached and used by plugin on update() and unload(). You need to reload plugin if you want to change scene it’s attached to.

Renderer<HandResult>

Renderer this plugin is attached to

Promise<void>

Promise resolving when initialization is finished

HandPlugin.load


setNode(node?, finger?): void

Set/attach a scene node of a ring

Object3D<Object3DEventMap>

Scene node to attach

"index" | "middle" | "ring" | "pinky"

void


setupCamera(ratio, angle): void

Set camera parameters

Could be overridden to adjust plugin’s pipeline.

number

Aspect ration of input video

number

Vertical field of view in radians

void

HandPlugin.setupCamera


setupVideo(size): void

Set video size

Could be overridden to adjust plugin’s pipeline.

Size

Resolution of input video

void

HandPlugin.setupVideo


unload(): void

Reset plugin

Releases all resources allocated in load(). Deletes cached reference to the scene object.

void

HandPlugin.unload


update(result, stream): Promise<void>

Update pose of the ring’s scene node

Evaluates positions, rotations and scales of selected phalanx based on 3D keypoints and tracking data, then applies these transformations to the attached scene node.

HandResult

Hand estimation results

HTMLCanvasElement

Captured video frame

Promise<void>

Promise resolving when update is finished

HandPlugin.update