DistanceTransform
Computes an image in which the pixel values denote the estimated distances to the nearest bright pixel in the input image.
Applications:This is an initial step of some advanced traditional image analysis algorithms.
Syntax
C++
C#
Python
def DistanceTransform( inImage: Image, outImage: Image, /, *, inThreshold: int = 128, inStraightDistance: float = 1.0, inDiagonalDistance: float = 1.414, inMaxDistance: float = 255.0 ) -> None
Parameters
| Name | Type | Range | Default | Description | |
|---|---|---|---|---|---|
![]() |
inImage | Image | Input image | ||
![]() |
inThreshold | int | 0 - +![]() |
128 | Minimal brightness above which pixels are called bright |
![]() |
inStraightDistance | float | 0.0 - ![]() |
1.0 | Distance between two neighboring in a row or a column pixels |
![]() |
inDiagonalDistance | float | 0.0 - ![]() |
1.414 | Distance between two pixels connected by vertices |
![]() |
inMaxDistance | float | 0.0 - ![]() |
255.0 | Maximum value of the calculated distance |
![]() |
outImage | Image | Output distance image |



