At every position the kernel's nine weights multiply the nine pixels beneath it and sum into one output value:
out(r,c) = Σ k(i,j)·img(r+i,c+j) / norm + bias
Averaging weights blur, a strong center with negative neighbours sharpens, and opposite-signed neighbours detect edges. Edge pixels are clamped (nearest-pixel padding).