kernfilter
Filter a cube through a kernel
This program uses a kernel gathered from an input file to filter a cube.
The intent of the program is to allow a flexible, user-defined kernel to
be applied to an image. This program is not recommended for cubes with
significant numbers of special pixels as it will create more special pixels.
A group of pre-made kernels has been provided, but the procedure to
create a custom kernel is outlined below.
A kernel follows
the rules and regulations of the Isis PVL (parameter value language). This
means that several keywords must be inserted into the text document which
will become the custom kernel. Any text editor should allow you to create a
kernel, though the program will only read files with the .txt extension. In
addition, there are some specifications that must be met. A sample
kernel file will appear in the form
Group=Kernel Samples=2 Lines=1 Weight=1 Data= (1, -1) EndGroupThe "group" keyword should equal Kernel (Group=Kernel). This lets the program know that it is the users intent that the text file is used as a kernel. The "lines" and "samples" keywords should match the amount of data that is supplied in the data keyword. In this example, there are 2 samples worth of data and 1 line worth. The keywords above thus reflect these values. The "weight" is applied to all of the values in the kernel. It is often set to a fraction that allows for averaging, but it is a value that is used differently by each type of filter simulated by the kernel. Since the above filter uses no averaging, the weight is simply 1. The "data" defines a set of multiplicative constants. These multiplicative constants are the weights that the kernfilter will use on the input image. In our example, assume that the DNs being examined are 10 and 20. The first DN (10) would be multiplied by the first weight (1). The second DN (20) would be multiplied by the second weight (-1). The two products (10 and -20) would then be added together and the resultant sum (-10) would be output. The set of data should be enclosed in parentheses. For organizational purposes, one may insert as much or as little white space as they desire but they must separate each constant with a comma. Finally, the document should be finished with the keyword "EndGroup" to signify that no more information is provided.
Categories
History
Drew Davidson | 2004-07-26 | Original version |
Drew Davidson | 2004-07-27 | Added application test |
Drew Davidson | 2004-08-16 | Added examples |
Elizabeth Miller | 2006-07-24 | Moved kernel files to the $base/templates/kernels folder |
Mackenzie Boyd | 2009-07-27 | Added error checking for kernel input, modified special pixel handling to null resultant pixel, added example, added application test, changed pixel type to real. |