ComfyUI Node
cv2.thresholdWithMask
Raw wrapper of cv2.thresholdWithMask(src, dst, mask, thresh, maxval, type). Parameters marked '?' are optional; blank means OpenCV default. See the OpenCV documentation for details.
cv2.thresholdWithMask
- src
- dst
- mask
- float
- result
◄thresh0.0000►
◄maxval0.0000►
◄typeTHRESH_BINARY►
Categoryimage/CV/low-level/cv2 T
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| src | COMFY_MATCHTYPE_V3 | input array (multiple-channel, 8-bit or 32-bit floating point). The image output(s) echo this input's format. 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. | |
| dst | NPARRAY,IMAGE,MASK | output array of the same size and type and the same number of channels as src. The low-level cv2 function writes its result into this array in place, but this wrapper passes cv2 a private copy, so your input array is never modified. 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. | |
| mask | NPARRAY,IMAGE,MASK | optional mask (same size as src, 8-bit). 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. | |
| thresh | FLOAT | 0.0000-1e+38–1e+38 | threshold value. |
| maxval | FLOAT | 0.0000-1e+38–1e+38 | maximum value to use with the #THRESH_BINARY and #THRESH_BINARY_INV thresholding types. |
| type | STRING | THRESH_BINARY | thresholding type (see #ThresholdTypes). cv2.thresholdWithMask flags: one of THRESH_BINARY, THRESH_BINARY_INV, THRESH_TRUNC, THRESH_TOZERO, THRESH_TOZERO_INV plus any of THRESH_OTSU, THRESH_TRIANGLE, pipe-joined (e.g. "THRESH_BINARY | THRESH_OTSU"). In the UI this renders as a dropdown with one toggle per flag. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| float | FLOAT | — |
| result | COMFY_MATCHTYPE_V3 | Echoes the 'src' input's format: an IMAGE link comes back as IMAGE, MASK as MASK, NPARRAY stays NPARRAY. |