Nodes/comfyui_cv/cv2.threshold
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.

By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
cv2.threshold
  • src
  • float
  • result
thresh0.0000
maxval0.0000
typeTHRESH_BINARY
Categoryimage/CV/low-level/cv2 T

Inputs (4)

NameTypeDefaultDescription
srcCOMFY_MATCHTYPE_V3input 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.
threshFLOAT0.0000-1e+38–1e+38threshold value.
maxvalFLOAT0.0000-1e+38–1e+38maximum value to use with the #THRESH_BINARY and #THRESH_BINARY_INV thresholding types.
typeSTRINGTHRESH_BINARYthresholding 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)

NameTypeDescription
floatFLOAT
resultCOMFY_MATCHTYPE_V3Echoes the 'src' input's format: an IMAGE link comes back as IMAGE, MASK as MASK, NPARRAY stays NPARRAY.