Nodes/comfyui_cv/CV Annotate Correspondences
ComfyUI Node

CV Annotate Correspondences

Manual point CORRESPONDENCES: run the workflow once to load the image into the node, then LEFT-CLICK the preview to add a pair (it starts pinned, from = to) and DRAG either end - cyan is where a point IS, orange is where it must LAND, and the arrow between them is the displacement. SHIFT+CLICK removes a pair, ALT+DRAG moves both ends together, DOUBLE-CLICK re-pins one. The node draws a LIVE preview of the resulting warp so the correspondences can be authored by eye. Pairs are stored normalized (0-1 of the image size) in the 'pairs' field - editable by hand too - and come out as two row-aligned pixel point sets, which is exactly what 'CV Thin Plate Spline Warp', 'CV Find Homography (RANSAC)', 'cv2.estimateAffine2D' and 'cv2.getPerspectiveTransform' consume. Because both halves come from ONE widget they can never fall out of alignment. Zero pairs is a valid output (count = 0). With the optional 'background' connected the TO half of every pair lives on THAT image instead (the editor shows the two side by side), so the fitted warp maps image -> background: the authoring surface for pasting the image somewhere into the background.

By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
CV Annotate Correspondences
  • image
  • background
  • points_from
  • points_to
  • count
pairs[]
Categoryimage/CV/points

Inputs (3)

NameTypeDefaultDescription
imageNPARRAY,IMAGEThe image the correspondences are placed on; it is shown inside the node after the first run. The outputs are PIXEL coordinates of THIS image, so a consumer must be fed the same size. 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.
pairsSTRING[]Normalized [[[from_x, from_y], [to_x, to_y]], ...] JSON, 0-1 of the image size (of the background's size for the 'to' half when a background is connected). Maintained by dragging the preview below; hand-editing works as well.
backgroundoptNPARRAY,IMAGEOptional DESTINATION image. When connected, the editor shows it next to 'image', every pair's TO end lives on it, and points_to comes out in ITS pixel coordinates - feed points_from/points_to to a homography/affine fit to warp 'image' into place. Left unconnected, both halves live on 'image' as before. 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.

Outputs (3)

NameTypeDescription
points_fromNPARRAYNx1x2 float32 PIXEL coordinates - where each control point currently is, in creation order. Always in 'image' pixels.
points_toNPARRAYNx1x2 float32 PIXEL coordinates - where the same-numbered control point must land. Row-aligned with points_from by construction. In 'background' pixels when one is connected, 'image' pixels otherwise.
countINT