DIPlib Documentation - ©1995-2011 Quantitative Imaging Group, Delft University of Technology.

# BiasedSigma

Adaptive edge sharpening & contrast enhancing filter

## SYNOPSIS

`#include "dip_filtering.h"`

dip_Error dip_BiasedSigma ( in, out, se, boundary, param, shape, sigma, outputCount )

## DATA TYPES

integer, float

## FUNCTION

The Biased Sigma filter is an adaptive edge sharpening and contrast enhancing filter. Its operation differs from the `Sigma` filter by separating the pixels with intensities higher than the pixel being filtered, from the pixels with lower intensities. The output for this pixel is the average closest in value to this pixel. If `outputCount` is `DIP_TRUE`, the output values represent the number of pixels over which the average has been calculated. When `threshold` is `DIP_TRUE`, the pixel intensities are thresholded at `+/- 2 sigma`, when it is set to `DIP_FALSE`, the intensities are weighted with the Gaussian difference with the intensity of the center pixel.

Only the rectangular, elliptic and diamond filter shapes are supported (`DIP_FLT_SHAPE_RECTANGULAR`, `DIP_FLT_SHAPE_ELLIPTIC` and `DIP_FLT_SHAPE_DIAMOND`). Other filter shapes can be implemented by setting `shape` to `DIP_FLT_SHAPE_STRUCTURING_ELEMENT`, and passing a binary image in `se`. The "on" pixels define the shape of the filter window. Other values of `shape` are illegal.

If `shape` is not equal to `DIP_FLT_SHAPE_STRUCTURING_ELEMENT`, `se` can be set to zero. When `shape` is set to `DIP_FLT_SHAPE_STRUCTURING_ELEMENT`, `param` is ignored, and can be set to zero.

## ARGUMENTS

Data type | Name | Description
`dip_Image` | `in` | Input image
`dip_Image` | `out` | Output image
`dip_Image` | `se` | Custom filter window (binary)
`dip_BoundaryArray` | `boundary` | Boundary conditions
`dip_FloatArray` | `param` | Filter sizes
`dip_FilterShape` | `shape` | Filter shape
`dip_float` | `sigma` | Sigma
`dip_Boolean` | `outputCount` | Output the Count

The enumerator `dip_FilterShape` contains the following constants:

Name | Description
`DIP_FLT_SHAPE_DEFAULT` | Default filter window, same as `DIP_FLT_SHAPE_RECTANGULAR`
`DIP_FLT_SHAPE_RECTANGULAR` | Rectangular filter window, can be even in size
`DIP_FLT_SHAPE_ELLIPTIC` | Elliptic filter window, always odd in size
`DIP_FLT_SHAPE_DIAMOND` | Diamond-shaped filter window, always odd in size
`DIP_FLT_SHAPE_PARABOLIC` | Parabolic filter window (morphology only)
`DIP_FLT_SHAPE_DISCRETE_LINE` | Rotated line structuring element (morphology only)
`DIP_FLT_SHAPE_INTERPOLATED_LINE` | Rotated line structuring element, through interpolation (morphology only)
`DIP_FLT_SHAPE_PERIODIC_LINE` | (not implemented)
`DIP_FLT_SHAPE_STRUCTURING_ELEMENT` | Use `se` as filter window, can be any size

Only the rectangular, elliptic and diamond filter shapes are supported (`DIP_FLT_SHAPE_RECTANGULAR`, `DIP_FLT_SHAPE_ELLIPTIC` and `DIP_FLT_SHAPE_DIAMOND`). Other filter shapes can be implemented by setting `shape` to `DIP_FLT_SHAPE_STRUCTURING_ELEMENT`, and passing a binary image in `se`. The "on" pixels define the shape of the filter window. Other values of `shape` are illegal.

If `shape` is not equal to `DIP_FLT_SHAPE_STRUCTURING_ELEMENT`, `se` can be set to zero. When `shape` is set to `DIP_FLT_SHAPE_STRUCTURING_ELEMENT`, `param` is ignored, and can be set to zero.

## LITERATURE

John-Sen Lee, Digital Image Smoothing and the Sigma Filter, Computer Vision, Graphics and Image Processing, 24, 255-269, 1983

## SEE ALSO

`Sigma`, `GaussianSigma`