xphoto_GrayworldWB
import { xphoto_GrayworldWB } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Native object: release it with using or delete(). Factories can return null; check before calling methods. Inherits xphoto_WhiteBalancer.
Gray-world white balance algorithm
This algorithm scales the values of pixels based on a gray-world assumption which states that the average of all channels should result in a gray image.
It adds a modification which thresholds pixels based on their saturation value and only uses pixels below the provided threshold in finding average pixel values.
Saturation is calculated using the following for a 3-channel RGB image per pixel I and is in the range [0, 1]:
\texttt{Saturation} [I] = \frac{\textrm{max}(R,G,B) - \textrm{min}(R,G,B)
}{\textrm{max}(R,G,B)}
A threshold of 1 means that all pixels are used to white-balance, while a threshold of 0 means no pixels are used. Lower thresholds are useful in white-balancing saturated images.
Currently supports images of type CV_8UC3 and CV_16UC3.
Constructors and members
clone
Create another handle to the same native object. This retains the object without copying its pixels or algorithm state; dispose both handles separately.
clone(): this;The this result.
getSaturationThreshold
Maximum saturation for a pixel to be included in the gray-world assumption See: setSaturationThreshold
getSaturationThreshold(): number;The number result.
setSaturationThreshold
Maximum saturation for a pixel to be included in the gray-world assumption See: setSaturationThreshold See: getSaturationThreshold
setSaturationThreshold(val: number): void;valval argument (number).
These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.