Operations: Adaptive bilateral filter

From ILWIS
Jump to: navigation, search
Main Page Arrow.png Operations
Adaptive bilateral filter
Adaptive bilateral filter

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)

Figure 1, Adaptive bilateral filter operation form


To start the Adaptive bilateral filter operation from ILWIS main window:

Mar.jpg
  • Click the Operation tab on toolbar tabs
  • From the opened operation list select Adaptive bilateral filter


Once the Adaptive bilateral filter operation is selected from the list, an operation form will be opened in which you can set parameters required for that operation including input(s), output(s), memory location and data format (Figure 1).

To successfully execute this operation, you need to complete the form with proper inputs data. The inputs data must be dragged from the catalog and dropped in their corresponding fields in the form or typed in.

raster coverage: Select an input raster coverage to be filtered.
kernel width: Enter a value to define the width of the kernel. The kernel width and height define the kernel size (d) which is the neighborhood where the local variance will be calculated. Pixels will contribute in weighted manner.
kernel height: Enter a value to define the height of the kernel.
sigma space: Enter a value that define filter sigma in the coordinate space. Larger value of the parameter means that farther pixels will influence each other (as long as their colors are close enough).
max sigma color: Maximum allowed sigma color will clamp the value calculated in the kernel size neighborhood. Larger value of the parameter means that more dissimilar pixels will influence each other (as long as their colors are close enough). The max sigma color is optional in ILWIS; it uses the default value of 20 when it is not selected. A larger value means that farther colors within the pixel neighborhood will be mixed together, resulting in larger areas of semi-equal color.
output raster coverage: Type a name for the output raster map that will contain results of the filtering operation.
Output format: Select a format to save the output raster map. The default format is Memory; if you select it, the output will be temporally saved in the internal catalog and will be removed when you exit the program. If you select other format, the output will be saved in the active catalog.
Execute: Click the Execute button to run this operation.


Detailed information on filtering and the available standard filter in ILWIS are given in: Basic concept: Filters