Kernel size is a term used in digital image processing to describe the number of pixels sampled and analysed together as a unit when applying mathematical operations to an image, such as sharpening, blurring, noise reduction, or edge detection. The kernel - sometimes referred to as a convolution matrix or filter matrix - is a small grid of pixels centred on each pixel in the image in turn, and the values of all the pixels within that grid are used together in a mathematical calculation to determine the new value of the central pixel in the processed output.
The size of the kernel is typically described in terms of its dimensions in pixels, expressed as an odd number to ensure that there is always a central pixel around which the surrounding pixels are symmetrically arranged - for example, a 3x3 kernel samples a grid of nine pixels, a 5x5 kernel samples twenty-five pixels, and a 7x7 kernel samples forty-nine pixels. As the kernel size increases, a greater number of surrounding pixels are taken into account in each calculation, which influences the character and intensity of the effect being applied.
In sharpening operations such as unsharp masking, the kernel size determines the radius over which edge contrast is analysed and enhanced. A smaller kernel targets fine, narrow edges and subtle details, while a larger kernel affects broader tonal transitions and more pronounced edges. Similarly, in blurring and noise reduction operations, a larger kernel produces a stronger, more widespread smoothing effect by averaging pixel values across a wider area, while a smaller kernel produces a more localised and subtle result.
Choosing the appropriate kernel size is an important consideration when processing digital images, as it directly affects both the appearance and the quality of the result. In sharpening workflows, selecting a kernel size that is well matched to the resolution of the image and the scale of the detail being enhanced is essential to achieving natural looking results without introducing unwanted artefacts, halos, or an over-processed appearance.