Nodes/comfyui_cv/cv2.rectangle (2/2)
ComfyUI Node

cv2.rectangle (2/2)

Raw wrapper of cv2.rectangle(source, rec, color, thickness?, lineType?, shift?). 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.rectangle (2/2)
  • source
  • result
rec_x0
rec_y0
rec_w0
rec_h0
color(0, 0, 0, 0)
thickness1
lineTypeLINE_AA
shift0
Categoryimage/CV/low-level/cv2 R

Inputs (9)

NameTypeDefaultDescription
sourceCOMFY_MATCHTYPE_V3 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.
rec_xINT0-2147483648–2147483647Rectangle top-left corner X in pixels.
rec_yINT0-2147483648–2147483647Rectangle top-left corner Y in pixels.
rec_wINT00–2147483647Rectangle width in pixels (>= 0).
rec_hINT00–2147483647Rectangle height in pixels (>= 0).
colorSTRING(0, 0, 0, 0)Rectangle color or brightness (grayscale image). 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.
thicknessoptINT1-2147483648–2147483647Thickness of lines that make up the rectangle. Negative values, like #FILLED, mean that the function has to draw a filled rectangle. Preset to the OpenCV default (1).
lineTypeoptCOMBOLINE_AAType of the line. See #LineTypes
shiftoptINT0-2147483648–2147483647Number of fractional bits in the point coordinates. Preset to the OpenCV default (0).

Outputs (1)

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