Skip to content

cornerHarris

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

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

Harris corner detector.

The function runs the Harris corner detector on the image. Similarly to cornerMinEigenVal and cornerEigenValsAndVecs , for each pixel (x, y) it calculates a 2\times2 gradient covariance matrix M^{(x,y)} over a \texttt{blockSize} \times \texttt{blockSize} neighborhood. Then, it computes the following characteristic:

\texttt{dst} (x,y) =  \mathrm{det} M^{(x,y)} - k  \cdot \left ( \mathrm{tr} M^{(x,y)} \right )^2

Corners in the image can be found as the local maxima of this response map.

cornerHarris(src: Mat, dst: Mat, blockSize: number, ksize: number, k: number, borderType: number): void;
2 available overloads
cornerHarris(src: Mat, dst: Mat, blockSize: number, ksize: number, k: number): void;
cornerHarris(src: Mat, dst: Mat, blockSize: number, ksize: number, k: number, borderType: number): void;
src

Input single-channel 8-bit or floating-point image.

dst

Output destination, filled by the native operation. Image to store the Harris detector responses. It has the type CV_32FC1 and the same size as src .

blockSize

Neighborhood size (see the details on #cornerEigenValsAndVecs ).

ksize

Aperture parameter for the Sobel operator.

k

Harris detector free parameter. See the formula above.

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.