template<int ROWS, int COLS, int SRC_T, int DST_T, int blockSize, int Ksize, typename K_T>
void hls::Harris( hls::Mat<ROWS, COLS, SRC_T>& src,
                  hls::Mat<ROWS, COLS, DST_T>& dst,
                  K_T k,
                  int threshold );


  • src – the input image.
  • dst – the output mask of detected corners.
  • k – the Harris detector parameter.
  • threshold – the threshold for maximum finding.


This function implements a Harris edge/corner detector. The horizontal and vertical derivatives are estimated using a Ksize*Ksize sobel filter. The local covariance matrix M of the derivatives is smoothed over a blockSize*blockSize neighborhood of each pixel (x, y).
Points where the function:
has a maximum, and is greater than the threshold are marked as corners/edges in the output image.


Only Ksize=3 is supported.

OpenCV reference

cvCornerHarris, cv::cornerHarris