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.
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new PoseBTwinPlugin(
translation?
,rotation?
,scale?
,tune?
):PoseBTwinPlugin
Constructor
Parameters
Section titled “Parameters”translation?
Section titled “translation?”Vector3
Relative translation of the twin
rotation?
Section titled “rotation?”Quaternion
Relative rotation of the twin
scale?
Section titled “scale?”number
Scale of the twin
PoseTuneParams
= ...
Fine-tuning parameters
Returns
Section titled “Returns”PoseBTwinPlugin
Overrides
Section titled “Overrides”Properties
Section titled “Properties”alignScore
Section titled “alignScore”
readonly
alignScore:0.9
=0.90
Pose score threshold
Inherited from
Section titled “Inherited from”alignVisibility
Section titled “alignVisibility”
readonly
alignVisibility:0.9
=0.90
Keypoint visibility threshold
Inherited from
Section titled “Inherited from”PoseBFitPlugin
.alignVisibility
cameraAngle
Section titled “cameraAngle”
protected
cameraAngle:number
Camera vertical angle in radians
Inherited from
Section titled “Inherited from”cameraRatio
Section titled “cameraRatio”
protected
cameraRatio:number
Camera aspect ratio
Inherited from
Section titled “Inherited from”loaded
Section titled “loaded”loaded:
boolean
Loaded state
Inherited from
Section titled “Inherited from”
protected
optional
node:TransformNode
Attached scene node
Inherited from
Section titled “Inherited from”nodeOrigin
Section titled “nodeOrigin”
protected
nodeOrigin:BoneTransform
Origin of node relative to the root bone
Inherited from
Section titled “Inherited from”ordinal
Section titled “ordinal”ordinal:
number
Ordinal number
Inherited from
Section titled “Inherited from”renderer?
Section titled “renderer?”
protected
optional
renderer:Renderer
<PoseResult
>
Renderer loaded the plugin
Inherited from
Section titled “Inherited from”rotation?
Section titled “rotation?”
protected
optional
rotation:Quaternion
Relative rotation of the twin
scale?
Section titled “scale?”
protected
optional
scale:number
Scale of the twin
scene?
Section titled “scene?”
protected
optional
scene:Scene
Reference to a scene instance
Inherited from
Section titled “Inherited from”skeleton?
Section titled “skeleton?”
protected
optional
skeleton:Skeleton
Reference to model’s skeleton
Inherited from
Section titled “Inherited from”skeletonNodes?
Section titled “skeletonNodes?”
protected
optional
skeletonNodes:SkeletonNodes
Bones of the model’s rig
Inherited from
Section titled “Inherited from”skeletonSizes?
Section titled “skeletonSizes?”
protected
optional
skeletonSizes:SkeletonSizes
Reference sizes of skeleton
Inherited from
Section titled “Inherited from”spineCurve?
Section titled “spineCurve?”
protected
optional
spineCurve:SpineCurve
Shape of spine
Inherited from
Section titled “Inherited from”translation?
Section titled “translation?”
protected
optional
translation:Vector3
Relative translation of the twin
protected
tune:PoseTuneParams
Fine-tuning parameters
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”dispose()
Section titled “dispose()”dispose():
void
Dispose video plugin
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”estimateBones()
Section titled “estimateBones()”
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.
Parameters
Section titled “Parameters”Pose keypoints
spineCurve
Section titled “spineCurve”SpineCurve
Shape of spine
skeletonSizes
Section titled “skeletonSizes”SkeletonSizes
Returns
Section titled “Returns”Bone transformations
Inherited from
Section titled “Inherited from”load()
Section titled “load()”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.
Parameters
Section titled “Parameters”renderer
Section titled “renderer”Renderer this plugin is attached to
Returns
Section titled “Returns”Promise
<void
>
Promise resolving when initialization is finished
Inherited from
Section titled “Inherited from”setNode()
Section titled “setNode()”setNode(
node?
):void
Set/attach a scene node
Parses and caches the rig/armature of the node. Precalculates geometrical parameters of skeleton.
Parameters
Section titled “Parameters”TransformNode
Scene node to attach
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”setRotation()
Section titled “setRotation()”setRotation(
rotation?
):void
Parameters
Section titled “Parameters”rotation?
Section titled “rotation?”Quaternion
Returns
Section titled “Returns”void
setScale()
Section titled “setScale()”setScale(
scale?
):void
Parameters
Section titled “Parameters”scale?
Section titled “scale?”number
Returns
Section titled “Returns”void
setTranslation()
Section titled “setTranslation()”setTranslation(
translation?
):void
Parameters
Section titled “Parameters”translation?
Section titled “translation?”Vector3
Returns
Section titled “Returns”void
setupCamera()
Section titled “setupCamera()”setupCamera(
ratio
,angle
):void
Set camera parameters
Parameters
Section titled “Parameters”number
Aspect ration of input video
number
Vertical field of view in radians
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”setupVideo()
Section titled “setupVideo()”setupVideo(
size
):void
Set video size
Could be overridden to adjust plugin’s pipeline.
Parameters
Section titled “Parameters”Resolution of input video
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”unload()
Section titled “unload()”unload():
void
Reset plugin
Clears internal state and frees all resources allocated in load().
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”update()
Section titled “update()”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.
Parameters
Section titled “Parameters”result
Section titled “result”Pose estimation results
stream
Section titled “stream”HTMLCanvasElement
Captured video frame
Returns
Section titled “Returns”Promise
<void
>
Promise resolving when update is finished
Overrides
Section titled “Overrides”updateArm()
Section titled “updateArm()”
protected
updateArm(bones
,points
):void
Update arm rig (see update)
Overridden to only rotate bones ignoring positions and relative scalings.
Parameters
Section titled “Parameters”Arm bones and transforms
{ bone
: TransformNode
; transform
: BoneTransform
; }
arm.bone
Section titled “arm.bone”TransformNode
arm.transform
Section titled “arm.transform”forearm
Section titled “forearm”{ bone
: TransformNode
; transform
: BoneTransform
; }
forearm.bone
Section titled “forearm.bone”TransformNode
forearm.transform
Section titled “forearm.transform”{ bone
: TransformNode
; transform
: BoneTransform
; }
hand.bone
Section titled “hand.bone”TransformNode
hand.transform
Section titled “hand.transform”points
Section titled “points”Arm keypoints
shoulder
Section titled “shoulder”Returns
Section titled “Returns”void
Overrides
Section titled “Overrides”updateLeg()
Section titled “updateLeg()”
protected
updateLeg(bones
,points
):void
Update leg rig (see update)
Overridden to only rotate bones ignoring positions and relative scalings.
Parameters
Section titled “Parameters”Leg bones and transforms
{ bone
: TransformNode
; transform
: BoneTransform
; }
foot.bone
Section titled “foot.bone”TransformNode
foot.transform
Section titled “foot.transform”{ bone
: TransformNode
; transform
: BoneTransform
; }
leg.bone
Section titled “leg.bone”TransformNode
leg.transform
Section titled “leg.transform”{ bone
: TransformNode
; transform
: BoneTransform
; }
toe.bone
Section titled “toe.bone”TransformNode
toe.transform
Section titled “toe.transform”{ bone
: TransformNode
; transform
: BoneTransform
; }
upleg.bone
Section titled “upleg.bone”TransformNode
upleg.transform
Section titled “upleg.transform”points
Section titled “points”Leg keypoints
Returns
Section titled “Returns”void
Overrides
Section titled “Overrides”updateSpine()
Section titled “updateSpine()”
protected
updateSpine(transforms
,bones
):void
Update spine rig (see update)
Overridden to only rotate bones ignoring positions and relative scalings.
Parameters
Section titled “Parameters”transforms
Section titled “transforms”Estimated transformations
Spine bones
Returns
Section titled “Returns”void