CVB.Net 14.0
Threshold Class Reference

Thresholding functions in the Common Vision Blox Foundation Package. More...

Static Public Member Functions

static Image Static (Image img, double[] values, StaticThresholding comparison)
 Create an output image that is the result of static thresholding. More...
 
static Image Static (Image img, Image thresholds, StaticThresholding comparison)
 This function performs thresholding of an input image with pixel-by-pixel thresholds stored in the pixels of a thresholds image. More...
 
static Image Dynamic (Image img, int windowSize, int threshold)
 This function performs dynamic thresholding on the input image with the DynamicThresholdNorm.Mean norm. More...
 
static Image Dynamic (Image img, int windowSize, int threshold, DynamicThresholdNorm norm)
 This function performs dynamic thresholding on the input image. More...
 
static Image StaticTransparent (Image img, StaticThresholding comparison, double[] thresholds)
 Create a thresholded image using a transparency approach. More...
 
static Image StaticTransparent (Image img, StaticThresholding comparison, double[] thresholds, double[] values)
 Create a thresholded image using a transparency approach. More...
 
static void RangeThresholdToDst (ImagePlane plane, ValueRange< int > range, Image dst, Rect aoi)
 Apply the blob analyzer's binarization algorithm to the given input plane . More...
 
static void RangeThresholdToDst (ImagePlane plane, ValueRange< int > range, Image dst)
 Apply the blob analyzer's binarization algorithm to the given input plane . /// More...
 
static Image RangeThreshold (ImagePlane plane, ValueRange< int > range, Rect aoi)
 Apply the blob analyzer's binarization algorithm to the given input plane and returns a new binarized image. More...
 
static Image RangeThreshold (ImagePlane plane, ValueRange< int > range)
 Apply the blob analyzer's binarization algorithm to the given input plane and returns a new binarized image. More...
 

Detailed Description

Thresholding functions in the Common Vision Blox Foundation Package.

Member Function Documentation

◆ Dynamic() [1/2]

static Image Dynamic ( Image  img,
int  windowSize,
int  threshold 
)
static

This function performs dynamic thresholding on the input image with the DynamicThresholdNorm.Mean norm.

Dynamic thresholding works such that for each pixel of the input image, the average gray value over a mask with given size (centered around the pixel in question) is calculated. If the difference between this average and the pixel that is currently being looked at is above the specified threshold, then the corresponding pixel in the output image is set to white, otherwise it is black.

This function is particularly useful when dealing with images that have a non-uniform illumination.

Parameters
imgImage to be thresholded.
windowSizeWindow size to be for calculating the dynamic threshold.Bigger window sizes will lead to higher processing times.
thresholdThreshold offset to use
Returns
The thresholded image.
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ Dynamic() [2/2]

static Image Dynamic ( Image  img,
int  windowSize,
int  threshold,
DynamicThresholdNorm  norm 
)
static

This function performs dynamic thresholding on the input image.

Dynamic thresholding works by calculating the average gray value over a mask with given size(centered around the pixel in question) for each input pixel. If the difference between this average and the pixel, that is currently being looked at, is above the specified threshold, then the corresponding pixel in the output image is set to white, otherwise it is black.

This function is particularly useful, when dealing with images, that have a non-uniform illumination.

Parameters
imgImage to be thresholded.
windowSizeWindow size to calculate the dynamic threshold.Bigger window sizes will lead to higher processing times.
thresholdThreshold offset to use
normEither DynamicThresholdNorm.Mean or DynamicThresholdNorm.MinMax.
Returns
The thresholded image.
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ RangeThreshold() [1/2]

static Image RangeThreshold ( ImagePlane  plane,
ValueRange< int >  range 
)
static

Apply the blob analyzer's binarization algorithm to the given input plane and returns a new binarized image.

Parameters
planeImage plane to binarize
rangeThe gray value range for binarization.
Returns
Resulting binarized image.

◆ RangeThreshold() [2/2]

static Image RangeThreshold ( ImagePlane  plane,
ValueRange< int >  range,
Rect  aoi 
)
static

Apply the blob analyzer's binarization algorithm to the given input plane and returns a new binarized image.

Parameters
planeImage plane to binarize
rangeThe gray value range for binarization.
aoiArea of interest to binarize.
Returns
Resulting binarized image.

◆ RangeThresholdToDst() [1/2]

static void RangeThresholdToDst ( ImagePlane  plane,
ValueRange< int >  range,
Image  dst 
)
static

Apply the blob analyzer's binarization algorithm to the given input plane . ///

Parameters
planeImage plane to binarize
rangeThe gray value range for binarization.
dstDestination image to receive the binarization result. This image must have one plane only with 8 bits per pixel and be compatible with the input plane in terms of size.

◆ RangeThresholdToDst() [2/2]

static void RangeThresholdToDst ( ImagePlane  plane,
ValueRange< int >  range,
Image  dst,
Rect  aoi 
)
static

Apply the blob analyzer's binarization algorithm to the given input plane .

Please note that despite the fact that it is possible to specify an area of interest, the binarized data will always be located in the top left corner of the image.

Parameters
planeImage plane to binarize
rangeThe gray value range for binarization.
dst
Parameters
aoiArea of interest to binarize.

Destination image to receive the binarization result.

This image must have one plane only with 8 bits per pixel and be compatible with the input aoi in terms of size.

◆ Static() [1/2]

static Image Static ( Image  img,
double[]  values,
StaticThresholding  comparison 
)
static

Create an output image that is the result of static thresholding.

Parameters
imgImage to apply static thresholding to.
valuesThreshold values - the array must contain at least one threshold per plane available in the image.
comparisonComparison method.
Returns
The thresholded image.
Exceptions
ArgumentNullExceptionIf the input img is null or the values array is null
ObjectDisposedExceptionIf the input img has already been disposed
ArgumentExceptionIf the values array does not contain enough values

◆ Static() [2/2]

static Image Static ( Image  img,
Image  thresholds,
StaticThresholding  comparison 
)
static

This function performs thresholding of an input image with pixel-by-pixel thresholds stored in the pixels of a thresholds image.

Both images should be identical in size. However, if they are not, the smallest common rectangle (located at the top left pixel) of both images will be the size of the result image. Both input images should have identical dimensions (either 1 or 3 planes per image) and identical data types.

Parameters
imgImage to be thresholded.
thresholdsImage containing the threshold values for the pixels of the input img .
comparisonComparison to apply
Returns
The thresholded image.
Exceptions
ArgumentNullExceptionIf the input img or thresholds is null.
ObjectDisposedExceptionIf the input img or thresholds has already been disposed.

◆ StaticTransparent() [1/2]

static Image StaticTransparent ( Image  img,
StaticThresholding  comparison,
double[]  thresholds 
)
static

Create a thresholded image using a transparency approach.

In the result image every pixel, that violates the comparison to its threshold, will be assigned the threshold value. All others will be assigned the same value, they had in the input image.

Parameters
imgInput image
thresholdsThresholds to apply (one per plane).
comparisonThresholding condition.
Returns
The thresholded image.
Exceptions
ArgumentNullExceptionIf img , or thresholds is null.
ObjectDisposedExceptionIf img has been disposed.
ArgumentExceptionIf thresholds has too few elements.

◆ StaticTransparent() [2/2]

static Image StaticTransparent ( Image  img,
StaticThresholding  comparison,
double[]  thresholds,
double[]  values 
)
static

Create a thresholded image using a transparency approach.

In the result image every pixel, that violates the comparison to its threshold, will be assigned the specified value. All others will be assigned the same value, they had in the input image.

Parameters
imgInput image
thresholdsThresholds to apply (one per plane).
valuesValue to set for pixels, that violate the thresholding condition (one per plane required).
comparisonThresholding condition.
Returns
The thresholded image.
Exceptions
ArgumentNullExceptionIf img , thresholds or values is null.
ObjectDisposedExceptionIf img has been disposed.
ArgumentExceptionIf thresholds or values have too few elements.