DIPlib Documentation - ©1995-2015 Quantitative Imaging Group, Delft University of Technology.

# SubpixelLocation

Gets coordinates of an extremum with sub-pixel precision

## SYNOPSIS

`#include "dip_analysis.h"`

dip_Error dip_SubpixelLocation ( in, pos, coords, val, method, polarity )

## DATA TYPES

integer, float

## FUNCTION

Determines the sub-pixel location of a local maximum or minimum close to `pos`. `pos` should point to a pixel that is larger than its direct neighbours (if `polarity` is `DIP_SEP_MAXIMUM`) or smaller than its direct neighbours (`polarity` is `DIP_SEP_MINIMUM`). `coords` will contain the the sub-pixel location of this local extremum. `val` will contain the interpolated grey value at the location of the extremum. `method` determines which method is used.

## ARGUMENTS

Data type | Name | Description
`dip_Image` | `in` | Input grayscale image
`dip_IntegerArray` | `pos` | Input coordinates
`dip_FloatArray` | `coords` | Output coordinates
`dip_float*` | `val` | Output grey value
`dipf_SubpixelExtremumMethod` | `method` | Sub-pixel detection method
`dipf_SubpixelExtremumPolarity` | `pol` | Maximum or minimum?

The `dipf_SubpixelExtremumMethod` flag can be any of these values:

Name | Description
`DIP_SEM_DEFAULT` | Same as `DIP_SEM_PARABOLIC_SEPARABLE`.
`DIP_SEM_LINEAR` | Computes the center of gravity of 3 pixels around the extremum, in each dimension independently. The `val` returned is that of the pixel at `pos`.
`DIP_SEM_PARABOLIC_SEPARABLE` | Fits a parabola to 3 pixels around the extremum, for each dimension independently. The `val` returned is the maximum (minimum) value of these 1D extrema, and thus not equivalent to the grey value obtained by true interpolation.
`DIP_SEM_PARABOLIC` | Fits a parabolic patch to a region 3x3 or 3x3x3 pixels around the extremum (only for 2D or 3D images).
`DIP_SEM_GAUSSIAN_SEPARABLE` | Same as `DIP_SEM_PARABOLIC_SEPARABLE`, but using the log of the pixel values, very accurate if peak is a Gaussian.
`DIP_SEM_GAUSSIAN` | Same as `DIP_SEM_PARABOLIC`, but using the log of the pixel values (only for 2D or 3D images).
`DIP_SEM_BSPLINE` | Fits a B-spline to 11 pixels around the extremum, in each dimension independently. The `val` returned is the maximum (minimum) value of these 1D extrema, and thus not equivalent to the grey value obtained by true interpolation

## SEE ALSO

`SubpixelMaxima`, `SubpixelMinima`