Filters that depend on adjacent pixels

So far I've made the simplifying assumption that each pixel can be filtered independently of its neighbors. This isn't alawys true. For example a Gaussian blur or a sharpen or unspeckle filter, requires a substantial amount of information about other parts of the image.

When a filter must take into account the values of pixels other than the ones being filtered, it's no longer possible to use the simple RGBFilter class. Instead you have to work directly with java.awt.image.ImageFilter. You must override the two setPixels() methods to implement your filter.

public void setPixels(int x, int y, int w, int h, ColorModel model,
 byte pixels[], int offset, int scan) 
public void setPixels(int x, int y, int w, int h, ColorModel model,
 int pixels[], int offset, int scan) 

Previous | Next | Top
Last Modified April 24, 1998
Copyright 1997, 1998 Elliotte Rusty Harold
elharo@metalab.unc.edu