ISIS Application Documentation
kernfilter | Printer Friendly View | TOC | Home |
Filter a cube through a kernel
Overview | Parameters | Example 1 | Example 2 | Example 3 |
Parameter GroupsFiles
|
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 |
Example 1Using the highpassCircle5x5.txt kernel Description
This example assumes that a kernel named "highpassCircle5x5.txt" (which
is provided with the program) exists in the "kernels" file that is
created by default. The program does not actually run a highpass
algorithm on the cube. Instead, it weighs the pixels with a common
algorithm that adds all of the weighted pixel values together and
outputs that sum as the center pixel of the boxcar. The weights, which
are provided by the user-specified parameter "kernel" define the
characteristics of that final sum. In this example, the kernel
"highpassCircle5x5.txt" (which is provided with the program) is
selected. The kernel weights are as follows:
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. Command Line
kernfilter
from= peaks.cub to=highpass.cub kernel=highpassCircle5x5.txt
The kernfilter program has been loaded with a kernel that will
simulate a circular highpass filter with a 5 x 5 boxcar.
GUI Screenshot
Input Image
Output Image
|
Example 2Using the smoothPyramid5x5.txt kernel Description
This example assumes that a kernel named "smoothPyramid5x5.txt" (which
is provided with the program) exists in the "kernels" file that is created
by default. The program simulates a smoothing algorithm that takes an
average of the DNs in the boxcar. The kernel weights pixels that are
nearest to the center higher than those at the edges of the boxcar.
The kernel weights are as follows
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. Command Line
kernfilter
from= peaks.cub to=smooth.cub
kernel=smoothPyramid5x5.txt
This example has loaded the smoothPyramid5x5.txt kernel, which will
smooth the input image using weights that are dispersed in a pyramidal
fashion. The boxcar is 5 x 5.
GUI Screenshot
Input Image
Output Image
|
Example 3Using the derivativeNWtoSE2x2.txt kernel Description
This example assumes that a kernel named "derivativeNWtoSE2x2.txt"
(which is provided with the program) exists in the "kernels" file that
is created by default. This program serves the purpose of bringing out
areas of high contrast. It does so by finding the difference of 2 pixels
on a diagonal from each other. The weights are as follows
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. Command Line
kernfilter
from=peaks.cub to=derivative.cub kernel=derivativeNWtoSE2x2.txt
The kernfilter program has been loaded with a kernel that will find
the difference between 2 diagonal pixels.
GUI Screenshot
Input Image
Output Image
|