ComfyUI Node
cv2.distanceTransform
Raw wrapper of cv2.distanceTransform(src, distanceType, maskSize, dstType?). Parameters marked '?' are optional; blank means OpenCV default. See the OpenCV documentation for details.
cv2.distanceTransform
- src
- nparray
◄distanceTypeDIST_L2►
◄maskSize0►
◄dstTypeCV_32F►
Categoryimage/CV/low-level/cv2 D
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| src | NPARRAY,IMAGE,MASK | 8-bit, single-channel (binary) source image. Accepts a ComfyUI IMAGE/MASK directly (frame 0 of a batch) or an NPARRAY. Arithmetic ops (add, multiply, etc.) process the full IMAGE batch when both inputs have the same batch size. | |
| distanceType | COMBO | DIST_L2 | Type of distance, see #DistanceTypes |
| maskSize | INT | 0-2147483648–2147483647 | Size of the distance transform mask, see #DistanceTransformMasks. In case of the #DIST_L1 or #DIST_C distance type, the parameter is forced to 3 because a $3\times 3$ mask gives the same result as $5\times 5$ or any larger aperture. |
| dstTypeopt | COMBO | CV_32F | Type of output image. It can be CV_8U or CV_32F. Type CV_8U can be used only for the first variant of the function and distanceType == #DIST_L1. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| nparray | NPARRAY | — |