BrightnessPlugin
Brightness estimation plugin
Plugin estimates parameters of lighting (brightness) observed in the current image and calls the provided callback with these parameters. This plugin can be used for automatic adjustment of intensities of lights on the scene, for example in callback user can scale intensity properties of lights and environment map according to estimated brightness. One can set output range, estimated value will not go below the minimum and [min..max] range will be scaled to [min..1.0]. Adaptive low pass smoothing is applied to the result.
Extends
Plugin
<any
>
Extended by
Constructors
new BrightnessPlugin()
new BrightnessPlugin(
callback
?,rangeMax
?,rangeMin
?,filterParams
?):BrightnessPlugin
Constructor
Parameters
• callback?
Method when brightness has changed
• rangeMax?: number
= 0.5
Maximum brightness, range scales to [min..1.0]
• rangeMin?: number
= 0.1
Minimum brightness, range scales to [min..1.0]
• filterParams?: FilterParams
= ...
Parameters of reactive low-pass filter
Returns
Overrides
Properties
callback()?
protected
optional
callback: (brightness
) =>void
Method when brightness has changed
Parameters
• brightness: number
Returns
void
filterParams
protected
filterParams:FilterParams
Parameters of reactive low-pass filter
loaded
loaded:
boolean
Loaded state
Inherited from
ordinal
ordinal:
number
Ordinal number
Inherited from
rangeMax
protected
rangeMax:number
=0.5
Maximum brightness, range scales to [min..1.0]
rangeMin
protected
rangeMin:number
=0.1
Minimum brightness, range scales to [min..1.0]
renderer?
protected
optional
renderer:Renderer
<any
>
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 for the brightness estimation. Acquires webgl context of the main ShaderRenderer, allocates multilevel texture for the input image.
Parameters
• renderer: Renderer
<any
>
Renderer this plugin is attached to
Returns
Promise
<void
>
Promise resolving when initialization is finished
Overrides
setCallback()
setCallback(
callback
):void
Set brightness change callback
Parameters
• callback: undefined
| (brightness
) => void
Method when brightness has changed
Returns
void
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
):boolean
Set video size
Resize multilevel texture
Parameters
• size: Size
Resolution of input video
Returns
boolean
Overrides
unload()
unload():
void
Reset plugin
Releases all resources and instances created in load().
Returns
void
Overrides
update()
update(
result
,stream
):Promise
<void
>
Update
Plugin estimates current brightness and calls provided callback.
Parameters
• result: any
Results of video processing
• stream: HTMLCanvasElement
Captured video frame
Returns
Promise
<void
>
Promise resolving when update is finished