CogBlobSegmentationParams SetSegmentationSoftRelativeThreshold Method Cognex VisionPro 9.5
Sets the segmentation Mode to SoftRelativeThreshold and sets the TailLow, TailHigh, SoftRelativeThresholdLow, SoftRelativeThresholdHigh, Softness, & Polarity properties to the values supplied.

Namespace: Cognex.VisionPro.Blob
Assembly: Cognex.VisionPro.Blob (in Cognex.VisionPro.Blob.dll) Version: 69.0.0.0
Syntax

public void SetSegmentationSoftRelativeThreshold(
	int tailLow,
	int tailHigh,
	int softRelativeThresholdLow,
	int softRelativeThresholdHigh,
	int softness,
	CogBlobSegmentationPolarityConstants polarity
)

Parameters

tailLow
Type: System Int32
The percentage of high tail pixels to discard before computing the threshold.
tailHigh
Type: System Int32
The percentage of high tail pixels to discard before computing the threshold.
softRelativeThresholdLow
Type: System Int32
Soft relative thresholding computes a low soft threshold value by determining the pixel value which lies at the supplied percentage of the distance between the low tail pixel value and the high tail pixel value. Pixel values that are less than the computed low threshold are assigned a blob weight of 0 when polarity indicates light blobs. Pixel values that are less than the computed low threshold are assigned a blob weight of 1 when polarity indicates dark blobs.
softRelativeThresholdHigh
Type: System Int32

Soft relative thresholding computes a high soft threshold value by determining the pixel value which lies at the specified percentage of the distance between the low tail pixel value and the high tail pixel value. When polarity indicates light blobs, pixel values that are greater than the computed high threshold are assigned a blob weight equal to 1. The range of pixel values between the computed low and high threshold is divided into softness equally sized ranges. Pixels with values in each of these ranges are assigned values between 1 and softness. A segmentation value of softness+1 corresponds to a blob weight of one while all other segmentation values are interpreted on a linear scale relative to softness+1.

Pixel values that are greater than or equal to the computed high threshold are assigned a blob weight of 0 when polarity indicates dark blobs.

softness
Type: System Int32
The number of intermediate weights separating blobs(1) an background(0). Pixel values between the low and high threshold are assigned a blob weight between 0.0 and 1.0, exclusive.
polarity
Type: Cognex.VisionPro.Blob CogBlobSegmentationPolarityConstants
Specify DarkBlobs for dark blobs on a light background or LightBlobs for light blobs on a dark background.
Exceptions

ExceptionCondition
ArgumentExceptiontailLow, tailHigh, softRelativeThresholdLow, or softRelativeThresholdHigh is less than 0 or greater than 100.
ArgumentExceptiontailLow plus tailHigh is greater than 100.
ArgumentExceptionsoftRelativeThresholdLow is greater than softRelativeThresholdHigh.
ArgumentExceptionsoftness is less than 0 or greater than 254.
ArgumentExceptionpolarity is neither DarkBlobs nor LightBlobs.
Remarks

Sets the segmentation Mode to SoftRelativeThreshold and sets TailLow, TailHigh, SoftRelativeThresholdLow, SoftRelativeThresholdHigh, Softness, and Polarity to the values supplied.

This function suspends event delivery, then sets the public properties of CogBlobSegmentationParams with the supplied values. A single event that includes all of the affected functional area is typically generated.

See Also