You are here: Start » AVL.NET » Function Reference » Computer Vision » Image Segmentation » AVL.SegmentImage_Gray_Linear


Segments an image into blobs examining differences between pixels values.



public static void SegmentImage_Gray_Linear
	AvlNet.Image inImage,
	NullableRef<AvlNet.Region> inRoi,
	AvlNet.BlobMergingMethod inMergingMethod,
	AvlNet.RegionConnectivity inConnectivity,
	int inMaxDifference,
	int inHysteresis,
	int inPassCount,
	bool inDirectional,
	int inMinArea,
	int? inMaxArea,
	IList<AvlNet.Region> outBlobs


Name Type Range Default Description
inImageAvlNet.ImageInput image.
inRoiAvlNet.NullableRef<AvlNet.Region>Range of pixels to be processed. Default value: atl::NIL.
inMergingMethodAvlNet.BlobMergingMethodNeighborDefines a criterion by which two pixels can be merged into one blob. Default value: Neighbor.
inConnectivityAvlNet.RegionConnectivityDefines if pixels can be merged only horizontally and vertically, or also diagonally.
inMaxDifferenceint<0, INF>5Maximal tonal difference that allows two pixels to be merged into one blob. Default value: 5.
inHysteresisintTotal change of MaxDifference during all image passes.
inPassCountint<1, 5>Number of iterations in which the entire image is scanned for pixels that can be merged.
inDirectionalboolWhen 'True' the filter can segment results of GradientDirAndPresenceImage.
inMinAreaint<0, INF>20Minimal area of a blob that may be accepted. Default value: 20.
inMaxAreaint?Minimal area of a blob that may be accepted. Default value: atl::NIL.


The filter segments the inImage image into blobs of pixels which gray values do not differ too much. The classification is different depending on the inMergingMethod input:

  • Neighbor – two adjacent pixels are considered to belong to the same blob when their values differ by at most inMaxDifference
  • NeighborVerified – as above, but an additional verification is performed to avoid undersegmentation
  • Mean – pixel is considered to belong to an adjacent blob when its value differs by at most inMaxDifference from the mean value of this blob's pixels
  • MeanSorted – not implemented in this filter


SegmentImage_Gray_Linear performed on the sample image with inMaxDifference = 55, inMergingMethod = MeanLinear and inMinArea = 50.


List of possible exceptions:

Error type Description
DomainError Directional method only supports single-channel images.
DomainError Directional method only supports UInt8 images.
DomainError Two- and four-channel images are not supported in SegmentImage_Gray.
DomainError Not supported inImage pixel format in SegmentImage_Gray_Linear. Supported formats: 1xUInt8, 1xInt8, 1xUInt16, 1xInt16, 1xInt32, 1xReal, 3xUInt8, 3xInt8, 3xUInt16, 3xInt16, 3xInt32, 3xReal.

Function Overrides

See also