Skip to content

preCornerDetect

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

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

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

Calculates a feature map for corner detection.

The function calculates the complex spatial derivative-based function of the source image

\texttt{dst} = (D_x  \texttt{src} )^2  \cdot D_{yy}  \texttt{src} + (D_y  \texttt{src} )^2  \cdot D_{xx}  \texttt{src} - 2 D_x  \texttt{src} \cdot D_y  \texttt{src} \cdot D_{xy}  \texttt{src}

where D_x,D_y are the first image derivatives, D_{xx},D_{yy} are the second image derivatives, and D_{xy} is the mixed derivative.

The corners can be found as local maximums of the functions, as shown below:

    Mat corners, dilated_corners;
    preCornerDetect(image, corners, 3);
    // dilation with 3x3 rectangular structuring element
    dilate(corners, dilated_corners, Mat(), 1);
    Mat corner_mask = corners == dilated_corners;
preCornerDetect(src: Mat, dst: Mat, ksize: number, borderType: number): void;
2 available overloads
preCornerDetect(src: Mat, dst: Mat, ksize: number): void;
preCornerDetect(src: Mat, dst: Mat, ksize: number, borderType: number): void;
src

Source single-channel 8-bit of floating-point image.

dst

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

ksize

%Aperture size of the Sobel .

borderType

Pixel extrapolation method. See #BorderTypes. #BORDER_WRAP is not supported.

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.