Foundation (CVFoundation.dll) 14.0
Filter Functions

Functions

cvbres_t FilterBoxMax (IMG ImgIn, long MaskWidth, long MaskHeight, long MaskOffsetX, long MaskOffsetY, IMG &ImgOut)
 Sets each pixel in the output image to the maximum value of all the input image pixel values in the neighborhood. More...
 
cvbres_t FilterBoxMean (IMG ImgIn, long MaskWidth, long MaskHeight, long MaskOffsetX, long MaskOffsetY, IMG &ImgOut)
 Sets each pixel in the output image to the average of all the input image pixels in the rectangular neighborhood. More...
 
cvbres_t FilterBoxMedian (IMG ImgIn, long MaskWidth, long MaskHeight, long MaskOffsetX, long MaskOffsetY, IMG &ImgOut)
 Sets each pixel in the output image to the median value of all the input pixel values taken in the neighborhood. More...
 
cvbres_t FilterBoxMedianCross (IMG ImgIn, TFilterMask MaskType, IMG &ImgOut)
 Sets each pixel in the output image to the median value of all the input pixel values taken in the neighborhood (cross). More...
 
cvbres_t FilterBoxMin (IMG ImgIn, long MaskWidth, long MaskHeight, long MaskOffsetX, long MaskOffsetY, IMG &ImgOut)
 Sets each pixel in the output image to the minimum value of all the input image pixel values in the neighborhood. More...
 
cvbres_t FilterCanny (IMG ImgIn, long Index, TCannyEdgeFilter Filtering, long ThresholdLower, long ThresholdUpper, IMG &ImgOut)
 Finds edges in the source image using the Canny algorithm. More...
 
cvbres_t FilterGauss (IMG ImgIn, TFilterMask MaskSize, IMG &ImgOut)
 Applies a square low-pass Gaussian filter to an area of interest of the image. More...
 
cvbres_t FilterHiPass (IMG ImgIn, TFilterMask MaskSize, IMG &ImgOut)
 Applies a high-pass filter to an area of interest of the image. More...
 
cvbres_t FilterLaplace2 (IMG ImgIn, TFilterMask MaskSize, IMG &ImgOut)
 Applies a high-pass Laplace filter to an area of interest of the image. The corresponding filter kernel is a matrix of either 3x3 or 5x5 elements with the following values: More...
 
cvbres_t FilterLoPass (IMG ImgIn, TFilterMask MaskSize, IMG &ImgOut)
 Applies a low-pass filter to an area of interest of the image. More...
 
cvbres_t FilterMedianColor (IMG ImgIn, TFilterMask MaskType, IMG &ImgOut)
 Applies the median value considering each color plane. More...
 
cvbres_t FilterPrewittHorizontal (IMG ImgIn, IMG &ImgOut)
 Applies a horizontal Prewitt operator to an area of interest of the image. More...
 
cvbres_t FilterPrewittVertical (IMG ImgIn, IMG &ImgOut)
 Applies a vertical Prewitt operator to an area of interest of the image. More...
 
cvbres_t FilterRobertsDown (IMG ImgIn, IMG &ImgOut)
 Applies a horizontal Roberts operator to an image. More...
 
cvbres_t FilterRobertsUp (IMG ImgIn, IMG &ImgOut)
 Applies a vertical Roberts operator to an image. More...
 
cvbres_t FilterScharrHorizontal (IMG ImgIn, IMG &ImgOut)
 Applies a horizontal Scharr operator to an image. More...
 
cvbres_t FilterScharrVertical (IMG ImgIn, IMG &ImgOut)
 Applies a vertical Scharr operator to an image. More...
 
cvbres_t FilterSharpening (IMG ImgIn, IMG &ImgOut)
 Applies a sharpening filter to an image. More...
 
cvbres_t FilterSobelCross (IMG ImgIn, TFilterMask MaskSize, IMG &ImgOut)
 Applies a second cross derivative Sobel operator to an image. More...
 
cvbres_t FilterSobelHorizontal (IMG ImgIn, TFilterMask MaskSize, IMG &ImgOut)
 Applies a horizontal Sobel operator to an image. More...
 
cvbres_t FilterSobelHorizontal2ndOrder (IMG ImgIn, TFilterMask MaskSize, IMG &ImgOut)
 Applies a second derivative horizontal Sobel operator to an image. More...
 
cvbres_t FilterSobelVertical (IMG ImgIn, TFilterMask MaskSize, IMG &ImgOut)
 Applies a vertical Sobel operator to an image. More...
 
cvbres_t FilterSobelVertical2ndOrder (IMG ImgIn, TFilterMask MaskSize, IMG &ImgOut)
 Applies a second derivative vertical Sobel operator to an image. More...
 
cvbres_t FilterUserLinear (IMG ImgIn, long KernelWidth, long KernelHeight, long KernelOffsetX, long KernelOffsetY, double KernelValues[], IMG &ImgOut)
 Uses a rectangular kernel of floating-point values to filter an image that consists of integer or floating point data. More...
 
cvbres_t FilterWiener (IMG ImgIn, long MaskWidth, long MaskHeight, long MaskOffsetX, long MaskOffsetY, double NoiseThreshold, IMG &ImgOut)
 Performs adaptive filtering of an image degraded by constant power additive noise. More...
 

Detailed Description

Function Documentation

◆ FilterBoxMax()

cvbres_t FilterBoxMax ( IMG  ImgIn,
long  MaskWidth,
long  MaskHeight,
long  MaskOffsetX,
long  MaskOffsetY,
IMG ImgOut 
)

Sets each pixel in the output image to the maximum value of all the input image pixel values in the neighborhood.

The neighborhood is defined through the of size MaskHeight and MaskWidth and the anchor cell at that pixel.

Parameters
[in]ImgInHandle of input image.
[in]MaskWidthWidth of the mask.
[in]MaskHeightHeight of the mask.
[in]MaskOffsetXOffset of the mask center relative to the top left corner of the mask.
May be -1 in which case it will be set to width / 2.
[in]MaskOffsetYOffset of the mask center relative to the top left corner of the mask.
May be -1 in which case it will be set to height / 2.
[out]ImgOutImage handle of result image.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
FilterBoxMin, FilterBoxMedian, FilterBoxMean, #TFilterMask
Examples:
C++ Builder - C++ Builder Morphology Example
Visual C++ - VC Filter Example
C# (CSharp) - C# Unsharp Mask Example

◆ FilterBoxMean()

cvbres_t FilterBoxMean ( IMG  ImgIn,
long  MaskWidth,
long  MaskHeight,
long  MaskOffsetX,
long  MaskOffsetY,
IMG ImgOut 
)

Sets each pixel in the output image to the average of all the input image pixels in the rectangular neighborhood.

The neighborhood is defined through the of size MaskHeight and MaskWidth and the anchor cell at that pixel. This has the effect of smoothing or blurring the input image.

Parameters
[in]ImgInHandle of input image.
[in]MaskWidthWidth of the mask.
[in]MaskHeightHeight of the mask.
[in]MaskOffsetXOffset of the mask center relative to the top left corner of the mask.
May be -1 in which case it will be set to width / 2.
[in]MaskOffsetYOffset of the mask center relative to the top left corner of the mask.
May be -1 in which case it will be set to height / 2.
[out]ImgOutImage handle of result image.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
FilterBoxMin, FilterBoxMedian, FilterBoxMax, #TFilterMask
Examples:
C++ Builder - C++ Builder Morphology Example
Visual C++ - VC Filter Example
C# (CSharp) - C# Unsharp Mask Example

◆ FilterBoxMedian()

cvbres_t FilterBoxMedian ( IMG  ImgIn,
long  MaskWidth,
long  MaskHeight,
long  MaskOffsetX,
long  MaskOffsetY,
IMG ImgOut 
)

Sets each pixel in the output image to the median value of all the input pixel values taken in the neighborhood.

The neighborhood of the processed pixel is given by the parameters MaskWidth and MaskHeight, centered around MaskOffsetX and MaskOffsetY.

The median is a statistical value that is determined as follows: Consider a neighbourhood of size n = w * h around the pixel being processed.
If you write the values of all the n pixels in that neighbourhood into an array in increasing pixel intensity, then the median of that intensity distribution is the (n/2)th value (the "middle one") if n is odd, or the average of the (n/2-1)th and the (n/2)th value if n is even.

Parameters
[in]ImgInHandle of input image.
[in]MaskWidthWidth of the mask.
[in]MaskHeightHeight of the mask.
[in]MaskOffsetXOffset of the mask center relative to the top left corner of the mask.
May be -1 in which case it will be set to width / 2.
[in]MaskOffsetYOffset of the mask center relative to the top left corner of the mask.
May be -1 in which case it will be set to height / 2.
[out]ImgOutImage handle of result image.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
FilterBoxMin, FilterBoxMean, FilterBoxMax, #TFilterMask
Examples:
C++ Builder - C++ Builder Morphology Example
Visual C++ - VC Filter Example
C# (CSharp) - C# Unsharp Mask Example

◆ FilterBoxMedianCross()

cvbres_t FilterBoxMedianCross ( IMG  ImgIn,
TFilterMask  MaskType,
IMG ImgOut 
)

Sets each pixel in the output image to the median value of all the input pixel values taken in the neighborhood (cross).

The neighborhood of the processed pixel is given by the parameter MaskType.

Parameters
[in]ImgInHandle of input image.
[in]MaskTypeWidth of mask. Possible values are FM_3x3 and FM_5x5.
[out]ImgOutImage handle of result image.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
FilterBoxMin, FilterBoxMean, FilterBoxMax, #TFilterMask, FilterBoxMedian

◆ FilterBoxMin()

cvbres_t FilterBoxMin ( IMG  ImgIn,
long  MaskWidth,
long  MaskHeight,
long  MaskOffsetX,
long  MaskOffsetY,
IMG ImgOut 
)

Sets each pixel in the output image to the minimum value of all the input image pixel values in the neighborhood.

The neighborhood is defined through the of size MaskHeight and MaskWidth and the anchor cell at that pixel.

Parameters
[in]ImgInHandle of input image.
[in]MaskWidthWidth of the mask.
[in]MaskHeightHeight of the mask.
[in]MaskOffsetXOffset of the mask center relative to the top left corner of the mask.
May be -1 in which case it will be set to width / 2.
[in]MaskOffsetYOffset of the mask center relative to the top left corner of the mask.
May be -1 in which case it will be set to height / 2.
[out]ImgOutImage handle of result image.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
FilterBoxMax, FilterBoxMedian, FilterBoxMean, #TFilterMask
Examples:
C++ Builder - C++ Builder Morphology Example
Visual C++ - VC Filter Example
C# (CSharp) - C# Unsharp Mask Example

◆ FilterCanny()

cvbres_t FilterCanny ( IMG  ImgIn,
long  Index,
TCannyEdgeFilter  Filtering,
long  ThresholdLower,
long  ThresholdUpper,
IMG ImgOut 
)

Finds edges in the source image using the Canny algorithm.

The Canny algorithm proposed by J. Canny in "A Computational Approach to Edge Detection", IEEE Trans. on Pattern Analysis and Machine Intelligence 8(6), 1986.
It takes an input image and produces from it an output image, in which all pixels belonging to detected edges are set to white, the rest to black:

Bracket original
Bracket Canny

The calculation of the output image is a three-staged process:

  1. The input image is differentiated in x and y direction, using a user-selectable derivation operator (either Scharr, Sobel or 2nd order Sobel). From those two derivatives the direction and magnitude of edges can be computed for each pixel of the input image.
  2. The directional information is simplified by assigning the edge one of four sections in the range of to 180°. Then the local maximum along an edge contour are determined, that lie above the upper threshold specified by the user.
  3. The contours are then traced starting from those local maximum using hysteresis thresholding with the lower threshold specified by the user to counter broken edges.
Parameters
[in]ImgInHandle of input image.
[in]IndexPlane index to process Canny operator on.
[in]FilteringFiltering algorithm to be used for building the derivative image. See TCannyEdgeFilter for possible methods.
[in]ThresholdLowerLower threshold for hysteresis thresholding.
[in]ThresholdUpperUpper threshold for edge detection and hysteresis thresholding.
[out]ImgOutImage handle of result image.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
TCannyEdgeFilter
Examples:
C++ Builder - C++ Builder Morphology Example
Visual C++ - VC Filter Example
C# (CSharp) - C# Unsharp Mask Example

◆ FilterGauss()

cvbres_t FilterGauss ( IMG  ImgIn,
TFilterMask  MaskSize,
IMG ImgOut 
)

Applies a square low-pass Gaussian filter to an area of interest of the image.

The corresponding filter kernel is a matrix of either 3x3 or 5x5 elements. \n
The 3x3 filter uses the kernel: 
<table border="0" cellpadding="0">
<tr><td width="50">1/16</td><td width="50">2/16</td><td width="50">1/16</td></tr>
<tr><td>2/16</td><td>4/16</td><td>2/16</td></tr>
<tr><td>1/16</td><td>2/16</td><td>1/16</td></tr>
</table>
These filter coefficients correspond to a 2-dimensional Gaussian distribution with a standard deviation of 0.85. \n\n
The 5x5 filter uses the kernel: 
<table border="0" cellpadding="0">
<tr><td width="50">2/571</td><td width="50">7/571</td><td width="50">12/571</td><td width="50">7/571</td><td width="50">2/571</td></tr>
<tr><td>7/571</td><td>31/571</td><td>52/571</td><td>31/571</td><td>7/571</td></tr>
<tr><td>12/571</td><td>52/571</td><td>127/571</td><td>52/571</td><td>12/571</td></tr>
<tr><td>7/571</td><td>31/571</td><td>52/571</td><td>31/571</td><td>7/571</td></tr>
<tr><td>2/571</td><td>7/571</td><td>12/571</td><td>7/571</td><td>2/571</td></tr>
</table>
These filter coefficients correspond to a 2-dimensional Gaussian distribution with a standard deviation of 1.0. \n\n
Both filters add an isotropic blur to images:
<table border="0">
<tr> <td> <img class="ToDisplay" src="Bracket.gif" align="left"  alt="Bracket original"> </td>

Bracket Gauss

Parameters
[in]ImgInHandle of input image.
[in]MaskSizeMask size to be used. Possible sizes are FM_3x3 and FM_5x5.
[out]ImgOutImage handle of result image.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
#TFilterMask
Examples:
C++ Builder - C++ Builder Morphology Example
Visual C++ - VC Filter Example
C# (CSharp) - C# Unsharp Mask Example

◆ FilterHiPass()

cvbres_t FilterHiPass ( IMG  ImgIn,
TFilterMask  MaskSize,
IMG ImgOut 
)

Applies a high-pass filter to an area of interest of the image.

The corresponding filter kernel is a matrix of either 3x3 or 5x5 elements with the following values:
<table border="0" cellpadding="0">
<tr><td width="50">-1</td><td width="50">-1</td><td width="50">-1</td></tr>
<tr><td>-1</td><td>8</td><td>-1</td></tr>
<tr><td>-1</td><td>-1</td><td>-1</td></tr>
</table>
\n
<table border="0" cellpadding="0">
<tr><td width="50">-1</td><td width="50">-1</td><td width="50">-1</td><td width="50">-1</td><td width="50">-1</td></tr>
<tr><td>-1</td><td>-1</td><td>-1</td><td>-1</td><td>-1</td></tr>
<tr><td>-1</td><td>-1</td><td>24</td><td>-1</td><td>-1</td></tr>
<tr><td>-1</td><td>-1</td><td>-1</td><td>-1</td><td>-1</td></tr>
<tr><td>-1</td><td>-1</td><td>-1</td><td>-1</td><td>-1</td></tr>
</table>
This filter attenuates low-frequency components and leaves only the high-frequency components in the image:  
<table border="0">
<tr> <td> <img class="ToDisplay" src="Bracket.gif" align="left"  alt="Bracket original"> </td>

Bracket HiPass

Negative values are cut off by this filter. An alternative for this filter that preserves also the negative range of results is the FilterLaplace2 function.

Parameters
[in]ImgInHandle of input image.
[in]MaskSizeMask size to be used. Possible sizes are FM_3x3 and FM_5x5.
[out]ImgOutImage handle of result image.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
#TFilterMask, FilterLaplace2
Examples:
C++ Builder - C++ Builder Morphology Example
Visual C++ - VC Filter Example
C# (CSharp) - C# Unsharp Mask Example

◆ FilterLaplace2()

cvbres_t FilterLaplace2 ( IMG  ImgIn,
TFilterMask  MaskSize,
IMG ImgOut 
)

Applies a high-pass Laplace filter to an area of interest of the image. The corresponding filter kernel is a matrix of either 3x3 or 5x5 elements with the following values:

-1-11
-181
-1-11


-1-3-4-3-1
-3060-3
-46206-4
-3060-3
-1-3-4-3-1

This filter helps locate zero crossings in an image.

Bracket original
Bracket Laplace

Other than the function FilterHiPass, the Laplace also preserves the negative result values that can come out of this filter function by scaling the result values' range and adding 128 to the pixel values.

Parameters
[in]ImgInHandle of input image.
[in]MaskSizeMask size to be used. Possible sizes are FM_3x3 and FM_5x5.
[out]ImgOutImage handle of result image.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
#TFilterMask, FilterHiPass
Examples:
C++ Builder - C++ Builder Morphology Example
Visual C++ - VC Filter Example
C# (CSharp) - C# Unsharp Mask Example

◆ FilterLoPass()

cvbres_t FilterLoPass ( IMG  ImgIn,
TFilterMask  MaskSize,
IMG ImgOut 
)

Applies a low-pass filter to an area of interest of the image.

The corresponding filter kernel is a matrix of either 3x3 or 5x5 elements. \n
The 3x3 filter uses the kernel: 
<table border="0" cellpadding="0">
<tr><td width="50">1/9</td><td width="50">1/9</td><td width="50">1/9</td></tr>
<tr><td>1/9</td><td>1/9</td><td>1/9</td></tr>
<tr><td>1/9</td><td>1/9</td><td>1/9</td></tr>
</table>
\n
The 5x5 filter uses the kernel: 
<table border="0" cellpadding="0">
<tr><td width="50">1/25</td><td width="50">1/25</td><td width="50">1/25</td><td width="50">1/25</td><td width="50">1/25</td></tr>
<tr><td>1/25</td><td>1/25</td><td>1/25</td><td>1/25</td><td>1/25</td></tr>
<tr><td>1/25</td><td>1/25</td><td>1/25</td><td>1/25</td><td>1/25</td></tr>
<tr><td>1/25</td><td>1/25</td><td>1/25</td><td>1/25</td><td>1/25</td></tr>
<tr><td>1/25</td><td>1/25</td><td>1/25</td><td>1/25</td><td>1/25</td></tr>
</table>
This filter blurs an image by averaging the pixel values over a neighborhood. 
In principle it is identical with the #FilterBoxMean function, but limited to 3x3 and 5x5 kernels with a central anchor. 
<table border="0">
<tr> <td> <img class="ToDisplay" src="Bracket.gif" align="left"  alt="Bracket original"> </td>

Bracket LoPass

Parameters
[in]ImgInHandle of input image.
[in]MaskSizeMask size to be used. Possible sizes are FM_3x3 and FM_5x5.
[out]ImgOutImage handle of result image.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
#TFilterMask, FilterBoxMean
Examples:
C++ Builder - C++ Builder Morphology Example
Visual C++ - VC Filter Example
C# (CSharp) - C# Unsharp Mask Example

◆ FilterMedianColor()

cvbres_t FilterMedianColor ( IMG  ImgIn,
TFilterMask  MaskType,
IMG ImgOut 
)

Applies the median value considering each color plane.

The function #FilterBoxMedian processes the individual color planes separately, 
and therefore the correlation between the color planes is lost, which results in a change of the colors,
which is often not desirable when working with color images. \n
For each input pixel, this function computes differences between red (R), green (G), and blue (B) color components
of pixels in the mask neighborhood and the input pixel. The distance between the input pixel i and the neighborhood 
pixel j is formed as the sum of absolute values \n\n
abs ( R ( i ) - R ( j )) + abs ( G( i ) - G ( j )) + abs ( B( i ) - B ( j )) \n\n
After scanning the entire neighborhood, the function sets the output value for pixel i as the value
of the neighborhood pixel with the smallest distance to i. The function #FilterMedianColor
supports square masks of size either   3x3 or   5x5 and processes color images only. 
Parameters
[in]ImgInHandle of input image.
[in]MaskTypeMask size to be used. Possible sizes are FM_3x3 and FM_5x5.
[out]ImgOutImage handle of result image.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
#TFilterMask, FilterBoxMean
Examples:
C++ Builder - C++ Builder Morphology Example
Visual C++ - VC Filter Example
C# (CSharp) - C# Unsharp Mask Example

◆ FilterPrewittHorizontal()

cvbres_t FilterPrewittHorizontal ( IMG  ImgIn,
IMG ImgOut 
)

Applies a horizontal Prewitt operator to an area of interest of the image.

The corresponding kernel is a matrix of 3x3 elements with the following values:
<table border="0" cellpadding="0">
<tr><td width="50">1</td><td width="50">1</td><td width="50">1</td></tr>
<tr><td>0</td><td>0</td><td>0</td></tr>
<tr><td>-1</td><td>-1</td><td>-1</td></tr>
</table>
This filter has the effect of leaving only positive horizontal edges in the image (negative results of the filtering process are zeroed out).
For a filter that preserves the negative and positive values, use the #FilterSobelHorizontal and #FilterScharrHorizontal functions.
<table border="0">
<tr> <td> <img class="ToDisplay" src="Bracket.gif" align="left"  alt="Bracket original"> </td>

Bracket Prewitt Horizontal

Parameters
[in]ImgInHandle of input image.
[out]ImgOutImage handle of result image.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
FilterSobelHorizontal, FilterScharrHorizontal
Examples:
C++ Builder - C++ Builder Morphology Example
Visual C++ - VC Filter Example
C# (CSharp) - C# Unsharp Mask Example

◆ FilterPrewittVertical()

cvbres_t FilterPrewittVertical ( IMG  ImgIn,
IMG ImgOut 
)

Applies a vertical Prewitt operator to an area of interest of the image.

The corresponding kernel is a matrix of 3x3 elements with the following values:
<table border="0" cellpadding="0">
<tr><td width="50">-1</td><td width="50">0</td><td width="50">1</td></tr>
<tr><td>-1</td><td>0</td><td>1</td></tr>
<tr><td>-1</td><td>0</td><td>1</td></tr>
</table>
This filter has the effect of leaving only positive vertical edges in the image (negative results of the filtering process are zeroed out).
For a filter that preserves the negative and positive values, use the #FilterSobelVertical and #FilterScharrVertical functions.
<table border="0">
<tr> <td> <img class="ToDisplay" src="Bracket.gif" align="left"  alt="Bracket original"> </td>

Bracket Prewitt Vertical

Parameters
[in]ImgInHandle of input image.
[out]ImgOutImage handle of result image.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
FilterSobelVertical, FilterScharrVertical
Examples:
C++ Builder - C++ Builder Morphology Example
Visual C++ - VC Filter Example
C# (CSharp) - C# Unsharp Mask Example

◆ FilterRobertsDown()

cvbres_t FilterRobertsDown ( IMG  ImgIn,
IMG ImgOut 
)

Applies a horizontal Roberts operator to an image.

The corresponding kernel is a matrix of 3x3 elements with the following values:
<table border="0" cellpadding="0">
<tr><td width="50">0</td><td width="50">0</td><td width="50">0</td></tr>
<tr><td>0</td><td>1</td><td>0</td></tr>
<tr><td>0</td><td>0</td><td>-1</td></tr>
</table>
This filter gives the rough approximation of the pixel values' gradient in the horizontal direction
negative results of the filtering process are zeroed out). 
For a filter that preserves the negative and positive values, use the #FilterSobelHorizontal and #FilterScharrHorizontal functions.
<table border="0">
<tr> <td> <img class="ToDisplay" src="Bracket.gif" align="left"  alt="Bracket original"> </td>

Bracket Roberts Down

Parameters
[in]ImgInHandle of input image.
[out]ImgOutImage handle of result image.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
FilterSobelHorizontal, FilterScharrHorizontal, FilterRobertsUp
Examples:
C++ Builder - C++ Builder Morphology Example
Visual C++ - VC Filter Example
C# (CSharp) - C# Unsharp Mask Example

◆ FilterRobertsUp()

cvbres_t FilterRobertsUp ( IMG  ImgIn,
IMG ImgOut 
)

Applies a vertical Roberts operator to an image.

The corresponding kernel is a matrix of 3x3 elements with the following values:
<table border="0" cellpadding="0">
<tr><td width="50">0</td><td width="50">0</td><td width="50">0</td></tr>
<tr><td>0</td><td>1</td><td>0</td></tr>
<tr><td>-1</td><td>0</td><td>0</td></tr>
</table>
This filter gives the rough approximation of the pixel values' gradient in the vertical direction
negative results of the filtering process are zeroed out). 
For a filter that preserves the negative and positive values, use the #FilterSobelVertical and #FilterScharrVertical functions.
<table border="0">
<tr> <td> <img class="ToDisplay" src="Bracket.gif" align="left"  alt="Bracket original"> </td>

Bracket Roberts Up

Parameters
[in]ImgInHandle of input image.
[out]ImgOutImage handle of result image.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
FilterSobelVertical, FilterScharrVertical, FilterRobertsDown
Examples:
C++ Builder - C++ Builder Morphology Example
Visual C++ - VC Filter Example
C# (CSharp) - C# Unsharp Mask Example

◆ FilterScharrHorizontal()

cvbres_t FilterScharrHorizontal ( IMG  ImgIn,
IMG ImgOut 
)

Applies a horizontal Scharr operator to an image.

The corresponding kernel is a matrix of 3x3 elements with the following values:
<table border="0" cellpadding="0">
<tr><td width="50">3</td><td width="50">10</td><td width="50">3</td></tr>
<tr><td>0</td><td>0</td><td>0</td></tr>
<tr><td>-3</td><td>-10</td><td>-3</td></tr>
</table>
This filter has the effect of simultaneously enhancing and smoothing horizontal edges of an image.
The dynamic range of the output image is adjusted to be 0...255 (with a gray-value of 128 representing zero, 
values below 128 representing negative filter output and values above 128 representing positive filter output).
<table border="0">
<tr> <td> <img class="ToDisplay" src="Bracket.gif" align="left"  alt="Bracket original"> </td>

Scharr Horizontal

Parameters
[in]ImgInHandle of input image.
[out]ImgOutImage handle of result image.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
FilterSobelHorizontal, FilterPrewittHorizontal
Examples:
C++ Builder - C++ Builder Morphology Example
Visual C++ - VC Filter Example
C# (CSharp) - C# Unsharp Mask Example

◆ FilterScharrVertical()

cvbres_t FilterScharrVertical ( IMG  ImgIn,
IMG ImgOut 
)

Applies a vertical Scharr operator to an image.

The corresponding kernel is a matrix of 3x3 elements with the following values:
<table border="0" cellpadding="0">
<tr><td width="50">3</td><td width="50">0</td><td width="50">-3</td></tr>
<tr><td>10</td><td>0</td><td>-10</td></tr>
<tr><td>3</td><td>0</td><td>-3</td></tr>
</table>
This filter has the effect of simultaneously enhancing and smoothing vertical edges of an image.
The dynamic range of the output image is adjusted to be 0...255 (with a gray value of 128 representing zero, 
values below 128 representing negative filter output and values above 128 representing positive filter output).
<table border="0">
<tr> <td> <img class="ToDisplay" src="Bracket.gif" align="left"  alt="Bracket original"> </td>

Scharr Vertical

Parameters
[in]ImgInHandle of input image.
[out]ImgOutImage handle of result image.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
FilterSobelVertical, FilterPrewittVertical
Examples:
C++ Builder - C++ Builder Morphology Example
Visual C++ - VC Filter Example
C# (CSharp) - C# Unsharp Mask Example

◆ FilterSharpening()

cvbres_t FilterSharpening ( IMG  ImgIn,
IMG ImgOut 
)

Applies a sharpening filter to an image.

The corresponding kernel is a matrix of 3x3 elements with the following values:
<table border="0" cellpadding="0"> 
<tr><td width="50">-1/8</td><td width="50">-1/8</td><td width="50">-1/8</td></tr>
<tr><td>-1/8</td><td>16/8</td><td>-1/8</td></tr>
<tr><td>-1/8</td><td>-1/8</td><td>-1/8</td></tr>
</table>
This filter enhances high-frequency components and thereby sharpens an image. 
<table border="0">
<tr> <td> <img class="ToDisplay" src="Bracket.gif" align="left"  alt="Bracket original"> </td>

Sharpening

Parameters
[in]ImgInHandle of input image.
[out]ImgOutImage handle of result image.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Examples:
C++ Builder - C++ Builder Morphology Example
Visual C++ - VC Filter Example
C# (CSharp) - C# Unsharp Mask Example

◆ FilterSobelCross()

cvbres_t FilterSobelCross ( IMG  ImgIn,
TFilterMask  MaskSize,
IMG ImgOut 
)

Applies a second cross derivative Sobel operator to an image.

The corresponding filter kernel is a matrix of either 3x3 or 5x5 elements with the following values:
<table border="0" cellpadding="0">
<tr><td width="50">-1</td><td width="50">0</td><td width="50">1</td></tr>
<tr><td>0</td><td>0</td><td>0</td></tr>
<tr><td>1</td><td>0</td><td>-1</td></tr>
</table>
\n
<table border="0" cellpadding="0">
<tr><td width="50">-1</td><td width="50">-2</td><td width="50">0</td><td width="50">2</td><td width="50">1</td></tr>
<tr><td>-2</td><td>-4</td><td>0</td><td>4</td><td>2</td></tr>
<tr><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>
<tr><td>2</td><td>4</td><td>0</td><td>-4</td><td>-2</td></tr>
<tr><td>1</td><td>2</td><td>0</td><td>-2</td><td>-1</td></tr>
</table>
This filter has the effect of both enhancing and smoothing diagonal edges of an image.
The dynamic range of the output image is adjusted to be 0...255 (with a gray value of 128 representing zero, 
values below 128 representing negative filter output and values above 128 representing positive filter output).
<table border="0">
<tr> <td> <img class="ToDisplay" src="Bracket.gif" align="left"  alt="Bracket original"> </td>

Sobel Cross

Parameters
[in]ImgInHandle of input image.
[in]MaskSizeMask size to be used. Possible sizes are FM_3x3 and FM_5x5.
[out]ImgOutImage handle of result image.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
#TFilterMask
Examples:
C++ Builder - C++ Builder Morphology Example
Visual C++ - VC Filter Example
C# (CSharp) - C# Unsharp Mask Example

◆ FilterSobelHorizontal()

cvbres_t FilterSobelHorizontal ( IMG  ImgIn,
TFilterMask  MaskSize,
IMG ImgOut 
)

Applies a horizontal Sobel operator to an image.

The corresponding filter kernel is a matrix of either 3x3 or 5x5 elements with the following values:
<table border="0" cellpadding="0">
<tr><td width="50">1</td><td width="50">2</td><td width="50">1</td></tr>
<tr><td>0</td><td>0</td><td>0</td></tr>
<tr><td>-1</td><td>-2</td><td>-1</td></tr>
</table>
\n
<table border="0" cellpadding="0">
<tr><td width="50">1</td><td width="50">4</td><td width="50">6</td><td width="50">4</td><td width="50">1</td></tr>
<tr><td>2</td><td>8</td><td>12</td><td>8</td><td>2</td></tr>
<tr><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>
<tr><td>-2</td><td>-8</td><td>-12</td><td>-8</td><td>-2</td></tr>
<tr><td>-1</td><td>-4</td><td>-6</td><td>-4</td><td>-1</td></tr>
</table>
This filter has the effect of both enhancing and smoothing horizontal edges of an image.
The dynamic range of the output image is adjusted to be 0...255 (with a gray value of 128 representing zero, 
values below 128 representing negative filter output and values above 128 representing positive filter output).
<table border="0">
<tr> <td> <img class="ToDisplay" src="Bracket.gif" align="left"  alt="Bracket original"> </td>

Sobel Horizontal

Parameters
[in]ImgInHandle of input image.
[in]MaskSizeMask size to be used. Possible sizes are FM_3x3 and #FM_5x5.
[out]ImgOutImage handle of result image.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
FilterScharrHorizontal, FilterPrewittHorizontal, #TFilterMask
Examples:
C++ Builder - C++ Builder Morphology Example
Visual C++ - VC Filter Example
C# (CSharp) - C# Unsharp Mask Example

◆ FilterSobelHorizontal2ndOrder()

cvbres_t FilterSobelHorizontal2ndOrder ( IMG  ImgIn,
TFilterMask  MaskSize,
IMG ImgOut 
)

Applies a second derivative horizontal Sobel operator to an image.

The corresponding filter kernel is a matrix of either 3x3 or 5x5 elements with the following values:
<table border="0" cellpadding="0">
<tr><td width="50">1</td><td width="50">2</td><td width="50">1</td></tr>
<tr><td>-2</td><td>-4</td><td>-2</td></tr>
<tr><td>1</td><td>2</td><td>1</td></tr>
</table>
\n
<table border="0" cellpadding="0">
<tr><td width="50">1</td><td width="50">4</td><td width="50">6</td><td width="50">4</td><td width="50">1</td></tr>
<tr><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>
<tr><td>-2</td><td>-8</td><td>-12</td><td>-8</td><td>-2</td></tr>
<tr><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>
<tr><td>1</td><td>4</td><td>6</td><td>4</td><td>1</td></tr>
</table>
This filter has the effect of both enhancing and smoothing horizontal edges of an image.
The dynamic range of the output image is adjusted to be 0...255 (with a gray value of 128 representing zero, 
values below 128 representing negative filter output and values above 128 representing positive filter output).
<table border="0">
<tr> <td> <img class="ToDisplay" src="Bracket.gif" align="left"  alt="Bracket original"> </td>

2nd Sobel Horizontal

Parameters
[in]ImgInHandle of input image.
[in]MaskSizeMask size to be used. Possible sizes are FM_3x3 and FM_5x5.
[out]ImgOutImage handle of result image.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
#TFilterMask
Examples:
C++ Builder - C++ Builder Morphology Example
Visual C++ - VC Filter Example
C# (CSharp) - C# Unsharp Mask Example

◆ FilterSobelVertical()

cvbres_t FilterSobelVertical ( IMG  ImgIn,
TFilterMask  MaskSize,
IMG ImgOut 
)

Applies a vertical Sobel operator to an image.

The corresponding filter kernel is a matrix of either 3x3 or 5x5 elements with the following values:
<table border="0" cellpadding="0">
<tr><td width="50">-1</td><td width="50">0</td><td width="50">1</td></tr>
<tr><td>-2</td><td>0</td><td>2</td></tr>
<tr><td>-1</td><td>0</td><td>1</td></tr>
</table>
\n
<table border="0" cellpadding="0">
<tr><td width="50">-1</td><td width="50">-2</td><td width="50">0</td><td width="50">2</td><td width="50">1</td></tr>
<tr><td>-4</td><td>-8</td><td>0</td><td>8</td><td>4</td></tr>
<tr><td>-6</td><td>-12</td><td>0</td><td>12</td><td>6</td></tr>
<tr><td>-4</td><td>-8</td><td>0</td><td>8</td><td>4</td></tr>
<tr><td>-1</td><td>-2</td><td>0</td><td>2</td><td>1</td></tr>
</table>
This filter has the effect of both enhancing and smoothing vertical edges of an image.
The dynamic range of the output image is adjusted to be 0...255 (with a gray value of 128 representing zero, 
values below 128 representing negative filter output and values above 128 representing positive filter output).
<table border="0">
<tr> <td> <img class="ToDisplay" src="Bracket.gif" align="left"  alt="Bracket original"> </td>

Sobel Vertical

Parameters
[in]ImgInHandle of input image.
[in]MaskSizeMask size to be used. Possible sizes are FM_3x3 and FM_5x5.
[out]ImgOutImage handle of result image.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
FilterScharrVertical, FilterPrewittVertical, #TFilterMask
Examples:
C++ Builder - C++ Builder Morphology Example
Visual C++ - VC Filter Example
C# (CSharp) - C# Unsharp Mask Example

◆ FilterSobelVertical2ndOrder()

cvbres_t FilterSobelVertical2ndOrder ( IMG  ImgIn,
TFilterMask  MaskSize,
IMG ImgOut 
)

Applies a second derivative vertical Sobel operator to an image.

The corresponding filter kernel is a matrix of either 3x3 or 5x5 elements with the following values:
<table border="0" cellpadding="0">
<tr><td width="50">1</td><td width="50">-2</td><td width="50">1</td></tr>
<tr><td>2</td><td>-4</td><td>2</td></tr>
<tr><td>1</td><td>-2</td><td>1</td></tr>
</table>
\n
<table border="0" cellpadding="0">
<tr><td width="50">1</td><td width="50">0</td><td width="50">-2</td><td width="50">0</td><td width="50">1</td></tr>
<tr><td>4</td><td>0</td><td>-8</td><td>0</td><td>4</td></tr>
<tr><td>6</td><td>0</td><td>-12</td><td>0</td><td>6</td></tr>
<tr><td>4</td><td>0</td><td>-8</td><td>0</td><td>4</td></tr>
<tr><td>1</td><td>0</td><td>-2</td><td>0</td><td>1</td></tr>
</table>
This filter has the effect of both enhancing and smoothing vertical edges of an image.
The dynamic range of the output image is adjusted to be 0...255 (with a gray value of 128 representing zero, 
values below 128 representing negative filter output and values above 128 representing positive filter output).
<table border="0">
<tr> <td> <img class="ToDisplay" src="Bracket.gif" align="left"  alt="Bracket original"> </td>

2nd Sobel Vertical

Parameters
[in]ImgInHandle of input image.
[in]MaskSizeMask size to be used. Possible sizes are FM_3x3 and FM_5x5.
[out]ImgOutImage handle of result image.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
#TFilterMask
Examples:
C++ Builder - C++ Builder Morphology Example
Visual C++ - VC Filter Example
C# (CSharp) - C# Unsharp Mask Example

◆ FilterUserLinear()

cvbres_t FilterUserLinear ( IMG  ImgIn,
long  KernelWidth,
long  KernelHeight,
long  KernelOffsetX,
long  KernelOffsetY,
double  KernelValues[],
IMG ImgOut 
)

Uses a rectangular kernel of floating-point values to filter an image that consists of integer or floating point data.

This function sums the products between the kernel coefficients KernelValues and pixel values taken over the source pixel neighborhood defined by KernelWidth and KernelHeight and an anchor cell. The anchor cell is specified by its coordinates KernelOffsetX and KernelOffsetY in the coordinate system associated with the bottom right corner of the kernel. The sum is written to the destination pixel.
With this function, lots of filters may be reproduced that are dealt with in specialized functions.

This is an example of an extreme contrast enhancement done using the FilterUserLinear function with the kernel:

-2-2-2
-20-2
-2-2-2
Bracket original
Bracket Custom
Parameters
[in]ImgInHandle of input image.
[in]KernelWidthWidth of the kernel.
[in]KernelHeightHeight of the kernel.
[in]KernelOffsetXOffset of the kernel center relative to the top left corner of the kernel.
[in]KernelOffsetYOffset of the kernel center relative to the top left corner of the kernel.
[in]KernelValuesArray of coefficients.
Attention: Visual Basic 6 users please generate and fill an array, and pass the first element of the array to this function.
[out]ImgOutImage handle of result image.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Examples:
C++ Builder - C++ Builder Morphology Example
Visual C++ - VC Filter Example
C# (CSharp) - C# Unsharp Mask Example

◆ FilterWiener()

cvbres_t FilterWiener ( IMG  ImgIn,
long  MaskWidth,
long  MaskHeight,
long  MaskOffsetX,
long  MaskOffsetY,
double  NoiseThreshold,
IMG ImgOut 
)

Performs adaptive filtering of an image degraded by constant power additive noise.

For each pixel of the input image ImgIn, the function determines the local image mean and variance in the rectangular neighborhood (mask) of size MaskWidth and MaskHeight with the anchor cell centered on the pixel. 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:

Bracket original
Bracket Wiener
Parameters
[in]ImgInHandle of input image.
[in]MaskWidthWidth of the mask.
[in]MaskHeightHeight of the mask.
[in]MaskOffsetXOffset of the mask center relative to the top left corner of the mask.
[in]MaskOffsetYOffset of the mask center relative to the top left corner of the mask.
[in]NoiseThresholdNoise threshold to be applied. Allowable values are in the range [0...1].
[out]ImgOutImage handle of result image.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Examples:
C++ Builder - C++ Builder Morphology Example
Visual C++ - VC Filter Example
C# (CSharp) - C# Unsharp Mask Example