Skip to content

PoseBTwinPlugin

Plugin controlling a digital twin

PoseBFitPlugin extension for digital twins mirroring the pose and residing beside a user. When rendering a twin we do not translate bones to align with keypoint coordinates and only preserve relative rotations. After projecting the detected pose onto a twin, twin’s scene node can be further transformed relative to the initial position - centers of hips are the same. Under construction, not well tested after changes.

new PoseBTwinPlugin(translation?, rotation?, scale?, tune?): PoseBTwinPlugin

Constructor

Vector3

Relative translation of the twin

Quaternion

Relative rotation of the twin

number

Scale of the twin

PoseTuneParams = ...

Fine-tuning parameters

PoseBTwinPlugin

PoseBFitPlugin.constructor

readonly alignScore: 0.9 = 0.90

Pose score threshold

PoseBFitPlugin.alignScore


readonly alignVisibility: 0.9 = 0.90

Keypoint visibility threshold

PoseBFitPlugin.alignVisibility


protected cameraAngle: number

Camera vertical angle in radians

PoseBFitPlugin.cameraAngle


protected cameraRatio: number

Camera aspect ratio

PoseBFitPlugin.cameraRatio


loaded: boolean

Loaded state

PoseBFitPlugin.loaded


protected optional node: TransformNode

Attached scene node

PoseBFitPlugin.node


protected nodeOrigin: BoneTransform

Origin of node relative to the root bone

PoseBFitPlugin.nodeOrigin


ordinal: number

Ordinal number

PoseBFitPlugin.ordinal


protected optional renderer: Renderer<PoseResult>

Renderer loaded the plugin

PoseBFitPlugin.renderer


protected optional rotation: Quaternion

Relative rotation of the twin


protected optional scale: number

Scale of the twin


protected optional scene: Scene

Reference to a scene instance

PoseBFitPlugin.scene


protected optional skeleton: Skeleton

Reference to model’s skeleton

PoseBFitPlugin.skeleton


protected optional skeletonNodes: SkeletonNodes

Bones of the model’s rig

PoseBFitPlugin.skeletonNodes


protected optional skeletonSizes: SkeletonSizes

Reference sizes of skeleton

PoseBFitPlugin.skeletonSizes


protected optional spineCurve: SpineCurve

Shape of spine

PoseBFitPlugin.spineCurve


protected optional translation: Vector3

Relative translation of the twin


protected tune: PoseTuneParams

Fine-tuning parameters

PoseBFitPlugin.tune

dispose(): void

Dispose video plugin

void

PoseBFitPlugin.dispose


protected estimateBones(pose, spineCurve, skeletonSizes): SkeletonTransforms

Estimate bone positions and axes

Based on detected keypoints estimates bone transformations. Position of bone if defined by 3D point itself, bone length is the distance between keypoints connected by bone. Bone’s rotation is defined by its axes that are evaluated from relative positions of adjacent keypoints. Method returns only bone position and orientation axis, final transformation of any bone can be found using the next bone in hierarchy.

PosePoints

Pose keypoints

SpineCurve

Shape of spine

SkeletonSizes

SkeletonTransforms

Bone transformations

PoseBFitPlugin.estimateBones


load(renderer): Promise<void>

Initialize plugin

Parses and caches the rig/armature of the attached scene node (one provided to plugin’s constructor). Precalculates geometrical parameters of skeleton.

Renderer<PoseResult>

Renderer this plugin is attached to

Promise<void>

Promise resolving when initialization is finished

PoseBFitPlugin.load


setNode(node?): void

Set/attach a scene node

Parses and caches the rig/armature of the node. Precalculates geometrical parameters of skeleton.

TransformNode

Scene node to attach

void

PoseBFitPlugin.setNode


setRotation(rotation?): void

Quaternion

void


setScale(scale?): void

number

void


setTranslation(translation?): void

Vector3

void


setupCamera(ratio, angle): void

Set camera parameters

number

Aspect ration of input video

number

Vertical field of view in radians

void

PoseBFitPlugin.setupCamera


setupVideo(size): void

Set video size

Could be overridden to adjust plugin’s pipeline.

Size

Resolution of input video

void

PoseBFitPlugin.setupVideo


unload(): void

Reset plugin

Clears internal state and frees all resources allocated in load().

void

PoseBFitPlugin.unload


update(result, stream): Promise<void>

Update skeleton of the scene node

Method is extended to set twin’s translation, rotation, and scale relative to estimated pose.

PoseResult

Pose estimation results

HTMLCanvasElement

Captured video frame

Promise<void>

Promise resolving when update is finished

PoseBFitPlugin.update


protected updateArm(bones, points): void

Update arm rig (see update)

Overridden to only rotate bones ignoring positions and relative scalings.

Arm bones and transforms

{ bone: TransformNode; transform: BoneTransform; }

TransformNode

BoneTransform

{ bone: TransformNode; transform: BoneTransform; }

TransformNode

BoneTransform

{ bone: TransformNode; transform: BoneTransform; }

TransformNode

BoneTransform

Arm keypoints

PosePoint

PosePoint

void

PoseBFitPlugin.updateArm


protected updateLeg(bones, points): void

Update leg rig (see update)

Overridden to only rotate bones ignoring positions and relative scalings.

Leg bones and transforms

{ bone: TransformNode; transform: BoneTransform; }

TransformNode

BoneTransform

{ bone: TransformNode; transform: BoneTransform; }

TransformNode

BoneTransform

{ bone: TransformNode; transform: BoneTransform; }

TransformNode

BoneTransform

{ bone: TransformNode; transform: BoneTransform; }

TransformNode

BoneTransform

Leg keypoints

PosePoint

PosePoint

PosePoint

void

PoseBFitPlugin.updateLeg


protected updateSpine(transforms, bones): void

Update spine rig (see update)

Overridden to only rotate bones ignoring positions and relative scalings.

SkeletonTransforms

Estimated transformations

SkeletonNodes

Spine bones

void

PoseBFitPlugin.updateSpine