User Tools

Site Tools


Surface Blur

A plugin designed for blurring with edge preservation, written by Douglas Cameron.

The technique is similar to several others that have previously been implemented e.g. Selective Gaussian Blur and the Bilateral Filter.

A new value for each pixel is calculated as a weighted average of a subset of the surrounding pixels within a set radius. Two factors are considered with regards to surrounding pixels, RGB difference and the distance from the central pixel. The subset of pixels used is comprised of pixels whose RGB difference is found to be below a set threshold. The weighting assigned to the these pixels is dependent upon the distance from the central pixel.

The following diagram shows a pixel and surrounding pixels within a radius of 2. The pixels surrounded by a pink border are excluded from the calculation due to their RGB difference being above the set threshold.


Variable parameters include:

  • Radius: The radius of surrounding pixels considered.
  • Proximity Weighting: The weighting given to the surrounding pixel relative to the distance.
  • Edge Threshold: The threshold which is used to discriminate between pixels on the near and far side of an edge
  • Iterations: The number of times the blur shall be performed

Below is an example, before and after the application of the surface blur.

Surfaceblur Example Before

Surfaceblur Example After

The calculations involved are relatively simple and can be easily found in the source code.

FilenameFilesizeLast modified
surface_blur.class3.2 KiB2019/04/12 13:17
surface_blur.java2.7 KiB2019/04/12 13:17
surfaceblur_example_after.jpeg119.0 KiB2019/04/12 13:17
surfaceblur_example_before.jpeg124.5 KiB2019/04/12 13:17

Douglas Cameron 2007/08/17 15:32

plugin/filter/surface_blur/start.txt · Last modified: 2019/04/12 13:13 by

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki