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

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

Inputs (6)

NameTypeDefaultDescription
srcCOMFY_MATCHTYPE_V3input 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.
dstNPARRAY,IMAGE,MASKoutput 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.
maskNPARRAY,IMAGE,MASKoptional 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.
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.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)

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