JA EN

Kernel

A small numerical matrix used in convolution operations. The kernel's values determine the filter type - blur, edge detection, sharpening, or emboss.

A kernel (also called a filter kernel or convolution matrix) is a small numerical matrix used in image convolution. Typically sized 3×3, 5×5, or 7×7 (odd dimensions), each value defines the weight applied to surrounding pixels. By changing kernel values alone, entirely different effects - blur, sharpen, edge detection, emboss - can be achieved.

Fundamental kernel design principles:

Practical kernel examples:

In code, OpenCV applies custom kernels via cv2.filter2D(img, -1, kernel). Define the kernel as a NumPy array and pass it to the function - creating custom filters requires no specialised libraries beyond basic linear algebra.

In deep learning, kernel values are not hand-designed but learned automatically from training data. Each CNN layer contains dozens to hundreds of kernels: lower layers learn edge and colour detectors, while higher layers recognise object parts and semantic concepts.

Related Terms

Related Articles