Class: Processor<ResultT, ParamsT>
@geenee/armature.Processor
Core generic processor
Processor is a computational core of any application and the most essential part of the Engine in an app's pipeline. Processing results are used by Renderer to update scene. Every processor must define methods to initialize and release instances required for image processing, and evaluation of processing results on provided image (where all logic happens). Processor is a generic abstract class defining common API.
Type parameters
Name | Type | Description |
---|---|---|
ResultT | extends Object = {} | Type of processing results |
ParamsT | extends ProcParams = ProcParams | Type of processor parameters |
Hierarchy
EventEmitterT
<ProcessorEvents
>↳
Processor
Constructors
constructor
• new Processor<ResultT
, ParamsT
>()
Constructor
Type parameters
Name | Type |
---|---|
ResultT | extends Object = {} |
ParamsT | extends ProcParams = ProcParams |
Overrides
Properties
cameraAngle
• cameraAngle: number
Camera vertical angle in radians
cameraRatio
• cameraRatio: number
Camera aspect ratio
optimalSize
• optimalSize: number
= 1024
Recommended maximum size of input
params
• Protected
params: Partial
<ParamsT
> = {}
Processor parameters
videoRatio
• Protected
videoRatio: number
Aspect ratio of input video
videoSize
• Protected
videoSize: Size
Resolution of input video
Methods
addListener
▸ addListener<E
>(event
, listener
): Processor
<ResultT
, ParamsT
>
Adds the listener function to the end of the listeners array
Type parameters
Name | Type |
---|---|
E | extends keyof ProcessorEvents |
Parameters
Name | Type | Description |
---|---|---|
event | E | The name of the event |
listener | ProcessorEvents [E ] | The callback function |
Returns
Processor
<ResultT
, ParamsT
>
This EventEmitter
Inherited from
dispose
▸ dispose(): void
Dispose processor object
Releases resources and instances allocated by processor. Processor object cannot be used after calling dispose(). Overridden by derived classes for particular processing.
Returns
void
emit
▸ emit<E
>(event
, ...args
): boolean
Synchronously calls each of the listeners registered for the event
Type parameters
Name | Type |
---|---|
E | extends keyof ProcessorEvents |
Parameters
Name | Type | Description |
---|---|---|
event | E | The name of the event |
...args | Args <ProcessorEvents [E ]> | Arguments passed to the listeners |
Returns
boolean
True if the event had listeners, False otherwise
Inherited from
eventNames
▸ eventNames(): (string
| symbol
)[]
List of emitter's events
Returns
(string
| symbol
)[]
List of emitter's events
Inherited from
getMaxListeners
▸ getMaxListeners(): number
Maximum number of listeners per event
Returns
number
Maximum number of listeners per event
Inherited from
init
▸ init(params
, size?
, ratio?
): Promise
<boolean
>
Initialize processor
Initializes all resources required for video processing. Overridden by derived classes for particular application.
Parameters
Name | Type | Description |
---|---|---|
params | ParamsT | Processor parameters |
size? | Size | Resolution of input video |
ratio? | number | Aspect ration of input video |
Returns
Promise
<boolean
>
Status of initialization
listenerCount
▸ listenerCount<E
>(event
): number
The number of listeners listening to the event
Type parameters
Name | Type |
---|---|
E | extends keyof ProcessorEvents |
Parameters
Name | Type | Description |
---|---|---|
event | E | The name of the event |
Returns
number
Number of listeners
Inherited from
listeners
▸ listeners<E
>(event
): Function
[]
Copy of the array of listeners for the event
Type parameters
Name | Type |
---|---|
E | extends keyof ProcessorEvents |
Parameters
Name | Type | Description |
---|---|---|
event | E | The name of the event |
Returns
Function
[]
Copy of the listeners array
Inherited from
off
▸ off<E
>(event
, listener
): Processor
<ResultT
, ParamsT
>
Removes the listener from the listener array for the event
Type parameters
Name | Type |
---|---|
E | extends keyof ProcessorEvents |
Parameters
Name | Type | Description |
---|---|---|
event | E | The name of the event |
listener | ProcessorEvents [E ] | The callback function |
Returns
Processor
<ResultT
, ParamsT
>
This EventEmitter
Inherited from
on
▸ on<E
>(event
, listener
): Processor
<ResultT
, ParamsT
>
Adds the listener function to the event
Type parameters
Name | Type |
---|---|
E | extends keyof ProcessorEvents |
Parameters
Name | Type | Description |
---|---|---|
event | E | The name of the event |
listener | ProcessorEvents [E ] | The callback function |
Returns
Processor
<ResultT
, ParamsT
>
This EventEmitter
Inherited from
once
▸ once<E
>(event
, listener
): Processor
<ResultT
, ParamsT
>
Adds a one-time listener function for the event
Type parameters
Name | Type |
---|---|
E | extends keyof ProcessorEvents |
Parameters
Name | Type | Description |
---|---|---|
event | E | The name of the event |
listener | ProcessorEvents [E ] | The callback function |
Returns
Processor
<ResultT
, ParamsT
>
This EventEmitter
Inherited from
prependListener
▸ prependListener<E
>(event
, listener
): Processor
<ResultT
, ParamsT
>
Adds the listener function to the beginning of the listeners array
Type parameters
Name | Type |
---|---|
E | extends keyof ProcessorEvents |
Parameters
Name | Type | Description |
---|---|---|
event | E | The name of the event |
listener | ProcessorEvents [E ] | The callback function |
Returns
Processor
<ResultT
, ParamsT
>
This EventEmitter
Inherited from
prependOnceListener
▸ prependOnceListener<E
>(event
, listener
): Processor
<ResultT
, ParamsT
>
Adds a one-time listener function to the beginning of the listeners array
Type parameters
Name | Type |
---|---|
E | extends keyof ProcessorEvents |
Parameters
Name | Type | Description |
---|---|---|
event | E | The name of the event |
listener | ProcessorEvents [E ] | The callback function |
Returns
Processor
<ResultT
, ParamsT
>
Inherited from
EventEmitterT.prependOnceListener
process
▸ process(input
, timestamp?
): Promise
<undefined
| ResultT
>
Process the image
Main method defining the logic of video processing. Overridden by derived classes for particular application.
Parameters
Name | Type | Description |
---|---|---|
input | ImageInput | Image |
timestamp? | number | Timestamp |
Returns
Promise
<undefined
| ResultT
>
rawListeners
▸ rawListeners<E
>(event
): Function
[]
Copy of the array of listeners for the event including wrappers
Type parameters
Name | Type |
---|---|
E | extends keyof ProcessorEvents |
Parameters
Name | Type | Description |
---|---|---|
event | E | The name of the event |
Returns
Function
[]
Copy of the listeners array
Inherited from
removeAllListeners
▸ removeAllListeners<E
>(event?
): Processor
<ResultT
, ParamsT
>
Removes all listeners, or those of the specified event
Type parameters
Name | Type |
---|---|
E | extends keyof ProcessorEvents |
Parameters
Name | Type | Description |
---|---|---|
event? | E | The name of the event |
Returns
Processor
<ResultT
, ParamsT
>
This EventEmitter
Inherited from
EventEmitterT.removeAllListeners
removeListener
▸ removeListener<E
>(event
, listener
): Processor
<ResultT
, ParamsT
>
Removes the specified listener from the listener array
Type parameters
Name | Type |
---|---|
E | extends keyof ProcessorEvents |
Parameters
Name | Type | Description |
---|---|---|
event | E | The name of the event |
listener | ProcessorEvents [E ] | The callback function |
Returns
Processor
<ResultT
, ParamsT
>
This EventEmitter
Inherited from
reset
▸ reset(): void
Reset processor
Resets all processing instances to the initial state. Overridden by derived classes for particular processing.
Returns
void
setMaxListeners
▸ setMaxListeners(n
): Processor
<ResultT
, ParamsT
>
Sets maximum number of listeners per event
Parameters
Name | Type | Description |
---|---|---|
n | number | Maximum number of listeners |
Returns
Processor
<ResultT
, ParamsT
>
This EventEmitter
Inherited from
setupVideo
▸ setupVideo(size
, ratio?
): void
Set resolution of the input video
Could be overridden to adjust processing pipeline.
Parameters
Name | Type | Description |
---|---|---|
size | Size | Resolution of input video |
ratio? | number | Aspect ration of input video |
Returns
void