Kuwahara Lab implements the Kuwahara filter — an edge-preserving smoothing algorithm that produces a distinctive painterly, oil-painting-like appearance. Unlike Gaussian blur which smooths everything uniformly, the Kuwahara filter selects the smoothest local region around each pixel, preserving sharp edges while flattening areas of low detail.
The classic Kuwahara algorithm divides each pixel's neighborhood into four overlapping quadrants, computes the mean and variance of each, and outputs the mean of the quadrant with lowest variance. This creates the characteristic flat color regions bounded by crisp edges that give images an artistic, hand-painted quality.
The implementation includes both the classic square-kernel Kuwahara and the generalized anisotropic variant that aligns filter sectors with local image structure for smoother, more natural results. Interactive controls allow adjustment of kernel radius, sector count, and sharpness parameter.