|
distance
|
|
| integer Invert =FALSE )
|
|
|
| Input
|
|
|
| An integer between 1 and 116 specifying the input image frame number. Values in the range of 100-116 correspond to hidden frames.
|
|
|
| Output
|
|
|
| An integer between 1 and 116 specifying the output image frame number. Values in the range of 100-116 correspond to hidden frames.
|
|
|
| Mode
|
|
|
| An enumerated integer that describes the metric used to calculate a distance:
|
|
|
| M_CITY=0 uses a 4-connected metric (city block). Only vertical and horizontal movements are allowed.
|
| M_CHESS=1 uses an 8-connected metric (chess board). Vertical, horizontal and horizontal movements are allowed.
|
| M_CHAMFER=2 uses an 8-connected metric where vertical and horizontal movements are weighted with a weight of 3, while diagonal movements are weighted with a weight of 4.
|
| M_EUCLID=3 approximates Euclidian distance.
|
|
|
| Multiphase
|
|
|
| A boolean integer specifying weather the output image must be of the 16-bit grayscale or multiphase type. Must be one of the following values:
|
|
|
| FALSE=0 creates a 16-bit grayscale output image
|
| TRUE=1 creates a multiphase output image which makes a distance map more perceptible due to steep color differences between adjacent levels, but limits it to the maximum distance of 256 pixels.
|
| Default value: FALSE
|
|
|
| Invert
|
|
|
| A boolean integer specifying weather the distance map must be computed for foreground or background pixels.
|
|
|
| FALSE=0 computes the distance map for foreground pixels. Each pixel in the output image is assigned a value equal to its distance from the nearest background pixel in the input image.
|
| TRUE=1 computes the distance map for background pixels. Each pixel in the output image is assigned a value equal to its distance from the nearest foreground pixel in the input image.
|
| Default value: FALSE.
|
|
|
|
|
| ERR_OK
|
|
|
| The flag set if successful.
|
|
|
| ERR_FAILED
|
|
|
| The flag set if failed.
|
| This set of statements binarizes a sample image and builds its distance map in two form, 16-bit grayscale and multiphase:.
|
|
|
| setCurDir ("samples")
|
| loadIm (1,"sample25.iwd")
|
| threshold(1,1,M_PRESET,180.,255.,TRUE,FALSE)
|
| fill(1,1)
|
| distance(1,2,M_EUCLIDIAN)
|
| distance (1,3,M_EUCLIDIAN,TRUE)
|