Skip to content

demosaicing

Image processingfunctionOpenCV 5.0.0
import { demosaicing } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

ARGUMENTSsrc, dst, code, dstCn
FUNCTIONdemosaicing
RETURN TYPEvoid
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

main function for all demosaicing processes

Note: The source image (src) must be of an appropriate type for the desired color conversion. see ColorConversionCodes See: cvtColor

demosaicing(src: Mat, dst: Mat, code: number, dstCn: number): void;
2 available overloads
demosaicing(src: Mat, dst: Mat, code: number): void;
demosaicing(src: Mat, dst: Mat, code: number, dstCn: number): void;
src

input image: 8-bit unsigned or 16-bit unsigned.

dst

Output destination, filled by the native operation. output image of the same size and depth as src.

code

Color space conversion code (see the description below).

dstCn

number of channels in the destination image; if the parameter is 0, the number of the channels is derived automatically from src and code.

The function can do the following transformations:

  • Demosaicing using bilinear interpolation

#COLOR_BayerBG2BGR , #COLOR_BayerGB2BGR , #COLOR_BayerRG2BGR , #COLOR_BayerGR2BGR

#COLOR_BayerBG2GRAY , #COLOR_BayerGB2GRAY , #COLOR_BayerRG2GRAY , #COLOR_BayerGR2GRAY

  • Demosaicing using Variable Number of Gradients.

#COLOR_BayerBG2BGR_VNG , #COLOR_BayerGB2BGR_VNG , #COLOR_BayerRG2BGR_VNG , #COLOR_BayerGR2BGR_VNG

  • Edge-Aware Demosaicing.

#COLOR_BayerBG2BGR_EA , #COLOR_BayerGB2BGR_EA , #COLOR_BayerRG2BGR_EA , #COLOR_BayerGR2BGR_EA

  • Demosaicing with alpha channel

#COLOR_BayerBG2BGRA , #COLOR_BayerGB2BGRA , #COLOR_BayerRG2BGRA , #COLOR_BayerGR2BGRA

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.