KPG1_LOCTx

Locates the centroid of a blob image feature in an n-dimensional array

Description:

This routine locates the centroid of a blob feature within a defined search area in an n-dimensional array about suggested starting co-ordinates, and returns the final centroid position. A blob is a series of connected pixels above or below the value of the surrounding background.

The routine forms marginal profiles within a search square. A separate background estimate is subtracted from each sample in each of the profiles, in order to ensure that he profiles have a roughly flat background. The background estimate used for each profile sample is the lower quartile of the array values which were included in the sample. If this quartile cannot be calculated (in the case of a one-dimensional array, for instance, each sample will have only one contribution and so the quartile cannot be found), the background estimate is taken from a straight line passing through the first and last points of the profile.

A background value for each whole profile is then found, and the centroid of all data above this background level is found. The whole process is repeated a number of times, using the previous centroid position as the new initial guess position. Iterations continue until the maximum number of iterations is reached, or the requested accuracy is met, or until one of several error conditions is met.

Invocation

CALL KPG1_LOCTx( NDIM, LBND, UBND, ARRAY, INIT, SEARCH, POSTIV, MXSHFT, MAXITE, TOLER, FINAL, SEL, WORK1, STATUS )

Arguments

NDIM = INTEGER (Given)
The dimensionality of the n-dimensional array. It must be greater than 1.
LBND( NDIM ) = INTEGER (Given)
The lower bounds of the n-dimensional array.
UBND( NDIM ) = INTEGER (Given)
The upper bounds of the n-dimensional array.
ARRAY( ) = ? (Given)
The input data array.
INIT( NDIM ) = REAL (Given)
The co-ordinates of the initial estimate position.
SEARCH( NDIM ) = INTEGER (Given)
Size of the search region to be used in pixels along each dimension. Each value must be odd and lie in the range 3–51.
POSTIV = LOGICAL (Given)
True if image features are positive above the background.
MXSHFT( NDIM ) = REAL (Given)
Maximum shifts allowable from the initial position along each dimension.
MAXITE = INTEGER (Given)
Maximum number of iterations to be used. At least one iteration will be performed even if this is less than one.
TOLER = REAL (Given)
Accuracy required in the centroid position.
SEL = INTEGER (Given)
The number of elements in a search box (i.e. the product of the values in SEARCH).
FINAL( NDIM ) = REAL (Returned)
The final co-ordinates of the centroid position.
WORK1( 51, SEL, NDIM ) = REAL (Returned)
A work array.
STATUS = INTEGER (Given and Returned).
Global status value

Notes:

Bugs:

{note_bugs_here}