ComfyUI Node
cv2.threshold
Raw wrapper of cv2.threshold(src, thresh, maxval, type). Parameters marked '?' are optional; blank means OpenCV default. See the OpenCV documentation for details.
cv2.threshold
- src
- float
- result
◄thresh0.0000►
◄maxval0.0000►
◄typeTHRESH_BINARY►
Categoryimage/CV/low-level/cv2 T
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| src | COMFY_MATCHTYPE_V3 | input array (multiple-channel, CV_8U, CV_16S, CV_16U, CV_32F or CV_64F). 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. | |
| 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.threshold 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. |