The adaptive bilateral filter can be used for sharpness enhancement and noise removal. This filter enhance the edge slope by transforming the histogram via a range filter with adaptive offset and width. It is able to smooth the noise, while enhancing edges and textures in an image. The main difference between this filter and conventional linear filters is that they remove noise while significantly blur the edge structures of an image.
In the adaptive bilateral filter, the kernel size (d) defines the neighborhood where pixels value contributes in a weighted manner to generate the output. The output of the filter is controlled also by two other parameters: σd (Sigma Space) and max σr (Max Sigma Color). Larger value of the sigma space means that farther pixels will influence each other (as long as their colors are close enough). Maximum allowed sigma color will clamp the value calculated in the ksize neighborhood. Larger value of the parameter means that more dissimilar pixels will influence each other (as long as their colors are close enough).
When the kernel size is larger than zero (d>0), it specifies the neighborhood size regardless of sigma space(σd), otherwise d is proportional to sigma space (σd).
The Adaptive bilateral filter operation is adapted from OpenCv library where you will find more detail information concerning the filter algorithm and its applications.
The Adaptive bilateral filter operation can be applied either via ILWIS-Python editor or via ILWIS Main window, Toolbar and the Operatins tab. The required Python syntax is:
name of the output raster coverage = ilwis.Engine.do(name of the operation, name of the input raster coverage, a value for kernel width, a value for kernel height, a value for sigma space, optional; a value for max sigma color)
Then, the Python syntax for the above mentioned operation is:
output raster = ilwis.Engine.do("adaptivebilateralfilter", “file:///C:/mydir/myraster.mpr", kernel width, kernel height, sigma space (σd), max sigma color(σr))
In general, the URL used in the Python syntax can be replaced with variable name created using Python. For example: you can open a feature coverage as a variable and give it a name as the following example:
rc = ilwis.RasterCoverage("file:///C:/mydir/myraster.mpr")
Once the variable is created, then it can be used directly in Python syntax without quotation mark and the path as the following:
output raster = ilwis.Engine.do("adaptivebilateralfilter", rc, d, σs, σr)