Image Distance Transform

Function: Calculates the distance of all pixels in a binary image to their nearest pixel with a value of 0, reflecting the distance relationship between each pixel and the background. It can be used to calculate the center of objects, refine contours, and obtain the image foreground.

Input Parameters:

Name Type Valid Range Default Value Meaning

Binarized image

BinaryImage

None

None

Binarized image

Output Parameters:

Name Type Valid Range Default Value Meaning

Result image

BinaryImage

None

None

Result image

Parameter Settings:

Name Type Valid Range Default Value Meaning

Distance type

String

['cv2.DIST_L1', 'cv2.DIST_L2', 'cv2.DIST_C']

cv2.DIST_L2

Distance type

Mask size

Integer

[3, 5]

5

Mask size