Nodes/comfyui_cv/CV Draw Path (ordered)
ComfyUI Node

CV Draw Path (ordered)

Draws a point sequence as a path whose DIRECTION and ENDS are readable: a colour ramp (or a thickness ramp) from the first point to the last, a distinct marker shape at each end, and optional heading arrows along the way. A plain polyline ('CV Draw Polygon') shows the shape of a camera trajectory, a tracked point or a contour but not which end it started from, which is the one thing a reader needs. Use it for any ORDERED 2D sequence; the three cues are redundant on purpose, so two paths on one canvas stay apart in greyscale and for a colour-blind viewer (give the second a different line_style and end markers, not just another colour). For a metric path, map it into pixels first with 'OpenCV Project To Plane' -> 'CV Fit Points To Box' and put 'CV Draw Plot Frame' underneath for axes. None/empty points pass the image through unchanged.

By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
CV Draw Path (ordered)
  • source
  • points
  • gap_mask
  • image
  • count
color(0, 255, 0)
progresscolormap along path
progress_colormapCOLORMAP_VIRIDIS
thickness2
line_stylesolid
start_markerfilled square
end_markertriangle up
marker_radius6
arrow_every0
label_endsnone
Categoryimage/CV/points

Inputs (13)

NameTypeDefaultDescription
sourceCOMFY_MATCHTYPE_V3Image or mask to draw on (a copy is made). 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.
pointsNPARRAYNx2 or Nx1x2 points IN ORDER (first = start). Non-finite points are skipped, so a gated sequence keeps its indexing. None/empty -> passthrough.
colorSTRING(0, 255, 0)Colour as a single value (broadcast to all channels) or a BGR tuple, e.g. '255' or '(0, 255, 0)'. Used for the markers and labels always, and for the line itself unless progress = 'colormap along path'.
progressCOMBOcolormap along pathHow the direction of travel is shown along the line. 'colormap along path' walks a sequential ramp from start to end (the clearest, and it survives greyscale because the ramp is monotone in luminance). 'thicken along path' grows the stroke instead - use it when the colour is already carrying something else. 'solid' leaves the line flat and relies on the end markers.
progress_colormapCOMBOCOLORMAP_VIRIDISRamp for 'colormap along path'. Keep a SEQUENTIAL map (VIRIDIS, MAGMA, PLASMA): a rainbow like JET is not monotone in brightness, so it invents features that are not in the data and prints as mush.
thicknessINT21–64Line thickness in pixels (the maximum, for 'thicken along path').
line_styleCOMBOsolidStroke pattern. Colour alone cannot separate two overlaid line sets for a colour-blind viewer or in greyscale - give the second set a different style and the picture reads without the palette. 'solid' is cv2's own line. Note that the pattern restarts at every segment, so on a DENSELY sampled path (one sample per video frame, a pixel apart) a dashed line renders solid - there lean on 'progress' and the end markers instead.
start_markerCOMBOfilled squareMarker at the FIRST point. Marker shape. Two point sets drawn on one image in two colours are the same picture to a colour-blind viewer - give the second set a different shape (or radius) and the distinction survives. 'filled circle' is the original marker.
end_markerCOMBOtriangle upMarker at the LAST point - make it a different shape from start_marker, that is what tells the two apart.
marker_radiusINT61–128Radius of the two end markers, in pixels. 0-length paths still get their single point marked.
arrow_everyoptINT00–100000Draw a heading arrow every N points (0 = none). The arrow spans a fixed arc length back along the path, so it stays readable where samples are dense.
label_endsoptCOMBOnoneText at the two ends, drawn with a contrast halo so it survives any background. 'first / last index' stamps the actual indices, which is what you want when the path is a frame sequence.
gap_maskoptNPARRAY(N,) 0/1 per point. A 0 means that point was HELD rather than measured (e.g. 'found_mask' from 'OpenCV Visual Odometry (Sequence)'). Those points get a small x and their segment is drawn dotted, so a stretch the estimator gave up on cannot pass for real data. The marker is what carries it: a held point sits exactly on its predecessor, so the segment has no length to draw a style with.

Outputs (2)

NameTypeDescription
imageCOMFY_MATCHTYPE_V3Same format as the image input.
countINTHow many points were drawn.