ISIS Application Documentation
kernfilter | Standard View | TOC | Home |
Filter a cube through a kernel
Description
Categories
Groups
Examples
History
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.
Name | Description |
---|---|
FROM | Input cube to be filtered |
TO | Output cube |
KERNEL | The kernel that describes the filter to be applied |
Use this parameter to select the filename. All bands within the file will be filtered.
Type | cube |
---|---|
File Mode | input |
Filter | *.cub |
This file will contain the results of the filter
Type | cube |
---|---|
File Mode | output |
Pixel Type | real |
Filter | *.cub |
Use this parameter to select the file to be used as the kernel. The input kernel is by default found in the "kernels" directory and includes several examples that can be used to filter images.
Type | filename |
---|---|
File Mode | input |
Default Path | $ISISROOT/appdata/templates/kernels/ |
Filter | *.txt |
Using the highpassCircle5x5.txt kernel
0 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 24 -1 -1 x .04 -1 -1 -1 -1 -1 0 -1 -1 -1 0Thus, the highpass filter is simulated. The center pixel will be multiplied by 24. Then this value will be added to the values of its surrounding pixels (all of these values will either have a sign change since they were multiplied by -1 in this filter or they will be 0, since 0 and -1 are the only weight values that the filter holds, except for the center pixel). Finally, after all of the addition has been done, the final sum of all of the weights that were multiplied by either 24, or -1, or 0, will be multiplied by .04, which equals 1/25. The reason all of the pixels are multiplied by 1/25 is that there are 25 spots in the 5 by 5 kernel, and thus the image will be normalized.
Example GUI Screenshot of the GUI with parameters set to simulate the highpass filter with a 5 x 5 circular boxcar. |
Input image before kernfilter.
Parameter Name:
FROM This is the unfiltered image. Note the low frequency data (albedo) in the image. The highpass filter that this kernel mimics is intended to filter this type of data out. |
Output image after kernfilter
Parameter Name:
TO The filtered image. Just as an actual 5 x 5 circular highpass filter would do, this kernel has removed albedo, allowing the user to see more terrain. Since a 5x5 filter is considered relatively small, features which are considered relatively small will still be visible. |
Using the smoothPyramid5x5.txt kernel
1 2 3 2 1 2 4 6 4 2 3 6 9 6 3 x 1/81 2 4 6 4 2 1 2 3 2 1The pixels in the boxcar are assigned weights that inversely reflect their distance from the center of the boxcar. The pixel at the very center will be multiplied by 9 and then added to all of the values that were multiplied by the other weights in the boxcar. Note that all of the weights add up to 81. This is why the final output is divided by 81; it allows the center pixel to be an average of the weights. Thus, the blur appears as though a smoothing algorithm applying weight in a pyramidal fashion had been applied.
Example GUI Screenshot of the GUI with parameters set to perform the smoothing filter with a 5 x 5 boxcar. |
Input image before kernfilter.
Parameter Name:
FROM This is the image as it was taken originally with no smoothing. |
Output image after kernfilter
Parameter Name:
TO The image after the filter. Although possibly hard to detect, everything about the pictures is a little blurred, and smoother, than in the original. A larger filter size would further increase this effect. |
Using the derivativeNWtoSE2x2.txt kernel
1 0 0 -1 x 1.0The top left pixel receives the value of itself minus the pixel down right of itself. The other two pixesl do not matter. Anywhere where is significant change from the top left to the bottom right then shows it with brighter or darker pixels than the surrounding gray where there was little difference and the DNs are at or close to zero.
Example GUI Screenshot of the GUI with parameters set to perform the derivative from NW to SE with a 2x2 boxcar. |
Input image before kernfilter.
Parameter Name:
FROM This is the image as it was taken originally. |
Output image after kernfilter
Parameter Name:
TO The processed image now appears to have a light source in the northwest and shadows and bright spots in areas of significant contrast in the original. |
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. |