Nodes/opencv-comfyui/OpenCV drawMarker_0
ComfyUI Node

OpenCV drawMarker_0

Put a dot, cross, or diamond on the image — without leaving the cv2 pipeline

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV drawMarker_0
  • img
  • nparray
position
color
markerType
markerSize
thickness
line_type

drawMarker_0 is the node you want when you have a list of detected points and you need to see them: keypoints from a detector, face landmarks, corners, anything that comes out of an OpenCV node as coordinates. It draws a small marker shape - cross, tilted cross, star, diamond, square, or triangle - at a given position, on a given image. Small job, done well, and one of the more genuinely usable drawing nodes in the pack.

The inputs that matter

  • img - your NPARRAY.
  • position - a STRING literal, the point as (x, y). Valid Python literal syntax, so (50, 120) works and 50, 120 throws invalid syntax (<unknown>, line 0).
  • color - a STRING literal too, but here's the thing: this pipeline is BGR, so (0, 0, 255) is red, (0, 255, 0) is green, (255, 0, 0) is blue. If your red looks blue, you forgot which pack you're in.
  • markerType - an INT. The OpenCV constants are MARKER_CROSS=0, MARKER_TILTED_CROSS=1, MARKER_STAR=2, MARKER_DIAMOND=3, MARKER_SQUARE=4, MARKER_TRIANGLE_UP=5, MARKER_TRIANGLE_DOWN=6. 0 (the cross) is the default.
  • markerSize - how big the marker is, in pixels.
  • thickness - line thickness.
  • line_type - line rendering mode; 8 (default) or 16 for anti-aliased edges (LINE_AA). Use 16 if the marker will be visible next to sharp pixels.

Single nparray output - the marked-up image, straight into Nparrays2Image when you want to look at it.

Install

It's in opencv-comfyui (geroldmeisinger). ComfyUI Manager → search OpenCV, or:

cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
pip install opencv-python-contrib

Restart ComfyUI. No models, no downloads - requirements.txt is just opencv-contrib-python, numpy, torch.

_0/_1 are the MatLike/UMat overload twins; either works.

Where people get burned

The color thing is the big one - BGR, not RGB, and because Image2Nparray already flipped your image to BGR, the marker will render in the color you asked for on screen. The literal parsing is the other classic: this pack parses every STRING "composite" argument with ast.literal_eval, and a single missing paren gives you an invalid syntax error that looks like a bug in ComfyUI itself. It isn't.

Also remember the batch rule: Image2Nparray only accepts batch_size==1, so if you're iterating over frames, select one with ImageFromBatch first.

Honest take: there are prettier annotation nodes elsewhere, but if you're already inside a cv2 pipeline and just need a visible marker, this is the zero-friction option. The position/color literals make it feel awkward at first; type (x, y) and (0, 0, 255) and it becomes second nature fast.

Categoryimage/OpenCV

Inputs (7)

NameTypeDefaultDescription
imgNPARRAY
positionSTRING
colorSTRING
markerTypeINT
markerSizeINT
thicknessINT
line_typeINT

Outputs (1)

NameTypeDescription
nparrayNPARRAY