// Convolution with horizontal differentiation kernel mask
float h = ((src[-srcStride + 1] + src[+1] + src[srcStride + 1]) -
(src[-srcStride - 1] + src[-1] + src[srcStride - 1])) * 0.166666667f;
// Convolution vertical differentiation kernel mask
float v = ((src[+srcStride - 1] + src[+srcStride] + src[+srcStride + 1]) -
(src[-srcStride - 1] + src[-srcStride] + src[-srcStride + 1])) * 0.166666667f;
I need theory for this kind of kernel mask which implemented on harris corner. What kind of kernel mask is that? Is that prewitt or any different kernel? I have difficulty to find a paper which can explain that kernel mask
That is indeed the Prewitt operator.
Following the indexing into
src(the input image), withsrcStridethe number of array elements to skip to address the next neighbor in the y-direciton, one can see thathtakes elements fromsrcin the following order and with the following weights:This corresponds to a convolution with the following kernel (remember that the convolution mirrors the kernel):
This again corresponds the two convolutions
That is, it applies a derivative filter (central difference) horizontally, and a uniform smoothing filter vertically.
Note that the uniform smoothing filter has some very poor qualities (it will flip the sign of some frequency components, and does generally a poor job of smoothing), so it is always better to use Sobel's operator (which uses a triangular smoothing filter) or preferably Gaussian gradients.