Skip to content

textureFlattening

Computational photographyfunctionOpenCV 5.0.0
import { textureFlattening } from '@banou/opencv-wasm'

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

By retaining only the gradients at edge locations, before integrating with the Poisson solver, one washes out the texture of the selected region, giving its contents a flat aspect. Here Canny Edge %Detector is used.

Note: The algorithm assumes that the color of the source image is close to that of the destination. This assumption means that when the colors don't match, the source image color gets tinted toward the color of the destination image.

textureFlattening(src: Mat, mask: Mat, dst: Mat, low_threshold: number, high_threshold: number, kernel_size: number): void;
4 available overloads
textureFlattening(src: Mat, mask: Mat, dst: Mat): void;
textureFlattening(src: Mat, mask: Mat, dst: Mat, low_threshold: number): void;
textureFlattening(src: Mat, mask: Mat, dst: Mat, low_threshold: number, high_threshold: number): void;
textureFlattening(src: Mat, mask: Mat, dst: Mat, low_threshold: number, high_threshold: number, kernel_size: number): void;
src

Input 8-bit 3-channel image.

mask

Input 8-bit 1 or 3-channel image.

dst

Output destination, filled by the native operation. Output image with the same size and type as src.

low_threshold

%Range from 0 to 100.

high_threshold

Value > 100.

kernel_size

The size of the Sobel kernel to be used.

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.