CVB.Net 14.0
Filter Class Reference

Collection of Filter methods supported by the Common Vision Blox Foundation Package. More...

Static Public Member Functions

static Image Canny (ImagePlane imgPlane, EdgeFilter edgeFilter, int lowerThreshold, int upperThreshold)
 Edge filter using the Canny algorithm. More...
 
static Image Laplace (Image img, FixedFilterSize size)
 This function applies a square high pass Laplace filter to an image. More...
 
static Image Sharpen (Image img)
 This function applies a FixedFilterSize.Kernel3x3 sharpen filter to an image. More...
 
static Image LowPass (Image img, FixedFilterSize size)
 This function applies a square low pass filter to an image. More...
 
static Image HighPass (Image img, FixedFilterSize size)
 This function applies a square high pass filter to an image. More...
 
static Image Gauss (Image img, FixedFilterSize size)
 This function applies a low high pass Gaussian filter to an image. More...
 
static Image BoxMean (Image img, Size2D maskSize)
 This function sets each pixel in the output image to the average of all the input image pixels in the rectangular neighborhood defined by the maskSize parameter. More...
 
static Image BoxMean (Image img, Size2D maskSize, Point2D maskOffset)
 This function sets each pixel in the output image to the average of all the input image pixels in the rectangular neighborhood defined by the maskSize and the maskOffset parameters. This has the effect of smoothing or blurring the input image. More...
 
static Image BoxMin (Image img, Size2D maskSize)
 This function sets each pixel in the output image to the minimum value all the input image pixels in the rectangular neighborhood defined by the maskSize parameter. More...
 
static Image BoxMin (Image img, Size2D maskSize, Point2D maskOffset)
 This function sets each pixel in the output image to the minimum value all the input image pixels in the rectangular neighborhood defined by the maskSize and the maskOffset parameters. More...
 
static Image BoxMax (Image img, Size2D maskSize)
 This function sets each pixel in the output image to the maximum value all the input image pixels in the rectangular neighborhood defined by the maskSize parameter More...
 
static Image BoxMax (Image img, Size2D maskSize, Point2D maskOffset)
 This function sets each pixel in the output image to the maximum value all the input image pixels in the rectangular neighborhood defined by the maskSize and the maskOffset parameters. More...
 
static Image BoxMedian (Image img, Size2D maskSize)
 This function sets each pixel in the output image to the median value all the input image pixels in the rectangular neighborhood defined by the maskSize parameters. More...
 
static Image BoxMedian (Image img, Size2D maskSize, Point2D maskOffset)
 This function sets each pixel in the output image to the median value all the input image pixels in the rectangular neighborhood defined by the maskSize and the maskOffset parameters. More...
 
static Image ColorMedian (Image img, FixedFilterSize maskType)
 Apply a color-correct box median filter to an RGB image. More...
 
static Image Wiener (Image img, Size2D maskSize)
 This function performs adaptive filtering of an image degraded by constant power additive noise. More...
 
static Image Wiener (Image img, Size2D maskSize, Point2D maskOffset)
 This function performs adaptive filtering of an image degraded by constant power additive noise. More...
 
static Image Wiener (Image img, Size2D maskSize, double noiseThreshold)
 This function performs adaptive filtering of an image degraded by constant power additive noise. More...
 
static Image Wiener (Image img, Size2D maskSize, Point2D maskOffset, double noiseThreshold)
 This function performs adaptive filtering of an image degraded by constant power additive noise. More...
 
static Image Prewitt (Image img, FilterOrientation orientation)
 Applies a Prewitt edge filter to the input image. More...
 
static Image Scharr (Image img, FilterOrientation orientation)
 Applies a Scharr edge filter to the input image. More...
 
static Image Sobel (Image img, FilterOrientation orientation, FixedFilterSize maskSize)
 Applies a Sobel edge filter to the input image. More...
 
static Image Sobel2nd (Image img, FilterOrientation orientation, FixedFilterSize maskSize)
 Applies a 2nd order Sobel edge filter to the input image. More...
 
static Image Sobel2ndCross (Image img, FixedFilterSize maskSize)
 Applies a 2nd order Sobel cross edge filter to the input image. More...
 
static Image Roberts (Image img, RobertsDirection direction)
 Apply a Roberts edge detector to the input image. More...
 
static Image User (Image img, double[,] kernel)
 Apply a user-defined linear convolution filter to an image. More...
 
static Image User (Image img, double[,] kernel, Point2D maskOffset)
 Apply a user-defined linear convolution filter to an image. More...
 

Detailed Description

Collection of Filter methods supported by the Common Vision Blox Foundation Package.

Member Function Documentation

◆ BoxMax() [1/2]

static Image BoxMax ( Image  img,
Size2D  maskSize 
)
static

This function sets each pixel in the output image to the maximum value all the input image pixels in the rectangular neighborhood defined by the maskSize parameter

Mask offset is automatically set to the center of the image.

Parameters
imgImage to be filtered
maskSizeFilter mask to be used
Returns
The filtered image
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ BoxMax() [2/2]

static Image BoxMax ( Image  img,
Size2D  maskSize,
Point2D  maskOffset 
)
static

This function sets each pixel in the output image to the maximum value all the input image pixels in the rectangular neighborhood defined by the maskSize and the maskOffset parameters.

Parameters
imgImage to be filtered
maskSizeFilter mask to be used
maskOffsetMask center pixel location
Returns
The filtered image
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ BoxMean() [1/2]

static Image BoxMean ( Image  img,
Size2D  maskSize 
)
static

This function sets each pixel in the output image to the average of all the input image pixels in the rectangular neighborhood defined by the maskSize parameter.

This has the effect of smoothing or blurring the input image. Mask offset is automatically set to the center of the image.

Parameters
imgImage to be filtered
maskSizeFilter mask to be used
Returns
The filtered image
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ BoxMean() [2/2]

static Image BoxMean ( Image  img,
Size2D  maskSize,
Point2D  maskOffset 
)
static

This function sets each pixel in the output image to the average of all the input image pixels in the rectangular neighborhood defined by the maskSize and the maskOffset parameters. This has the effect of smoothing or blurring the input image.

Parameters
imgImage to be filtered
maskSizeFilter mask to be used
maskOffsetMask center pixel location
Returns
The filtered image
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ BoxMedian() [1/2]

static Image BoxMedian ( Image  img,
Size2D  maskSize 
)
static

This function sets each pixel in the output image to the median value all the input image pixels in the rectangular neighborhood defined by the maskSize parameters.

Mask offset is automatically set to the center of the image.

Parameters
imgImage to be filtered
maskSizeFilter mask to be used
Returns
The filtered image
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ BoxMedian() [2/2]

static Image BoxMedian ( Image  img,
Size2D  maskSize,
Point2D  maskOffset 
)
static

This function sets each pixel in the output image to the median value all the input image pixels in the rectangular neighborhood defined by the maskSize and the maskOffset parameters.

Parameters
imgImage to be filtered
maskSizeFilter mask to be used
maskOffsetMask center pixel location
Returns
The filtered image
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ BoxMin() [1/2]

static Image BoxMin ( Image  img,
Size2D  maskSize 
)
static

This function sets each pixel in the output image to the minimum value all the input image pixels in the rectangular neighborhood defined by the maskSize parameter.

Mask offset is automatically set to the center of the image.

Parameters
imgImage to be filtered
maskSizeFilter mask to be used
Returns
The filtered image
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ BoxMin() [2/2]

static Image BoxMin ( Image  img,
Size2D  maskSize,
Point2D  maskOffset 
)
static

This function sets each pixel in the output image to the minimum value all the input image pixels in the rectangular neighborhood defined by the maskSize and the maskOffset parameters.

Parameters
imgImage to be filtered
maskSizeFilter mask to be used
maskOffsetMask center pixel location
Returns
The filtered image
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ Canny()

static Image Canny ( ImagePlane  imgPlane,
EdgeFilter  edgeFilter,
int  lowerThreshold,
int  upperThreshold 
)
static

Edge filter using the Canny algorithm.

The algorithm uses three stages:

  1. imgPlane is differentiated in x and y direction using the edgeFilter . From the two derivatives the direction and magnitude is computed.
  2. The directional information is simplified and then the local maximum along an edge contour is determined that lies above the upperThreshold .
  3. The contours are then traced starting from the local maximum using hysteresis thresholding with the lowerThreshold to counter broken edges.
Parameters
imgPlaneImage plane to be filtered.
edgeFilterEdge filter method to be used.
lowerThresholdLower threshold for hysteresis thresholding.
upperThresholdUpper threshold for edge detection and hysteresis thresholding.
Returns
The filtered image
Exceptions
ObjectDisposedExceptionIf the input imgPlane has already been disposed.

◆ ColorMedian()

static Image ColorMedian ( Image  img,
FixedFilterSize  maskType 
)
static

Apply a color-correct box median filter to an RGB image.

The input image must have an RGB color model.

Parameters
imgImage to apply the filter to.
maskTypeMask size to use.
Returns
Filtered image.
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ Gauss()

static Image Gauss ( Image  img,
FixedFilterSize  size 
)
static

This function applies a low high pass Gaussian filter to an image.

Parameters
imgImage to be filtered.
sizeEither FixedFilterSize.Kernel3x3 or FixedFilterSize.Kernel5x5.
Returns
The filtered image
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed
ArgumentExceptionIf the size parameter is invalid (only 3x3 and 5x5 filter masks are supported

◆ HighPass()

static Image HighPass ( Image  img,
FixedFilterSize  size 
)
static

This function applies a square high pass filter to an image.

Parameters
imgImage to be filtered.
sizeEither FixedFilterSize.Kernel3x3 or FixedFilterSize.Kernel5x5.
Returns
The filtered image
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed
ArgumentExceptionIf the size parameter is invalid (only 3x3 and 5x5 filter masks are supported

◆ Laplace()

static Image Laplace ( Image  img,
FixedFilterSize  size 
)
static

This function applies a square high pass Laplace filter to an image.

Parameters
imgImage to be filtered.
sizeEither FixedFilterSize.Kernel3x3 or FixedFilterSize.Kernel5x5.
Returns
the filtered image
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed
ArgumentExceptionIf the size parameter is invalid (only 3x3 and 5x5 filter masks are supported

◆ LowPass()

static Image LowPass ( Image  img,
FixedFilterSize  size 
)
static

This function applies a square low pass filter to an image.

Parameters
imgImage to be filtered.
sizeEither FixedFilterSize.Kernel3x3 or FixedFilterSize.Kernel5x5.
Returns
The filtered image
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed
ArgumentExceptionIf the size parameter is invalid (only 3x3 and 5x5 filter masks are supported

◆ Prewitt()

static Image Prewitt ( Image  img,
FilterOrientation  orientation 
)
static

Applies a Prewitt edge filter to the input image.

Note that the Prewitt filter zeros out negative edges - if you want to use a filter that preserves the negative edges, please use Sobel or Scharr instead.

Parameters
imgImage to filter.
orientationOrientation of the filter.
Returns
Filtered image.
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ Roberts()

static Image Roberts ( Image  img,
RobertsDirection  direction 
)
static

Apply a Roberts edge detector to the input image.

Result values of the Roberts filter that are less than zero will be zeroed out.

Parameters
imgImage to be filtered.
directionFilter direction.
Returns
Filtered image.
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ Scharr()

static Image Scharr ( Image  img,
FilterOrientation  orientation 
)
static

Applies a Scharr edge filter to the input image.

The Scharr filter's output, in case of an 8 bit monochrome input image, will be scaled to the range 0...255, with 128 corresponding to a filter result of zero.

Parameters
imgImage to filter
orientationOrientation of the filter
Returns
filtered image
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ Sharpen()

static Image Sharpen ( Image  img)
static

This function applies a FixedFilterSize.Kernel3x3 sharpen filter to an image.

Parameters
imgImage to be filtered
Returns
The filtered image
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ Sobel()

static Image Sobel ( Image  img,
FilterOrientation  orientation,
FixedFilterSize  maskSize 
)
static

Applies a Sobel edge filter to the input image.

The Sobel filter's output, in case of an 8 bit monochrome input image, will be scaled to the range 0...255, with 128 corresponding to a filter result of zero.

Parameters
imgImage to filter
orientationOrientation of the filter
maskSizeMask size (3x3 or 5x5)
Returns
Filtered image
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ Sobel2nd()

static Image Sobel2nd ( Image  img,
FilterOrientation  orientation,
FixedFilterSize  maskSize 
)
static

Applies a 2nd order Sobel edge filter to the input image.

The Sobel filter's output, in case of an 8 bit monochrome input image, will be scaled to the range 0...255, with 128 corresponding to a filter result of zero.

Parameters
imgImage to filter
orientationOrientation of the filter
maskSizeMask size (3x3 or 5x5)
Returns
Filtered image
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ Sobel2ndCross()

static Image Sobel2ndCross ( Image  img,
FixedFilterSize  maskSize 
)
static

Applies a 2nd order Sobel cross edge filter to the input image.

The Sobel filter's output, in case of an 8 bit monochrome input image, will be scaled to the range 0...255, with 128 corresponding to a filter result of zero.

Parameters
imgImage to filter
maskSizeMask size (3x3 or 5x5)
Returns
Filtered image
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ User() [1/2]

static Image User ( Image  img,
double  kernel[,] 
)
static

Apply a user-defined linear convolution filter to an image.

Parameters
imgImage to apply the filter to.
kernelCoefficients of the filter kernel; must be a two-dimensional array.
Returns
Filtered image.
Exceptions
ArgumentNullExceptionIf the input img or kernel is null.
ObjectDisposedExceptionIf the input img has already been disposed
InvalidOperationExceptionIf the user kernel has a rank != 2.

◆ User() [2/2]

static Image User ( Image  img,
double  kernel[,],
Point2D  maskOffset 
)
static

Apply a user-defined linear convolution filter to an image.

Parameters
imgImage to apply the filter to.
kernelCoefficients of the filter kernel; must be a two-dimensional array.
maskOffsetreference point of the filter mask, relative to the top left cell of the mask
Returns
Filtered image.
Exceptions
ArgumentNullExceptionIf the input img or kernel is null.
ObjectDisposedExceptionIf the input img has already been disposed
InvalidOperationExceptionIf the user kernel has a rank != 2.

◆ Wiener() [1/4]

static Image Wiener ( Image  img,
Size2D  maskSize 
)
static

This function performs adaptive filtering of an image degraded by constant power additive noise.

For each pixel of the input image, the function determines the local image mean and variance in the rectangular neighborhood (mask) defined by maskSize . The deviation from the local average is then diminished according to the local variance and the noise threshold parameters. The noise threshold parameter may be zero, in which case the function tries to determine itself what local noise threshold to apply. This normally yields the best results.

Mask offset is automatically set to the center of the image.

Parameters
imgImage to be filtered
maskSizeFilter mask to be used
Returns
The filtered image
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ Wiener() [2/4]

static Image Wiener ( Image  img,
Size2D  maskSize,
double  noiseThreshold 
)
static

This function performs adaptive filtering of an image degraded by constant power additive noise.

For each pixel of the input image, the function determines the local image mean and variance in the rectangular neighborhood (mask) defined by maskSize . The deviation from the local average is then diminished according to the local variance and the noise threshold parameters. The noise threshold parameter may be zero, in which case the function tries to determine itself what local noise threshold to apply. This normally yields the best results.

Mask offset is automatically set to the center of the image.

Parameters
imgImage to be filtered
maskSizeFilter mask to be used
noiseThresholdNoise suppression threshold.Valid input ranges from 0 to 1; with 0 causing the function to determine the threshold automatically.
Returns
The filtered image
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed
ArgumentOutOfRangeExceptionIf the noiseThreshold is outside its range.

◆ Wiener() [3/4]

static Image Wiener ( Image  img,
Size2D  maskSize,
Point2D  maskOffset 
)
static

This function performs adaptive filtering of an image degraded by constant power additive noise.

For each pixel of the input image, the function determines the local image mean and variance in the rectangular neighborhood (mask) defined by maskSize and maskOffset . The deviation from the local average is then diminished according to the local variance and the noise threshold parameters. The noise threshold parameter may be zero, in which case the function tries to determine itself what local noise threshold to apply. This normally yields the best results.

Parameters
imgImage to be filtered
maskSizeFilter mask to be used
maskOffsetMask center pixel location
Returns
The filtered image
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ Wiener() [4/4]

static Image Wiener ( Image  img,
Size2D  maskSize,
Point2D  maskOffset,
double  noiseThreshold 
)
static

This function performs adaptive filtering of an image degraded by constant power additive noise.

For each pixel of the input image, the function determines the local image mean and variance in the rectangular neighborhood (mask) defined by maskSize and maskOffset . The deviation from the local average is then diminished according to the local variance and the noise threshold parameters. The noise threshold parameter may be zero, in which case the function tries to determine itself what local noise threshold to apply. This normally yields the best results.

Parameters
imgImage to be filtered
maskSizeFilter mask to be used
maskOffsetMask center pixel location
noiseThresholdNoise suppression threshold.Valid input ranges from 0 to 1; with 0 causing the function to determine the threshold automatically.
Returns
The filtered image
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed
ArgumentOutOfRangeExceptionIf the noiseThreshold is outside its range.