xphoto_LearningBasedWB
import { xphoto_LearningBasedWB } 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.
More sophisticated learning-based automatic white balance algorithm.
As GrayworldWB, this algorithm works by applying different gains to the input
image channels, but their computation is a bit more involved compared to the
simple gray-world assumption. More details about the algorithm can be found in
[Cheng2015] .
To mask out saturated pixels this function uses only pixels that satisfy the following condition:
\frac{\textrm{max}(R,G,B)}{\texttt{range_max_val}} < \texttt{saturation_thresh}
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.
extractSimpleFeatures
Implements the feature extraction part of the algorithm.
In accordance with [Cheng2015] , computes the following features for the input image:
1. Chromaticity of an average (R,G,B) tuple
2. Chromaticity of the brightest (R,G,B) tuple (while ignoring saturated pixels)
3. Chromaticity of the dominant (R,G,B) tuple (the one that has the highest value in the RGB histogram)
4. Mode of the chromaticity palette, that is constructed by taking 300 most common colors according to
the RGB histogram and projecting them on the chromaticity plane. Mode is the most high-density point
of the palette, which is computed by a straightforward fixed-bandwidth kernel density estimator with
a Epanechnikov kernel function.
extractSimpleFeatures(src: Mat, dst: Mat): void;srcInput three-channel image (BGR color space is assumed).
dstOutput destination, filled by the native operation. An array of four (r,g) chromaticity tuples corresponding to the features listed above.
getRangeMaxVal
Maximum possible value of the input image (e.g. 255 for 8 bit images, 4095 for 12 bit images) See: setRangeMaxVal
getRangeMaxVal(): number;The number result.
setRangeMaxVal
Maximum possible value of the input image (e.g. 255 for 8 bit images, 4095 for 12 bit images) See: setRangeMaxVal See: getRangeMaxVal
setRangeMaxVal(val: number): void;valval argument (number).
getSaturationThreshold
Threshold that is used to determine saturated pixels, i.e. pixels where at least one of the
channels exceeds \texttt{saturation_threshold}\times\texttt{range_max_val} are ignored.
See: setSaturationThreshold
getSaturationThreshold(): number;The number result.
setSaturationThreshold
Threshold that is used to determine saturated pixels, i.e. pixels where at least one of the
channels exceeds \texttt{saturation_threshold}\times\texttt{range_max_val} are ignored.
See: setSaturationThreshold See: getSaturationThreshold
setSaturationThreshold(val: number): void;valval argument (number).
getHistBinNum
Defines the size of one dimension of a three-dimensional RGB histogram that is used internally by the algorithm. It often makes sense to increase the number of bins for images with higher bit depth (e.g. 256 bins for a 12 bit image). See: setHistBinNum
getHistBinNum(): number;The number result.
setHistBinNum
Defines the size of one dimension of a three-dimensional RGB histogram that is used internally by the algorithm. It often makes sense to increase the number of bins for images with higher bit depth (e.g. 256 bins for a 12 bit image). See: setHistBinNum See: getHistBinNum
setHistBinNum(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.