RSGISLib Image Filter Module¶
Contains image filtering functionality for rsgislib
Tiled (Multi Processing Core) Filtering¶
-
rsgislib.imagefilter.tiledfilter.
performTiledImgFilter
(inputImg, outputImg, filterInst, dataType=None, gdalformat='KEA', tmpDIR='tmp', width=2000, height=2000, nCores=- 1)¶ This function will perform a filtering of an input image where the input image will be tiled and the tiles executed on multiple processing cores. This function is primarily of use for larger images or when using very large filter windows otherwise the over head of tiling and mosaicking are not worth it.
- Parameters
inputImg – is the file name and path for the input image file.
outputImg – is the file name and path for the output image file.
filterInst – is an instance of a filter class available within rsgislib.imagefilter.tiledfilter.
datatype – is the output image data type (e.g., rsgislib.TYPE_32FLOAT; Default is None). If None then data type of input image is used.
gdalformat – string with the GDAL image format for the output image (Default = KEA). NOTE. KEA is used as intermediate format internally and therefore needs to be available.
tmpDIR – the temporary directory where intermediate files will be written (default is ‘tmp’). Directory will be created and deleted if does not exist.
width – int for width of the image tiles used for processing (Default = 2000).
height – int for height of the image tiles used for processing (Default = 2000).
nCores – is an int specifying the number of cores to be used for clumping processing.
Example:
import rsgislib from rsgislib.imagefilter import tiledfilter from rsgislib import imageutils inputImage = 'LandsatImg.kea' outputImage = 'LandsatImgMedianFilter.kea' medianFilter = tiledfilter.RSGISMedianFilter(7, "KEA", rsgislib.TYPE_16UINT) tiledfilter.performTiledImgFilter(inputImage, outputImage, medianFilter, width=2000, height=2000) imageutils.popImageStats(outputImage, usenodataval=False, nodataval=0, calcpyramids=True)
-
rsgislib.imagefilter.tiledfilter.
performTiledImgMultiFilter
(inputImg, outputImgs, filterInsts, dataType=None, gdalformat='KEA', tmpDIR='tmp', width=2000, height=2000, nCores=- 1)¶ This function will perform the filtering using multiple filters of an input image where the input image will be tiled and the tiles executed on multiple processing cores. This function is primarily of use for larger images or when using very large filter windows otherwise the over head of tiling and mosaicking are not worth it.
- Parameters
inputImg – is the file name and path for the input image file.
outputImgs – is a list of file names and paths for the output image files - Note, must be the same length as filterInsts.
filterInsts – is a list of filter instances of the classes available within rsgislib.imagefilter.tiledfilter - Note, must be the same length as filterInsts.
datatype – is the output image data type (e.g., rsgislib.TYPE_32FLOAT; Default is None). If None then data type of input image is used.
gdalformat – string with the GDAL image format for the output image (Default = KEA). NOTE. KEA is used as intermediate format internally and therefore needs to be available.
tmpDIR – the temporary directory where intermediate files will be written (default is ‘tmp’). Directory will be created and deleted if does not exist.
width – int for width of the image tiles used for processing (Default = 2000).
height – int for height of the image tiles used for processing (Default = 2000).
nCores – is an int specifying the number of cores to be used for clumping processing.
Example:
import rsgislib from rsgislib.imagefilter import tiledfilter from rsgislib import imageutils inputImage = 'LandsatImg.kea' outputImages = ['LandsatImgMedianFilter.kea', 'LandsatImgNormVarFilter.kea'] filters = [tiledfilter.RSGISMedianFilter(7, "KEA", rsgislib.TYPE_16UINT), tiledfilter.RSGISNormVarFilter(7, "KEA", rsgisUtils.getRSGISLibDataTypeFromImg(inputImage))] tiledfilter.performTiledImgMultiFilter(inputImage, outputImages, filters, width=2000, height=2000) imageutils.popImageStats(outputImage, usenodataval=False, nodataval=0, calcpyramids=True)
-
class
rsgislib.imagefilter.tiledfilter.
RSGISAbstractFilter
¶ Abstract class for filter defining the interface to be used within the performTiledImgFilter function. Must define:
- Parameters
self.filterSize – size of the image filter (must be an odd number)
self.gdalformat – the output image file format
self.dataType – the output image data type (e.g., rsgislib.TYPE_16UINT)
-
abstract
applyFilter
(inputimage, outputImage)¶ Abstract function through which the input image is filtered to produce the output image.
- Parameters
inputimage – is the name and path of the input image.
outputimage – is the name and path of the output image.
-
getFilterHSize
()¶ return the hald size of the image filter (i.e., (filterSize-1)/2)
-
getFilterSize
()¶ return the size of the image filter
Smoothing Filters¶
-
rsgislib.imagefilter.
applyMedianFilter
(inputimage, outputImage, filterSize, gdalformat, datatype)¶ Apply a median filter to the specified input image.
Where:
- Parameters
inputImage – string specifying the input image to be filtered.
outputImage – string specifying the output image file..
filterSize – int specfiying the size of the image filter (must be an odd number, i.e., 3, 5, 7, etc).
gdalformat – string specifying the output image format (e.g., KEA).
datatype – Specifying the output image pixel data type (e.g., rsgislib.TYPE_32FLOAT).
Example:
import rsgislib from rsgislib import imagefilter inputImage = 'jers1palsar_stack.kea' outImgFile = 'jers1palsar_stack_median3.kea' imagefilter.applyMedianFilter(inputImage, outImgFile, 3, "KEA", rsgislib.TYPE_32FLOAT)
-
class
rsgislib.imagefilter.tiledfilter.
RSGISMedianFilter
(filterSize, gdalformat, dataType)¶ A class to apply a median filter
-
rsgislib.imagefilter.
applyMeanFilter
(inputimage, outputImage, filterSize, gdalformat, datatype)¶ Apply a mean filter to the specified input image.
Where:
- Parameters
inputImage – string specifying the input image to be filtered.
outputImage – string specifying the output image file..
filterSize – int specfiying the size of the image filter (must be an odd number, i.e., 3, 5, 7, etc).
gdalformat – string specifying the output image format (e.g., KEA).
datatype – Specifying the output image pixel data type (e.g., rsgislib.TYPE_32FLOAT).
Example:
import rsgislib from rsgislib import imagefilter inputImage = 'jers1palsar_stack.kea' outImgFile = 'jers1palsar_stack_mean3.kea' imagefilter.applyMeanFilter(inputImage, outImgFile, 3, "KEA", rsgislib.TYPE_32FLOAT)
-
class
rsgislib.imagefilter.tiledfilter.
RSGISMeanFilter
(filterSize, gdalformat, dataType)¶ A class to apply a mean filter
-
rsgislib.imagefilter.
applyGaussianSmoothFilter
(inputimage, outputImage, filterSize, stddevX, stddevY, filterAngle, gdalformat, datatype)¶ Apply a Gaussian smoothing filter to the specified input image.
Where:
- Parameters
inputImage – string specifying the input image to be filtered.
outputImage – string specifying the output image file..
filterSize – int specfiying the size of the image filter (must be an odd number, i.e., 3, 5, 7, etc).
gdalformat – string specifying the output image format (e.g., KEA).
datatype – Specifying the output image pixel data type (e.g., rsgislib.TYPE_32FLOAT).
Example:
import rsgislib from rsgislib import imagefilter inputImage = 'jers1palsar_stack.kea' outImgFile = 'jers1palsar_stack_gausmooth.kea' imagefilter.applyGaussianSmoothFilter(inputImage, outImgFile, 3, 1.0, 1.0. 0.0, "KEA", rsgislib.TYPE_32FLOAT)
-
class
rsgislib.imagefilter.tiledfilter.
RSGISGaussianSmoothFilter
(filterSize, stddevX, stddevY, filterAngle, gdalformat, dataType)¶ A class to apply a Gaussian smoothing filter
Edge Filters¶
-
rsgislib.imagefilter.
applySobelFilter
(inputimage, outputImage, gdalformat, datatype)¶ Apply a sobel filter to the specified input image.
Where:
- Parameters
inputImage – string specifying the input image to be filtered.
outputImage – string specifying the output image file..
gdalformat – string specifying the output image format (e.g., KEA).
datatype – Specifying the output image pixel data type (e.g., rsgislib.TYPE_32FLOAT).
Example:
import rsgislib from rsgislib import imagefilter inputImage = 'jers1palsar_stack.kea' outImgFile = 'jers1palsar_stack_sobel.kea' imagefilter.applySobelFilter(inputImage, outImgFile, "KEA", rsgislib.TYPE_32FLOAT)
-
class
rsgislib.imagefilter.tiledfilter.
RSGISSobelFilter
(gdalformat, dataType)¶ A class to apply a sobel filter
-
rsgislib.imagefilter.
applySobelXFilter
(inputimage, outputImage, gdalformat, datatype)¶ Apply a sobel filter in X axis to the specified input image.
Where:
- Parameters
inputImage – string specifying the input image to be filtered.
outputImage – string specifying the output image file..
gdalformat – string specifying the output image format (e.g., KEA).
datatype – Specifying the output image pixel data type (e.g., rsgislib.TYPE_32FLOAT).
Example:
import rsgislib from rsgislib import imagefilter inputImage = 'jers1palsar_stack.kea' outImgFile = 'jers1palsar_stack_sobelx.kea' imagefilter.applySobelXFilter(inputImage, outImgFile, "KEA", rsgislib.TYPE_32FLOAT)
-
class
rsgislib.imagefilter.tiledfilter.
RSGISSobelXFilter
(gdalformat, dataType)¶ A class to apply a sobel X filter
-
rsgislib.imagefilter.
applySobelYFilter
(inputimage, outputImage, gdalformat, datatype)¶ Apply a sobel filter in Y axis to the specified input image.
Where:
- Parameters
inputImage – string specifying the input image to be filtered.
outputImage – string specifying the output image file..
gdalformat – string specifying the output image format (e.g., KEA).
datatype – Specifying the output image pixel data type (e.g., rsgislib.TYPE_32FLOAT).
Example:
import rsgislib from rsgislib import imagefilter inputImage = 'jers1palsar_stack.kea' outImgFile = 'jers1palsar_stack_sobely.kea' imagefilter.applySobelYFilter(inputImage, outImgFile, "KEA", rsgislib.TYPE_32FLOAT)
-
class
rsgislib.imagefilter.tiledfilter.
RSGISSobelYFilter
(gdalformat, dataType)¶ A class to apply a sobel Y filter
-
rsgislib.imagefilter.
applyPrewittFilter
(inputimage, outputImage, gdalformat, datatype)¶ Apply a Prewitt filter to the specified input image.
Where:
- Parameters
inputImage – string specifying the input image to be filtered.
outputImage – string specifying the output image file..
gdalformat – string specifying the output image format (e.g., KEA).
datatype – Specifying the output image pixel data type (e.g., rsgislib.TYPE_32FLOAT).
Example:
import rsgislib from rsgislib import imagefilter inputImage = 'jers1palsar_stack.kea' outImgFile = 'jers1palsar_stack_prewitt.kea' imagefilter.applyPrewittFilter(inputImage, outImgFile, "KEA", rsgislib.TYPE_32FLOAT)
-
class
rsgislib.imagefilter.tiledfilter.
RSGISPrewittFilter
(gdalformat, dataType)¶ A class to apply a Prewitt filter
-
rsgislib.imagefilter.
applyPrewittXFilter
(inputimage, outputImage, gdalformat, datatype)¶ Apply a Prewitt filter in X axis to the specified input image.
Where:
- Parameters
inputImage – string specifying the input image to be filtered.
outputImage – string specifying the output image file..
gdalformat – string specifying the output image format (e.g., KEA).
datatype – Specifying the output image pixel data type (e.g., rsgislib.TYPE_32FLOAT).
Example:
import rsgislib from rsgislib import imagefilter inputImage = 'jers1palsar_stack.kea' outImgFile = 'jers1palsar_stack_prewitt.kea' imagefilter.applyPrewittXFilter(inputImage, outImgFile, "KEA", rsgislib.TYPE_32FLOAT)
-
class
rsgislib.imagefilter.tiledfilter.
RSGISPrewittXFilter
(gdalformat, dataType)¶ A class to apply a Prewitt X filter
-
rsgislib.imagefilter.
applyPrewittYFilter
(inputimage, outputImage, gdalformat, datatype)¶ Apply a Prewitt filter in Y axis to the specified input image.
Where:
- Parameters
inputImage – string specifying the input image to be filtered.
outputImage – string specifying the output image file..
gdalformat – string specifying the output image format (e.g., KEA).
datatype – Specifying the output image pixel data type (e.g., rsgislib.TYPE_32FLOAT).
Example:
import rsgislib from rsgislib import imagefilter inputImage = 'jers1palsar_stack.kea' outImgFile = 'jers1palsar_stack_prewitt.kea' imagefilter.applyPrewittYFilter(inputImage, outImgFile, "KEA", rsgislib.TYPE_32FLOAT)
-
class
rsgislib.imagefilter.tiledfilter.
RSGISPrewittYFilter
(gdalformat, dataType)¶ A class to apply a Prewitt Y filter
-
rsgislib.imagefilter.
applyGaussian1stDerivFilter
(inputimage, outputImage, filterSize, stddevX, stddevY, filterAngle, gdalformat, datatype)¶ Apply a Gaussian first derivative filter to the specified input image.
Where:
- Parameters
inputImage – string specifying the input image to be filtered.
outputImage – string specifying the output image file..
filterSize – int specfiying the size of the image filter (must be an odd number, i.e., 3, 5, 7, etc).
gdalformat – string specifying the output image format (e.g., KEA).
datatype – Specifying the output image pixel data type (e.g., rsgislib.TYPE_32FLOAT).
Example:
import rsgislib from rsgislib import imagefilter inputImage = 'jers1palsar_stack.kea' outImgFile = 'jers1palsar_stack_gau1st.kea' imagefilter.applyGaussian1stDerivFilter(inputImage, outImgFile, 3, 1.0, 1.0. 0.0, "KEA", rsgislib.TYPE_32FLOAT)
-
class
rsgislib.imagefilter.tiledfilter.
RSGISGaussian1stDerivFilter
(filterSize, stddevX, stddevY, filterAngle, gdalformat, dataType)¶ A class to apply a Gaussian first derivative filter
-
rsgislib.imagefilter.
applyGaussian2ndDerivFilter
(inputimage, outputImage, filterSize, stddevX, stddevY, filterAngle, gdalformat, datatype)¶ Apply a Gaussian second derivative filter to the specified input image.
Where:
- Parameters
inputImage – string specifying the input image to be filtered.
outputImage – string specifying the output image file..
filterSize – int specfiying the size of the image filter (must be an odd number, i.e., 3, 5, 7, etc).
gdalformat – string specifying the output image format (e.g., KEA).
datatype – Specifying the output image pixel data type (e.g., rsgislib.TYPE_32FLOAT).
Example:
import rsgislib from rsgislib import imagefilter inputImage = 'jers1palsar_stack.kea' outImgFile = 'jers1palsar_stack_gau1st.kea' imagefilter.applyGaussian2ndDerivFilter(inputImage, outImgFile, 3, 1.0, 1.0. 0.0, "KEA", rsgislib.TYPE_32FLOAT)
-
class
rsgislib.imagefilter.tiledfilter.
RSGISGaussian2ndDerivFilter
(filterSize, stddevX, stddevY, filterAngle, gdalformat, dataType)¶ A class to apply a Gaussian second derivative filter
-
rsgislib.imagefilter.
applyLaplacianFilter
(inputimage, outputImage, filterSize, stddev, gdalformat, datatype)¶ Apply a Laplacian filter to the specified input image.
Where:
- Parameters
inputImage – string specifying the input image to be filtered.
outputImage – string specifying the output image file..
filterSize – int specfiying the size of the image filter (must be an odd number, i.e., 3, 5, 7, etc).
gdalformat – string specifying the output image format (e.g., KEA).
datatype – Specifying the output image pixel data type (e.g., rsgislib.TYPE_32FLOAT).
Example:
import rsgislib from rsgislib import imagefilter inputImage = 'jers1palsar_stack.kea' outImgFile = 'jers1palsar_stack_laplacian.kea' imagefilter.applyLaplacianFilter(inputImage, outImgFile, 3, 1.0, "KEA", rsgislib.TYPE_32FLOAT)
-
class
rsgislib.imagefilter.tiledfilter.
RSGISLaplacianFilter
(filterSize, stddev, gdalformat, dataType)¶ A class to apply a Laplacian filter
SAR Filters¶
-
rsgislib.imagefilter.
applyLeeFilter
(inputimage, outputImage, filterSize, nLooks, gdalformat, datatype)¶ Apply a Lee SAR filter to the specified input image.
Where:
- Parameters
inputImage – string specifying the input image to be filtered.
outputImage – string specifying the output image file..
filterSize – int specfiying the size of the image filter (must be an odd number, i.e., 3, 5, 7, etc).
nLooks – int specfiying the number of looks applied to the SAR image.
gdalformat – string specifying the output image format (e.g., KEA).
datatype – Specifying the output image pixel data type (e.g., rsgislib.TYPE_32FLOAT).
Example:
import rsgislib from rsgislib import imagefilter inputImage = 'jers1palsar_stack.kea' outImgFile = 'jers1palsar_stack_lee.kea' imagefilter.applyLeeFilter(inputImage, outImgFile, 3, 3, "KEA", rsgislib.TYPE_32FLOAT)
-
class
rsgislib.imagefilter.tiledfilter.
RSGISLeeFilter
(filterSize, nLooks, gdalformat, dataType)¶ A class to apply a SAR Lee filter
Statatics Filters¶
-
rsgislib.imagefilter.
applyMinFilter
(inputimage, outputImage, filterSize, gdalformat, datatype)¶ Apply a min filter to the specified input image.
Where:
- Parameters
inputImage – string specifying the input image to be filtered.
outputImage – string specifying the output image file..
filterSize – int specfiying the size of the image filter (must be an odd number, i.e., 3, 5, 7, etc).
gdalformat – string specifying the output image format (e.g., KEA).
datatype – Specifying the output image pixel data type (e.g., rsgislib.TYPE_32FLOAT).
Example:
import rsgislib from rsgislib import imagefilter inputImage = 'jers1palsar_stack.kea' outImgFile = 'jers1palsar_stack_min3.kea' imagefilter.applyMinFilter(inputImage, outImgFile, 3, "KEA", rsgislib.TYPE_32FLOAT)
-
class
rsgislib.imagefilter.tiledfilter.
RSGISMinFilter
(filterSize, gdalformat, dataType)¶ A class to apply a min filter
-
rsgislib.imagefilter.
applyMaxFilter
(inputimage, outputImage, filterSize, gdalformat, datatype)¶ Apply a max filter to the specified input image.
Where:
- Parameters
inputImage – string specifying the input image to be filtered.
outputImage – string specifying the output image file..
filterSize – int specfiying the size of the image filter (must be an odd number, i.e., 3, 5, 7, etc).
gdalformat – string specifying the output image format (e.g., KEA).
datatype – Specifying the output image pixel data type (e.g., rsgislib.TYPE_32FLOAT).
Example:
import rsgislib from rsgislib import imagefilter inputImage = 'jers1palsar_stack.kea' outImgFile = 'jers1palsar_stack_max3.kea' imagefilter.applyMaxFilter(inputImage, outImgFile, 3, "KEA", rsgislib.TYPE_32FLOAT)
-
class
rsgislib.imagefilter.tiledfilter.
RSGISMaxFilter
(filterSize, gdalformat, dataType)¶ A class to apply a max filter
-
rsgislib.imagefilter.
applyModeFilter
(inputimage, outputImage, filterSize, gdalformat, datatype)¶ Apply a mode filter to the specified input image.
Where:
- Parameters
inputImage – string specifying the input image to be filtered.
outputImage – string specifying the output image file..
filterSize – int specfiying the size of the image filter (must be an odd number, i.e., 3, 5, 7, etc).
gdalformat – string specifying the output image format (e.g., KEA).
datatype – Specifying the output image pixel data type (e.g., rsgislib.TYPE_32FLOAT).
Example:
import rsgislib from rsgislib import imagefilter inputImage = 'jers1palsar_stack.kea' outImgFile = 'jers1palsar_stack_mode3.kea' imagefilter.applyModeFilter(inputImage, outImgFile, 3, "KEA", rsgislib.TYPE_32FLOAT)
-
class
rsgislib.imagefilter.tiledfilter.
RSGISModeFilter
(filterSize, gdalformat, dataType)¶ A class to apply a mode filter
-
rsgislib.imagefilter.
applyStdDevFilter
(inputimage, outputImage, filterSize, gdalformat, datatype)¶ Apply a std dev filter to the specified input image.
Where:
- Parameters
inputImage – string specifying the input image to be filtered.
outputImage – string specifying the output image file..
filterSize – int specfiying the size of the image filter (must be an odd number, i.e., 3, 5, 7, etc).
gdalformat – string specifying the output image format (e.g., KEA).
datatype – Specifying the output image pixel data type (e.g., rsgislib.TYPE_32FLOAT).
Example:
import rsgislib from rsgislib import imagefilter inputImage = 'jers1palsar_stack.kea' outImgFile = 'jers1palsar_stack_stdev3.kea' imagefilter.applyStdDevFilter(inputImage, outImgFile, 3, "KEA", rsgislib.TYPE_32FLOAT)
-
class
rsgislib.imagefilter.tiledfilter.
RSGISStdDevFilter
(filterSize, gdalformat, dataType)¶ A class to apply a standard deviation filter
-
rsgislib.imagefilter.
applyRangeFilter
(inputimage, outputImage, filterSize, gdalformat, datatype)¶ Apply a range filter to the specified input image.
Where:
- Parameters
inputImage – string specifying the input image to be filtered.
outputImage – string specifying the output image file..
filterSize – int specfiying the size of the image filter (must be an odd number, i.e., 3, 5, 7, etc).
gdalformat – string specifying the output image format (e.g., KEA).
datatype – Specifying the output image pixel data type (e.g., rsgislib.TYPE_32FLOAT).
Example:
import rsgislib from rsgislib import imagefilter inputImage = 'jers1palsar_stack.kea' outImgFile = 'jers1palsar_stack_range3.kea' imagefilter.applyRangeFilter(inputImage, outImgFile, 3, "KEA", rsgislib.TYPE_32FLOAT)
-
class
rsgislib.imagefilter.tiledfilter.
RSGISRangeFilter
(filterSize, gdalformat, dataType)¶ A class to apply a range filter
-
rsgislib.imagefilter.
applyCoeffOfVarFilter
(inputimage, outputImage, filterSize, gdalformat, datatype)¶ Apply a coefficient of variance filter to the specified input image.
Where:
- Parameters
inputImage – string specifying the input image to be filtered.
outputImage – string specifying the output image file..
filterSize – int specfiying the size of the image filter (must be an odd number, i.e., 3, 5, 7, etc).
gdalformat – string specifying the output image format (e.g., KEA).
datatype – Specifying the output image pixel data type (e.g., rsgislib.TYPE_32FLOAT).
Example:
import rsgislib from rsgislib import imagefilter inputImage = 'jers1palsar_stack.kea' outImgFile = 'jers1palsar_stack_cofvar3.kea' imagefilter.applyCoeffOfVarFilter(inputImage, outImgFile, 3, "KEA", rsgislib.TYPE_32FLOAT)
-
class
rsgislib.imagefilter.tiledfilter.
RSGISCoeffOfVarFilter
(filterSize, gdalformat, dataType)¶ A class to apply a coefficient of variance filter
-
rsgislib.imagefilter.
applyTotalFilter
(inputimage, outputImage, filterSize, gdalformat, datatype)¶ Apply a total filter to the specified input image.
Where:
- Parameters
inputImage – string specifying the input image to be filtered.
outputImage – string specifying the output image file..
filterSize – int specfiying the size of the image filter (must be an odd number, i.e., 3, 5, 7, etc).
gdalformat – string specifying the output image format (e.g., KEA).
datatype – Specifying the output image pixel data type (e.g., rsgislib.TYPE_32FLOAT).
Example:
import rsgislib from rsgislib import imagefilter inputImage = 'jers1palsar_stack.kea' outImgFile = 'jers1palsar_stack_total3.kea' imagefilter.applyTotalFilter(inputImage, outImgFile, 3, "KEA", rsgislib.TYPE_32FLOAT)
-
class
rsgislib.imagefilter.tiledfilter.
RSGISTotalFilter
(filterSize, gdalformat, dataType)¶ A class to apply a total filter
-
rsgislib.imagefilter.
applyNormVarFilter
(inputimage, outputImage, filterSize, gdalformat, datatype)¶ Apply a normalised variance filter to the specified input image.
Where:
- Parameters
inputImage – string specifying the input image to be filtered.
outputImage – string specifying the output image file..
filterSize – int specfiying the size of the image filter (must be an odd number, i.e., 3, 5, 7, etc).
gdalformat – string specifying the output image format (e.g., KEA).
datatype – Specifying the output image pixel data type (e.g., rsgislib.TYPE_32FLOAT).
Example:
import rsgislib from rsgislib import imagefilter inputImage = 'jers1palsar_stack.kea' outImgFile = 'jers1palsar_stack_NormVar3.kea' imagefilter.applyNormVarFilter(inputImage, outImgFile, 3, "KEA", rsgislib.TYPE_32FLOAT)
-
class
rsgislib.imagefilter.tiledfilter.
RSGISNormVarFilter
(filterSize, gdalformat, dataType)¶ A class to apply a normalised variance filter
-
rsgislib.imagefilter.
applyNormVarSqrtFilter
(inputimage, outputImage, filterSize, gdalformat, datatype)¶ Apply a normalised variance square root filter to the specified input image.
Where:
- Parameters
inputImage – string specifying the input image to be filtered.
outputImage – string specifying the output image file..
filterSize – int specfiying the size of the image filter (must be an odd number, i.e., 3, 5, 7, etc).
gdalformat – string specifying the output image format (e.g., KEA).
datatype – Specifying the output image pixel data type (e.g., rsgislib.TYPE_32FLOAT).
Example:
import rsgislib from rsgislib import imagefilter inputImage = 'jers1palsar_stack.kea' outImgFile = 'jers1palsar_stack_NormVarSqrt3.kea' imagefilter.applyNormVarSqrtFilter(inputImage, outImgFile, 3, "KEA", rsgislib.TYPE_32FLOAT)
-
class
rsgislib.imagefilter.tiledfilter.
RSGISNormVarSqrtFilter
(filterSize, gdalformat, dataType)¶ A class to apply a normalised variance square root filter
-
rsgislib.imagefilter.
applyNormVarLnFilter
(inputimage, outputImage, filterSize, gdalformat, datatype)¶ Apply a normalised variance natural log filter to the specified input image.
Where:
- Parameters
inputImage – string specifying the input image to be filtered.
outputImage – string specifying the output image file..
filterSize – int specfiying the size of the image filter (must be an odd number, i.e., 3, 5, 7, etc).
gdalformat – string specifying the output image format (e.g., KEA).
datatype – Specifying the output image pixel data type (e.g., rsgislib.TYPE_32FLOAT).
Example:
import rsgislib from rsgislib import imagefilter inputImage = 'jers1palsar_stack.kea' outImgFile = 'jers1palsar_stack_NormVarLn3.kea' imagefilter.applyNormVarLnFilter(inputImage, outImgFile, 3, "KEA", rsgislib.TYPE_32FLOAT)
-
class
rsgislib.imagefilter.tiledfilter.
RSGISNormVarLnFilter
(filterSize, gdalformat, dataType)¶ A class to apply a normalised variance log filter
-
rsgislib.imagefilter.
applyTextureVarFilter
(inputimage, outputImage, filterSize, gdalformat, datatype)¶ Apply a texture variance filter to the specified input image.
Where:
- Parameters
inputImage – string specifying the input image to be filtered.
outputImage – string specifying the output image file..
filterSize – int specfiying the size of the image filter (must be an odd number, i.e., 3, 5, 7, etc).
gdalformat – string specifying the output image format (e.g., KEA).
datatype – Specifying the output image pixel data type (e.g., rsgislib.TYPE_32FLOAT).
Example:
import rsgislib from rsgislib import imagefilter inputImage = 'jers1palsar_stack.kea' outImgFile = 'jers1palsar_stack_NormVarLn3.kea' imagefilter.applyTextureVarFilter(inputImage, outImgFile, 3, "KEA", rsgislib.TYPE_32FLOAT)
-
class
rsgislib.imagefilter.tiledfilter.
RSGISTextureVarFilter
(filterSize, gdalformat, dataType)¶ A class to apply a texture variance filter
-
rsgislib.imagefilter.
applyKuwaharaFilter
(inputimage, outputImage, filterSize, gdalformat, datatype)¶ Apply a kuwahara filter to the specified input image.
Where:
- Parameters
inputImage – string specifying the input image to be filtered.
outputImage – string specifying the output image file..
filterSize – int specfiying the size of the image filter (must be an odd number, i.e., 3, 5, 7, etc).
gdalformat – string specifying the output image format (e.g., KEA).
datatype – Specifying the output image pixel data type (e.g., rsgislib.TYPE_32FLOAT).
Example:
import rsgislib from rsgislib import imagefilter inputImage = 'jers1palsar_stack.kea' outImgFile = 'jers1palsar_stack_kuwa3.kea' imagefilter.applyKuwaharaFilter(inputImage, outImgFile, 3, "KEA", rsgislib.TYPE_32FLOAT)
-
class
rsgislib.imagefilter.tiledfilter.
RSGISKuwaharaFilter
(filterSize, gdalformat, dataType)¶ A class to apply a kuwahara filter
-
rsgislib.imagefilter.
applyMeanDiffFilter
(inputimage, outputImage, filterSize, gdalformat, datatype)¶ Apply a mean difference filter to the specified input image.
Where:
- Parameters
inputImage – string specifying the input image to be filtered.
outputImage – string specifying the output image file..
filterSize – int specfiying the size of the image filter (must be an odd number, i.e., 3, 5, 7, etc).
gdalformat – string specifying the output image format (e.g., KEA).
datatype – Specifying the output image pixel data type (e.g., rsgislib.TYPE_32FLOAT).
Example:
import rsgislib from rsgislib import imagefilter inputImage = 'jers1palsar_stack.kea' outImgFile = 'jers1palsar_stack_meandiff3.kea' imagefilter.applyMeanDiffFilter(inputImage, outImgFile, 3, "KEA", rsgislib.TYPE_32FLOAT)
-
class
rsgislib.imagefilter.tiledfilter.
RSGISMeanDiffFilter
(filterSize, gdalformat, dataType)¶ A class to apply a mean difference filter
-
rsgislib.imagefilter.
applyMeanDiffAbsFilter
(inputimage, outputImage, filterSize, gdalformat, datatype)¶ Apply a mean absolute difference filter to the specified input image.
Where:
- Parameters
inputImage – string specifying the input image to be filtered.
outputImage – string specifying the output image file..
filterSize – int specfiying the size of the image filter (must be an odd number, i.e., 3, 5, 7, etc).
gdalformat – string specifying the output image format (e.g., KEA).
datatype – Specifying the output image pixel data type (e.g., rsgislib.TYPE_32FLOAT).
Example:
import rsgislib from rsgislib import imagefilter inputImage = 'jers1palsar_stack.kea' outImgFile = 'jers1palsar_stack_meandiffabs3.kea' imagefilter.applyMeanDiffAbsFilter(inputImage, outImgFile, 3, "KEA", rsgislib.TYPE_32FLOAT)
-
class
rsgislib.imagefilter.tiledfilter.
RSGISMeanDiffAbsFilter
(filterSize, gdalformat, dataType)¶ A class to apply a mean absolute difference filter
-
rsgislib.imagefilter.
applyTotalDiffFilter
(inputimage, outputImage, filterSize, gdalformat, datatype)¶ Apply a total (i.e., sum) difference filter to the specified input image.
Where:
- Parameters
inputImage – string specifying the input image to be filtered.
outputImage – string specifying the output image file..
filterSize – int specfiying the size of the image filter (must be an odd number, i.e., 3, 5, 7, etc).
gdalformat – string specifying the output image format (e.g., KEA).
datatype – Specifying the output image pixel data type (e.g., rsgislib.TYPE_32FLOAT).
Example:
import rsgislib from rsgislib import imagefilter inputImage = 'jers1palsar_stack.kea' outImgFile = 'jers1palsar_stack_totaldiff3.kea' imagefilter.applyTotalDiffFilter(inputImage, outImgFile, 3, "KEA", rsgislib.TYPE_32FLOAT)
-
class
rsgislib.imagefilter.tiledfilter.
RSGISTotalDiffFilter
(filterSize, gdalformat, dataType)¶ A class to apply a total difference filter
-
rsgislib.imagefilter.
applyTotalDiffAbsFilter
(inputimage, outputImage, filterSize, gdalformat, datatype)¶ Apply a total absolute difference filter to the specified input image.
Where:
- Parameters
inputImage – string specifying the input image to be filtered.
outputImage – string specifying the output image file..
filterSize – int specfiying the size of the image filter (must be an odd number, i.e., 3, 5, 7, etc).
gdalformat – string specifying the output image format (e.g., KEA).
datatype – Specifying the output image pixel data type (e.g., rsgislib.TYPE_32FLOAT).
Example:
import rsgislib from rsgislib import imagefilter inputImage = 'jers1palsar_stack.kea' outImgFile = 'jers1palsar_stack_totaldiffabs3.kea' imagefilter.applyTotalDiffAbsFilter(inputImage, outImgFile, 3, "KEA", rsgislib.TYPE_32FLOAT)
-
class
rsgislib.imagefilter.tiledfilter.
RSGISTotalDiffAbsFilter
(filterSize, gdalformat, dataType)¶ A class to apply a total absolution difference filter
Filter Banks¶
-
rsgislib.imagefilter.
applyfilters
(inputimage, outputImageBase, filterparameters, gdalformat, outExt, datatype)¶ Filters images
Where:
- Parameters
inputimage – is a string containing the name of the input image
outputImageBase – is a string containing the base name of the output images
filterparameters – is list of rsgislib.imagefilter.FilterParameters objects providing the type of filter and required parameters (see example)
gdalformat – is a string containing the GDAL format for the output file - eg ‘KEA’
datatype – is an int containing one of the values from rsgislib.TYPE_*
Example:
import rsgislib from rsgislib import imagefilter inputImage = './Rasters/injune_p142_casi_sub_utm_single_band.vrt' outputImageBase = './TestOutputs/injune_p142_casi_sub_utm_single_band' gdalformat = 'KEA' outExt = 'kea' datatype = rsgislib.TYPE_32FLOAT filters = [] filters.append(imagefilter.FilterParameters(filterType = 'GaussianSmooth', fileEnding = 'gausmooth', size=3, stddevX = 1., stddevY = 1, angle = 0.) ) filters.append(imagefilter.FilterParameters(filterType = 'Gaussian1st', fileEnding = 'gau1st', size=3, stddevX = 1., stddevY = 1, angle = 0.) ) filters.append(imagefilter.FilterParameters(filterType = 'Gaussian2nd', fileEnding = 'gau1st', size=3, stddevX = 1., stddevY = 1, angle = 0.) ) filters.append(imagefilter.FilterParameters(filterType = 'Laplacian', fileEnding = 'laplacian', size=3, stddev = 1) ) filters.append(imagefilter.FilterParameters(filterType = 'Sobel', fileEnding = 'sobelx', option = 'x') ) filters.append(imagefilter.FilterParameters(filterType = 'Sobel', fileEnding = 'sobely', option = 'y') ) filters.append(imagefilter.FilterParameters(filterType = 'Sobel', fileEnding = 'sobelxy', option = 'xy') ) filters.append(imagefilter.FilterParameters(filterType = 'Prewitt', fileEnding = 'prewittx', option = 'x') ) filters.append(imagefilter.FilterParameters(filterType = 'Prewitt', fileEnding = 'prewitty', option = 'y') ) filters.append(imagefilter.FilterParameters(filterType = 'Prewitt', fileEnding = 'prewittxy', option = 'xy') ) filters.append(imagefilter.FilterParameters(filterType = 'Mean', fileEnding = 'mean', size=3) ) filters.append(imagefilter.FilterParameters(filterType = 'Median', fileEnding = 'median', size=3) ) filters.append(imagefilter.FilterParameters(filterType = 'Mode', fileEnding = 'mode', size=3) ) filters.append(imagefilter.FilterParameters(filterType = 'StdDev', fileEnding = 'stddev', size=3) ) filters.append(imagefilter.FilterParameters(filterType = 'Range', fileEnding = 'range', size=3) ) filters.append(imagefilter.FilterParameters(filterType = 'CoeffOfVar', fileEnding = 'coeffofvar', size=3) ) filters.append(imagefilter.FilterParameters(filterType = 'Min', fileEnding = 'min', size=3) ) filters.append(imagefilter.FilterParameters(filterType = 'Max', fileEnding = 'max', size=3) ) filters.append(imagefilter.FilterParameters(filterType = 'Total', fileEnding = 'total', size=3) ) filters.append(imagefilter.FilterParameters(filterType = 'MeanDiff', fileEnding = 'meandiff', size=3) ) filters.append(imagefilter.FilterParameters(filterType = 'MeanDiffAbs', fileEnding = 'meandiffabs', size=3) ) filters.append(imagefilter.FilterParameters(filterType = 'TotalDiff', fileEnding = 'meandiff', size=3) ) filters.append(imagefilter.FilterParameters(filterType = 'TotalDiffAbs', fileEnding = 'meandiffabs', size=3) ) filters.append(imagefilter.FilterParameters(filterType = 'Kuwahara', fileEnding = 'kuwahara', size=3) ) filters.append(imagefilter.FilterParameters(filterType = 'Lee', fileEnding = 'lee', size=3, nLooks=3) ) filters.append(imagefilter.FilterParameters(filterType = 'NormVar', fileEnding = 'normvar', size=3) ) filters.append(imagefilter.FilterParameters(filterType = 'NormVarSqrt', fileEnding = 'normvarsqrt', size=3) ) filters.append(imagefilter.FilterParameters(filterType = 'NormVarLn', fileEnding = 'normvarln', size=3) ) filters.append(imagefilter.FilterParameters(filterType = 'TextureVar', fileEnding = 'texturevar', size=3) ) # Apply filters imagefilter.applyfilters(inputImage, outputImageBase, filters, gdalformat, outExt, datatype)
-
rsgislib.imagefilter.
LeungMalikFilterBank
()¶ imagefilter.(inputimage, outputImageBase, gdalformat, outExt, datatype) Implements the Leung-Malik filter bank described in: Leung, T., Malik, J., 2001. Representing and recognizing the visual appearance of materials using three-dimensional textons. International Journal of Computer Vision 43 (1), 29-44. Where:
- Parameters
inputimage – is a string containing the name of the input image
outputImageBase – is a string containing the base name of the output images
gdalformat – is a string containing the GDAL format for the output file - eg ‘KEA’
datatype – is an int containing one of the values from rsgislib.TYPE_*
Example:
import rsgislib from rsgislib import imagefilter inputImage = './Rasters/injune_p142_casi_sub_utm_single_band.vrt' outputImageBase = './TestOutputs/injune_p142_casi_sub_utm_single_band' gdalformat = 'KEA' outExt = 'kea' datatype = rsgislib.TYPE_32FLOAT imagefilter.LeungMalikFilterBank(inputImage, outputImageBase, gdalformat, outExt, datatype)