Skip to content

Canny

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

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

imgproc_filter

example: samples/cpp/snippets/edge.cpp This program demonstrates usage of the Canny edge detector

Check tutorial_canny_detector "the corresponding tutorial" for more details Finds edges in an image using the Canny algorithm [Canny86] .

The function finds edges in the input image and marks them in the output map edges using the Canny algorithm. The smallest value between threshold1 and threshold2 is used for edge linking. The largest value is used to find initial segments of strong edges. See https://en.wikipedia.org/wiki/Canny_edge_detector

Canny(image: Mat, edges: Mat, threshold1: number, threshold2: number, apertureSize: number, L2gradient: boolean): void;
3 available overloads
Canny(image: Mat, edges: Mat, threshold1: number, threshold2: number): void;
Canny(image: Mat, edges: Mat, threshold1: number, threshold2: number, apertureSize: number): void;
Canny(image: Mat, edges: Mat, threshold1: number, threshold2: number, apertureSize: number, L2gradient: boolean): void;
image

8-bit input image.

edges

Output destination, filled by the native operation. output edge map; single channels 8-bit image, which has the same size as image .

threshold1

first threshold for the hysteresis procedure.

threshold2

second threshold for the hysteresis procedure.

apertureSize

aperture size for the Sobel operator.

L2gradient

a flag, indicating whether a more accurate L_2 norm =\sqrt{(dI/dx)^2 + (dI/dy)^2} should be used to calculate the image gradient magnitude ( L2gradient=true ), or whether the default L_1 norm =|dI/dx|+|dI/dy| is enough ( L2gradient=false ).

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.