NAME

locate_peaks - locate a nr of peaks in an image

PROTOTYPE

unitptr locate_peaks( int iOperands, int iDx, int iDy, int iNum, int iDist, char *pcOpt, unitptr uHost)

ARGUMENTS

int iOperands
nr of operands; if 0, the result is provided in one large output field
int iDx
image width
int iDy
image height
int iNum
nr of peaks to be found
int iDist
minimal separation required of peaks to be detected
char *pcOpt
option string for future extensions
unitptr uHost
- not documented in source --

INTERFACE:

inp_0[iDx*iDy]
image to use
inp_1[1]
minimal separation (initialized with iDist). A value of 0 will yield the iNum pixels with largest values. In all other cases, the returned peaks will be at least iDist pixels apart and additionally have no neighbors (in their von-Neumann neighborhood) with larger intensity.
inp_2[1]
control pin (0=off). In operator mode, this pin will be initialized to the number iNum of peaks to detect and can then be used to change this limit after the unit has been created. In non-operator mode, the maximal number of peaks will always remain iNum.
out_0[iDim]
pixel coordinates of maximally iNum peaks. In operator mode, iDim=2 and the peaks will be traversed seqentially. In non-operator mode (for iOperands=0 ), iDim=2*iNum, and all peak coordinates will be given simulaneously.
out_1[1]
actual nr of peaks found.

DESCRIPTION:

Returns (iX,iY) locations of iNum largest peaks in image rectangle iDx*iDy such that for iDist>0 the minimal mutual separation is at least iDist pixels and each peak has only neighbors with intensities that are lower or at most equal. For iDist=0, the neighborhood condition is dropped and, as a result, the iNum pixel locations with largest intensities are returned. The coordinates of the detected peaks are returned as a sequence of concatenated (x,y) pairs (pixel positions) in output field 0. The number of detected peaks is returned in the last output field.

ALGORITHM:

Basically, first the brightest pixel is located and a disk of radius iDist is cut out. Then the brightest pixel in the remaining image is located and so on. However, the algorithm does not need iNum passes through the entire image but instead uses a scheme that needs only a small additional amount of computation for each additional peak. For iDist>0, the algorithm compares the pixel values in the von-Neumann neighborhood of the peak against the center value; the peak is rejected, if any of the four neighbor pixel values is larger. For iDist=0, this additional requirement is not made. Note: All maxima have to be local maxima, if you have e.g. a gradient image, only one peak will be detected.

FILE

/amnt/loge/users/nistaff02/nistaff/rhaschke/nst7/man/../o.linux//../foldersrc/nst_pixel.c