RSGISLib Image Morphology Module¶
The image morphology module contains functions for performing image morphology operations.
Generate Operator¶
-
rsgislib.imagemorphology.
createCircularOp
(outputFile=string, opSize=int)¶ Performs an image morphology dilate operation.
Where:
- Parameters
outputFile – is a string specifying the name and path of the output matrix file.
opSize – is a integer specifying the size of the operator.
Example:
import rsgislib.imagemorphology rsgislib.imagemorphology.createCircularOp(outputFile='CircularOp5.gmtxt', opSize=5)
Morphology Operations¶
-
rsgislib.imagemorphology.
imageDilate
(inputImage=string, outputImage=string, morphOperator=string, useOpFile=boolean, opSize=int, gdalformat=string, datatype=int)¶ Performs an image morphology dilate operation.
Where:
- Parameters
inputImage – is a string specifying the name and path of the input file.
outputImage – is a string specifying the name and path of the output file.
morphOperator – is a string with the name and path to a .gmtxt file with a square binary matrix specifying the morphology operator
useOpFile – is a boolean specifying whether the morphOperator file is present or whether a square operator (specified via opSize) should be used. (True = morphOperator, False = opSize)
opSize – is a integer specifying the square operator size (only used if useOpFile is False)
gdalformat – is a string specifying the GDAL image format (e.g., KEA)
datatype – is an int containing one of the values from rsgislib.TYPE_*
Example:
import rsgislib import rsgislib.imagemorphology inImg = 'clumpsImage.kea' outImg = 'clumpsImage_Dilate.kea' rsgislib.imagemorphology.imageDilate(inputImage=inImg, outputImage=outImg, morphOperator=, useOpFile=False, opSize=5, gdalformat='KEA', datatype=rsgislib.TYPE_32UINT)
-
rsgislib.imagemorphology.
imageDilateCombinedOut
(inputImage=string, outputImage=string, morphOperator=string, useOpFile=boolean, opSize=int, gdalformat=string, datatype=int)¶ Performs an image morphology dilate operation, where the outputs will be combined into a single image.
Where:
- Parameters
inputImage – is a string specifying the name and path of the input file.
outputImage – is a string specifying the name and path of the output file.
morphOperator – is a string with the name and path to a .gmtxt file with a square binary matrix specifying the morphology operator
useOpFile – is a boolean specifying whether the morphOperator file is present or whether a square operator (specified via opSize) should be used. (True = morphOperator, False = opSize)
opSize – is a integer specifying the square operator size (only used if useOpFile is False)
gdalformat – is a string specifying the GDAL image format (e.g., KEA)
datatype – is an int containing one of the values from rsgislib.TYPE_*
-
rsgislib.imagemorphology.
imageErode
(inputImage=string, outputImage=string, morphOperator=string, useOpFile=boolean, opSize=int, gdalformat=string, datatype=int)¶ Performs an image morphology erode operation.
Where:
- Parameters
inputImage – is a string specifying the name and path of the input file.
outputImage – is a string specifying the name and path of the output file.
morphOperator – is a string with the name and path to a .gmtxt file with a square binary matrix specifying the morphology operator
useOpFile – is a boolean specifying whether the morphOperator file is present or whether a square operator (specified via opSize) should be used. (True = morphOperator, False = opSize)
opSize – is a integer specifying the square operator size (only used if useOpFile is False)
gdalformat – is a string specifying the GDAL image format (e.g., KEA)
datatype – is an int containing one of the values from rsgislib.TYPE_*
-
rsgislib.imagemorphology.
imageErodeCombinedOut
(inputImage=string, outputImage=string, morphOperator=string, useOpFile=boolean, opSize=int, gdalformat=string, datatype=int)¶ Performs an image morphology erode operation, where the outputs will be combined into a single image.
Where:
- Parameters
inputImage – is a string specifying the name and path of the input file.
outputImage – is a string specifying the name and path of the output file.
morphOperator – is a string with the name and path to a .gmtxt file with a square binary matrix specifying the morphology operator
useOpFile – is a boolean specifying whether the morphOperator file is present or whether a square operator (specified via opSize) should be used. (True = morphOperator, False = opSize)
opSize – is a integer specifying the square operator size (only used if useOpFile is False)
gdalformat – is a string specifying the GDAL image format (e.g., KEA)
datatype – is an int containing one of the values from rsgislib.TYPE_*
-
rsgislib.imagemorphology.
imageGradiant
(inputImage=string, outputImage=string, morphOperator=string, useOpFile=boolean, opSize=int, gdalformat=string, datatype=int)¶ Performs an image morphology gradiant operation.
Where:
- Parameters
inputImage – is a string specifying the name and path of the input file.
outputImage – is a string specifying the name and path of the output file.
morphOperator – is a string with the name and path to a .gmtxt file with a square binary matrix specifying the morphology operator
useOpFile – is a boolean specifying whether the morphOperator file is present or whether a square operator (specified via opSize) should be used. (True = morphOperator, False = opSize)
opSize – is a integer specifying the square operator size (only used if useOpFile is False)
gdalformat – is a string specifying the GDAL image format (e.g., KEA)
datatype – is an int containing one of the values from rsgislib.TYPE_*
-
rsgislib.imagemorphology.
imageGradiantCombinedOut
(inputImage=string, outputImage=string, morphOperator=string, useOpFile=boolean, opSize=int, gdalformat=string, datatype=int)¶ Performs an image morphology gradiant operation, where the outputs will be combined into a single image.
Where:
- Parameters
inputImage – is a string specifying the name and path of the input file.
outputImage – is a string specifying the name and path of the output file.
morphOperator – is a string with the name and path to a .gmtxt file with a square binary matrix specifying the morphology operator
useOpFile – is a boolean specifying whether the morphOperator file is present or whether a square operator (specified via opSize) should be used. (True = morphOperator, False = opSize)
opSize – is a integer specifying the square operator size (only used if useOpFile is False)
gdalformat – is a string specifying the GDAL image format (e.g., KEA)
datatype – is an int containing one of the values from rsgislib.TYPE_*
-
rsgislib.imagemorphology.
imageLocalMinima
(inputImage=string, outputImage=string, sequencialOut=boolean, allowEqual=boolean, morphOperator=string, useOpFile=boolean, opSize=int, gdalformat=string, datatype=int)¶ Uses image morphology to find local minima.
Where:
- Parameters
inputImage – is a string specifying the name and path of the input file.
outputImage – is a string specifying the name and path of the output file.
sequencialOut – is a boolean whether the output minima should be individual numbered (True) or just a binary mask (False).
allowEqual – is a boolean specifying whether equal values are allowed in the output.
morphOperator – is a string with the name and path to a .gmtxt file with a square binary matrix specifying the morphology operator
useOpFile – is a boolean specifying whether the morphOperator file is present or whether a square operator (specified via opSize) should be used. (True = morphOperator, False = opSize)
opSize – is a integer specifying the square operator size (only used if useOpFile is False)
gdalformat – is a string specifying the GDAL image format (e.g., KEA)
datatype – is an int containing one of the values from rsgislib.TYPE_*
-
rsgislib.imagemorphology.
imageLocalMinimaCombinedOut
(inputImage=string, outputImage=string, sequencialOut=boolean, allowEqual=boolean, morphOperator=string, useOpFile=boolean, opSize=int, gdalformat=string, datatype=int)¶ Uses image morphology to find local minima, where the outputs will be combined into a single image.
Where:
- Parameters
inputImage – is a string specifying the name and path of the input file.
outputImage – is a string specifying the name and path of the output file.
sequencialOut – is a boolean whether the output minima should be individual numbered (True) or just a binary mask (False).
allowEqual – is a boolean specifying whether equal values are allowed in the output.
morphOperator – is a string with the name and path to a .gmtxt file with a square binary matrix specifying the morphology operator
useOpFile – is a boolean specifying whether the morphOperator file is present or whether a square operator (specified via opSize) should be used. (True = morphOperator, False = opSize)
opSize – is a integer specifying the square operator size (only used if useOpFile is False)
gdalformat – is a string specifying the GDAL image format (e.g., KEA)
datatype – is an int containing one of the values from rsgislib.TYPE_*
-
rsgislib.imagemorphology.
imageOpening
(inputImage=string, outputImage=string, tempImage=string, morphOperator=string, useOpFile=boolean, opSize=int, gdalformat=string, datatype=int, niters=int)¶ Performs an image morphology opening operation.
Where:
- Parameters
inputImage – is a string specifying the name and path of the input file.
outputImage – is a string specifying the name and path of the output file.
tempImage – is a string specifying the name and path of a tempory file used for intermediate processing step(s). If empty string (‘’) then an in memory image will be used.
morphOperator – is a string with the name and path to a .gmtxt file with a square binary matrix specifying the morphology operator
useOpFile – is a boolean specifying whether the morphOperator file is present or whether a square operator (specified via opSize) should be used. (True = morphOperator, False = opSize)
opSize – is a integer specifying the square operator size (only used if useOpFile is False)
gdalformat – is a string specifying the GDAL image format (e.g., KEA)
datatype – is an int containing one of the values from rsgislib.TYPE_*
niters – is an int for the number of iterations of the operators (Optional, default = 1)
-
rsgislib.imagemorphology.
imageClosing
(inputImage=string, outputImage=string, tempImage=string, morphOperator=string, useOpFile=boolean, opSize=int, gdalformat=string, datatype=int, niters=int)¶ Performs an image morphology closing operation.
Where:
- Parameters
inputImage – is a string specifying the name and path of the input file.
outputImage – is a string specifying the name and path of the output file.
tempImage – is a string specifying the name and path of a tempory file used for intermediate processing step(s). If empty string (‘’) then an in memory image will be used.
morphOperator – is a string with the name and path to a .gmtxt file with a square binary matrix specifying the morphology operator
useOpFile – is a boolean specifying whether the morphOperator file is present or whether a square operator (specified via opSize) should be used. (True = morphOperator, False = opSize)
opSize – is a integer specifying the square operator size (only used if useOpFile is False)
gdalformat – is a string specifying the GDAL image format (e.g., KEA)
datatype – is an int containing one of the values from rsgislib.TYPE_*
niters – is an int for the number of iterations of the operators (Optional, default = 1)
-
rsgislib.imagemorphology.
imageBlackTopHat
(inputImage=string, outputImage=string, tempImage=string, morphOperator=string, useOpFile=boolean, opSize=int, gdalformat=string, datatype=int)¶ Performs an image morphology black top hat operation.
Where:
- Parameters
inputImage – is a string specifying the name and path of the input file.
outputImage – is a string specifying the name and path of the output file.
tempImage – is a string specifying the name and path of a tempory file used for intermediate processing step(s).
morphOperator – is a string with the name and path to a .gmtxt file with a square binary matrix specifying the morphology operator
useOpFile – is a boolean specifying whether the morphOperator file is present or whether a square operator (specified via opSize) should be used. (True = morphOperator, False = opSize)
opSize – is a integer specifying the square operator size (only used if useOpFile is False)
gdalformat – is a string specifying the GDAL image format (e.g., KEA)
datatype – is an int containing one of the values from rsgislib.TYPE_*
-
rsgislib.imagemorphology.
imageWhiteTopHat
(inputImage=string, outputImage=string, tempImage=string, morphOperator=string, useOpFile=boolean, opSize=int, gdalformat=string, datatype=int)¶ Performs an image morphology white top hat operation.
Where:
- Parameters
inputImage – is a string specifying the name and path of the input file.
outputImage – is a string specifying the name and path of the output file.
tempImage – is a string specifying the name and path of a tempory file used for intermediate processing step(s).
morphOperator – is a string with the name and path to a .gmtxt file with a square binary matrix specifying the morphology operator
useOpFile – is a boolean specifying whether the morphOperator file is present or whether a square operator (specified via opSize) should be used. (True = morphOperator, False = opSize)
opSize – is a integer specifying the square operator size (only used if useOpFile is False)
gdalformat – is a string specifying the GDAL image format (e.g., KEA)
datatype – is an int containing one of the values from rsgislib.TYPE_*