Skip to main content

effect

Function effect 

Source
pub fn effect() -> Vec<u8> 
Expand description

Applies an implementation of the Kuwahara filter to the given image.

The Kuwahara filter is usually used for noise reduction while retaining image quality, but it can be used for artistic purposes because it makes image look “painted”. It does this by grabbing small squares from an image, dividing it up into four quadrants, then computing the standard brightness deviation for all pixels inside each quadrant. Whichever quadrant has the lowest deviation then gets used in the next step, where the average color from said quadrant is computed and then applied to the current pixel, which is the center where all four quadrants overlap.