A high-performance general-purpose compute library

Segment image based on similar pixel characteristics. More...

Functions

AFAPI array confidenceCC (const array &in, const array &seeds, const unsigned radius, const unsigned multiplier, const int iter, const double segmentedValue)
 C++ Interface for confidence connected components. More...
 
AFAPI array confidenceCC (const array &in, const array &seedx, const array &seedy, const unsigned radius, const unsigned multiplier, const int iter, const double segmentedValue)
 C++ Interface for confidence connected components. More...
 
AFAPI array confidenceCC (const array &in, const size_t num_seeds, const unsigned *seedx, const unsigned *seedy, const unsigned radius, const unsigned multiplier, const int iter, const double segmentedValue)
 C++ Interface for confidence connected components. More...
 
AFAPI af_err af_confidence_cc (af_array *out, const af_array in, const af_array seedx, const af_array seedy, const unsigned radius, const unsigned multiplier, const int iter, const double segmented_value)
 C Interface for confidence connected components. More...
 

Detailed Description

Segment image based on similar pixel characteristics.

This filter is similar to af::regions() (connected components) with additional criteria for segmentation. In af::regions(), all connected (af_connectivity) pixels connected are considered to be a single component. In this variation of connected components, pixels having similar pixel statistics of the neighborhoods around a given set of seed points are grouped together.

The parameter radius determines the size of neighborhood around a seed point.

Mean ( \( \mu \)) and Variance ( \( \sigma^2 \)) are the pixel statistics that are computed across all neighborhoods around the given set of seed points. The pixels which are connected to seed points and lie in the confidence interval ( \( [\mu - \alpha * \sigma, \mu + \alpha * \sigma] \) where \( \alpha \) is the parameter multiplier) are grouped. multiplier can be used to control the width of the confidence interval.

This filter follows an iterative approach for fine tuning the segmentation. An initial segmenetation followed by a finite number (iter) of segmentations are performed. The user provided parameter iter is only a request and the algorithm can prempt the execution if \( \sigma^2 \) approaches zero. The initial segmentation uses the mean and variance calculated from the neighborhoods of all the seed points. For subsequent segmentations, all pixels in the previous segmentation are used to re-calculate the mean and variance (as opposed to using the pixels in the neighborhood of the seed point).

Given below is a sample output for segmenting three different regions of a donut using single seed.

Confidence Connected Components Example

Function Documentation

◆ af_confidence_cc()

AFAPI af_err af_confidence_cc ( af_array out,
const af_array  in,
const af_array  seedx,
const af_array  seedy,
const unsigned  radius,
const unsigned  multiplier,
const int  iter,
const double  segmented_value 
)

C Interface for confidence connected components.

Parameters
[out]outis the output af_array having the connected components
[in]inis the input image, expects non-integral (float/double) typed af_array
[in]seedxis an af_array of x coordinates of the seed points
[in]seedyis an af_array of y coordinates of the seed points
[in]radiusis the neighborhood region to be considered around each seed point
[in]multipliercontrols the threshold range computed from the mean and variance of seed point neighborhoods
[in]iteris number of iterations
[in]segmented_valueis the value to which output array valid pixels are set to.
Returns
AF_SUCCESS if the execution is successful, otherwise an appropriate error code is returned.

◆ confidenceCC() [1/3]

AFAPI array confidenceCC ( const array in,
const array seeds,
const unsigned  radius,
const unsigned  multiplier,
const int  iter,
const double  segmentedValue 
)

C++ Interface for confidence connected components.

Parameters
[in]inis the input image, expects non-integral (float/double) typed af_array
[in]seedsis an af::array of x & y coordinates of the seed points with coordinate values along columns of this af::array i.e. they are not stored in interleaved fashion.
[in]radiusis the neighborhood region to be considered around each seed point
[in]multipliercontrols the threshold range computed from the mean and variance of seed point neighborhoods
[in]iteris number of iterations
[in]segmentedValueis the value to which output array valid pixels are set to.
Returns
out is the output af_array having the connected components

◆ confidenceCC() [2/3]

AFAPI array confidenceCC ( const array in,
const array seedx,
const array seedy,
const unsigned  radius,
const unsigned  multiplier,
const int  iter,
const double  segmentedValue 
)

C++ Interface for confidence connected components.

Parameters
[in]inis the input image, expects non-integral (float/double) typed af_array
[in]seedxis an af::array of x coordinates of the seed points
[in]seedyis an af::array of y coordinates of the seed points
[in]radiusis the neighborhood region to be considered around each seed point
[in]multipliercontrols the threshold range computed from the mean and variance of seed point neighborhoods
[in]iteris number of iterations
[in]segmentedValueis the value to which output array valid pixels are set to.
Returns
out is the output af_array having the connected components

◆ confidenceCC() [3/3]

AFAPI array confidenceCC ( const array in,
const size_t  num_seeds,
const unsigned *  seedx,
const unsigned *  seedy,
const unsigned  radius,
const unsigned  multiplier,
const int  iter,
const double  segmentedValue 
)

C++ Interface for confidence connected components.

Parameters
[in]inis the input image, expects non-integral (float/double) typed af_array
[in]num_seedsis the total number of seeds
[in]seedxis an array of x coordinates of the seed points
[in]seedyis an array of y coordinates of the seed points
[in]radiusis the neighborhood region to be considered around each seed point
[in]multipliercontrols the threshold range computed from the mean and variance of seed point neighborhoods
[in]iteris number of iterations
[in]segmentedValueis the value to which output array valid pixels are set to.
Returns
out is the output af_array having the connected components