How to create a pixel filter and apply on a raster

Creating a pixel filter and applying it on a raster

A pixel filter is used to transform pixel values. There are many pixel filters available in ArcGIS 9.2. (for example, the pan sharpening filter, convolution filter, remap filter, and so on). To create and apply a pixel filter on a raster, use the following code:
static void PixelFilter(IRaster raster)throws Exception{
    //Create a convolution filter.
    IStockConvolutionFilter filter = new RasterConvolutionFilter();

    //Set it on a raster.
    IPixelOperation pixelOperation = new IPixelOperationProxy(raster);
    pixelOperation.setPixelFilterByRef(new IPixelFilterProxy(filter));

    //Save it.
    ISaveAs saveAs = new ISaveAsProxy(raster);
    saveAs.saveAs("c:\\temp\\image1.img", null, "IMAGINE Image");

Development licensingDeployment licensing
ArcGIS for Desktop BasicArcGIS for Desktop Basic
ArcGIS for Desktop StandardArcGIS for Desktop Standard
ArcGIS for Desktop AdvancedArcGIS for Desktop Advanced
Engine Developer KitEngine