Back to Aurora Vision Library website

You are here: Start » Function Reference » Computer Vision » Image Segmentation » SegmentImage_Gray


Header: AVL.h
Namespace: avl
Module: FoundationPro

Segments an image into blobs examining differences between neighbouring pixels values.

Applications: Detection of objects of undefined shape, but characterized by uniform brightness and good contrast to the background.


void avl::SegmentImage_Gray
	const avl::Image& inImage,
	atl::Optional<const avl::Region&> inRoi,
	const float inMaxDifference,
	const avl::BlobsDifferenceMeasure::Type inDifferenceMeasure,
	const int inMinArea,
	atl::Optional<int> inMaxArea,
	atl::Array<avl::Region>& outBlobs


Name Type Range Default Description
Input value inImage const Image& Image from which blobs are extracted
Input value inRoi Optional<const Region&> NIL Range of pixels to be processed
Input value inMaxDifference const float 0.0 - 5.0f Maximal difference between two neighbouring blobs to be merged
Input value inDifferenceMeasure const BlobsDifferenceMeasure::Type Neighbour Measure of blobs difference
Input value inMinArea const int 0 - 50 Minimal area of a blob
Input value inMaxArea Optional<int> 0 - NIL Maximal area of a blob
Output value outBlobs Array<Region>& Blobs extracted from the input image


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

  • if Mean is selected, 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
  • if Neighbour is selected, two adjacent pixels are considered to belong to the same blob when their values differ by at most inMaxDifference


SegmentImage_Gray performed on the sample image with inMaxDifference = 55, inDifferenceMeasure = Mean and inMinArea = 50.


List of possible exceptions:

Error type Description
DomainError Not supported difference measure in SegmentImage_Gray.

See Also