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
Section titled “Extends”Plugin
<any
>
Extended by
Section titled “Extended by”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new BrightnessPlugin(
callback?
,rangeMax?
,rangeMin?
,filterParams?
):BrightnessPlugin
Constructor
Parameters
Section titled “Parameters”callback?
Section titled “callback?”(brightness
) => void
Method when brightness has changed
rangeMax?
Section titled “rangeMax?”number
= 0.5
Maximum brightness, range scales to [min..1.0]
rangeMin?
Section titled “rangeMin?”number
= 0.1
Minimum brightness, range scales to [min..1.0]
filterParams?
Section titled “filterParams?”FilterParams
= ...
Parameters of reactive low-pass filter
Returns
Section titled “Returns”BrightnessPlugin
Overrides
Section titled “Overrides”Properties
Section titled “Properties”callback()?
Section titled “callback()?”
protected
optional
callback: (brightness
) =>void
Method when brightness has changed
Parameters
Section titled “Parameters”brightness
Section titled “brightness”number
Returns
Section titled “Returns”void
filterParams
Section titled “filterParams”
protected
filterParams:FilterParams
Parameters of reactive low-pass filter
loaded
Section titled “loaded”loaded:
boolean
Loaded state
Inherited from
Section titled “Inherited from”ordinal
Section titled “ordinal”ordinal:
number
Ordinal number
Inherited from
Section titled “Inherited from”rangeMax
Section titled “rangeMax”
protected
rangeMax:number
=0.5
Maximum brightness, range scales to [min..1.0]
rangeMin
Section titled “rangeMin”
protected
rangeMin:number
=0.1
Minimum brightness, range scales to [min..1.0]
renderer?
Section titled “renderer?”
protected
optional
renderer:Renderer
<any
>
Renderer loaded the plugin
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”load()
Section titled “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
Section titled “Parameters”renderer
Section titled “renderer”Renderer
<any
>
Renderer this plugin is attached to
Returns
Section titled “Returns”Promise
<void
>
Promise resolving when initialization is finished
Overrides
Section titled “Overrides”setCallback()
Section titled “setCallback()”setCallback(
callback
):void
Set brightness change callback
Parameters
Section titled “Parameters”callback
Section titled “callback”Method when brightness has changed
undefined
| (brightness
) => void
Returns
Section titled “Returns”void
setupCamera()
Section titled “setupCamera()”setupCamera(
ratio
,angle
):void
Set camera parameters
Could be overridden to adjust plugin’s pipeline.
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
):boolean
Set video size
Resize multilevel texture
Parameters
Section titled “Parameters”Resolution of input video
Returns
Section titled “Returns”boolean
Overrides
Section titled “Overrides”unload()
Section titled “unload()”unload():
void
Reset plugin
Releases all resources and instances created in load().
Returns
Section titled “Returns”void
Overrides
Section titled “Overrides”update()
Section titled “update()”update(
result
,stream
):Promise
<void
>
Update
Plugin estimates current brightness and calls provided callback.
Parameters
Section titled “Parameters”result
Section titled “result”any
Results of video processing
stream
Section titled “stream”HTMLCanvasElement
Captured video frame
Returns
Section titled “Returns”Promise
<void
>
Promise resolving when update is finished