CallbackPlugin
Callback plugin
Simple plugin executing provided callback on processing results. Useful when, for example, application needs to show a message when no object is detected in camera’s field of view or pose is not optimal for virtual try on.
Extends
Plugin
<ResultT
>
Extended by
Type Parameters
• ResultT extends object
= object
Constructors
new CallbackPlugin()
new CallbackPlugin<
ResultT
>(callback
):CallbackPlugin
<ResultT
>
Constructor
Parameters
• callback
Callback method
Returns
CallbackPlugin
<ResultT
>
Overrides
Properties
callback()
protected
callback: (r
) =>void
Callback method
Parameters
• r: ResultT
Returns
void
loaded
loaded:
boolean
Loaded state
Inherited from
ordinal
ordinal:
number
Ordinal number
Inherited from
renderer?
protected
optional
renderer:Renderer
<ResultT
>
Renderer loaded the plugin
Inherited from
Methods
dispose()
dispose():
void
Dispose video plugin
Returns
void
Inherited from
load()
load(
renderer
):Promise
<void
>
Initialize plugin
Initializes resources/instances needed by plugin. Overridden by derived classes for particular task.
Parameters
• renderer: Renderer
<ResultT
>
Renderer this plugin is attached to
Returns
Promise
<void
>
Promise resolving when initialization is finished
Inherited from
setupCamera()
setupCamera(
ratio
,angle
):void
Set camera parameters
Could be overridden to adjust plugin’s pipeline.
Parameters
• ratio: number
Aspect ration of input video
• angle: number
Vertical field of view in radians
Returns
void
Inherited from
setupVideo()
setupVideo(
size
):void
Set video size
Could be overridden to adjust plugin’s pipeline.
Parameters
• size: Size
Resolution of input video
Returns
void
Inherited from
unload()
unload():
void
Reset plugin
Releases all resources/instances created in load(). Overridden by derived classes for particular task.
Returns
void
Inherited from
update()
update(
result
,stream
):Promise
<void
>
Update
Override executes the callback on results of video processing.
Parameters
• result: ResultT
Results of video processing
• stream: HTMLCanvasElement
Captured video frame
Returns
Promise
<void
>
Promise resolving when update is finished