ComfyUI Node
cv2.erode
Raw wrapper of cv2.erode(src, kernel, anchor?, iterations?, borderType?, borderValue?). Parameters marked '?' are optional; blank means OpenCV default. See the OpenCV documentation for details.
cv2.erode
- src
- kernel
- anchor
- result
◄iterations1►
◄borderTypeBORDER_DEFAULT►
◄borderValue►
Categoryimage/CV/low-level/cv2 E
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| src | COMFY_MATCHTYPE_V3 | input image; the number of channels can be arbitrary, but the depth should be one of CV_8U, CV_16U, CV_16S, CV_32F or CV_64F. The image output(s) echo this input's format. A LATENT link is processed in latent space: frame 0 becomes a float32 [H,W,C] array (any channel count), values untouched. Arithmetic ops (add, multiply, etc.) also accept a full LATENT batch ({samples: [B,C,H,W]}) — the whole batch flows through when both inputs have the same batch size. 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. | |
| kernel | NPARRAY | structuring element used for erosion; if `kernel=Mat()`, a `3 x 3` rectangular structuring element is used. Kernel can be created using #getStructuringElement. A data array (points / matrix), NOT an image - only an NPARRAY link is accepted here. | |
| anchoropt | CV_TUPLE | -1,-1 | position of the anchor within the element; default value (-1, -1) means that the anchor is at the element center. One value with 2 components (x, y) - it travels as a whole, so it cannot arrive half-connected. Wire it from 'CV Tuple' or type the components in place. |
| iterationsopt | INT | 1-2147483648–2147483647 | number of times erosion is applied. Preset to the OpenCV default (1). |
| borderTypeopt | COMBO | BORDER_DEFAULT | pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported. |
| borderValueopt | STRING | border value in case of a constant border cv2 Scalar as a literal, e.g. "(0, 255, 0)" (BGR) or "(0, 255, 0, 64)" (BGRA). A bare number broadcasts to every component, so "255" means (255, 255, 255, 255). Components past the target's channel count are ignored by OpenCV. Leave blank for the OpenCV default. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| result | COMFY_MATCHTYPE_V3 | Echoes the 'src' input's format: an IMAGE link comes back as IMAGE, MASK as MASK, NPARRAY stays NPARRAY. |