Nodes/ComfyUI-LightGlue/LightGlue Simple
ComfyUI Node

LightGlue Simple

Two images in, a drag trajectory out

By chaojie·Created 3 years ago·Updated 3 years ago· 50
LightGlue Simple
  • extractor
  • matcher
  • image0
  • image1
  • motionbrush
  • matches
  • points0
  • points1
devicecuda

Want to know exactly where a feature in one image went in another? That's the whole job of LightGlue Simple. It takes two images, finds matching points between them, and hands you those pairs as a "motion brush" - which is the control signal ByteDance's DragNUWA video generator wants when you drag a scene to animate it.

The mechanism is textbook computer vision, wrapped for ComfyUI. First, a SuperPoint network runs over both images and detects keypoints - corners, edges, texture blobs it considers worth tracking. Then a LightGlue network matches the two keypoint sets, scoring each candidate pair and keeping only the confident ones. The node stacks each surviving pair into a two-point trajectory - the [x, y] start in image0 and the [x, y] end in image1 - and that collection of start/end pairs is the drag. It serializes them into a JSON string and hands it to you.

That JSON is the motionbrush output, and it's the one that matters. If you think of it as "a list of arrows drawn on the first image," you've got the mental model. The repo even ships a web visualization tool so you can eyeball the brush before running it through a model.

Inputs:

  • extractor and matcher - the two models from the LightGlue Loader. Wire those first; this node is dead without them.
  • image0 and image1 - plain IMAGE tensors from any LoadImage node.
  • device - cuda by default, flip to cpu if you're GPU-less.

Outputs:

  • motionbrush (STRING) - the JSON trajectory list. This is what you actually use.
  • matches, points0, points1 - raw tensor outputs for debugging or plotting. Beginners can ignore them; if you want to see the matches drawn over the images, these are what you'd feed a visualization node.

A small reality check before you wire it into a video pipeline: this two-image node is really a building block. The variant you want for actual video is LightGlue Simple Multi, which chains the matching across every frame of a clip. Use Simple when you want to experiment with one drag on two stills, or when you're building your own matching logic on top.

Install

Same drill as the rest of the pack - the README's path is manual:

cd ComfyUI/custom_nodes
git clone https://github.com/chaojie/ComfyUI-LightGlue
cd ComfyUI-LightGlue
pip install -r requirements.txt

Restart ComfyUI, and remember the Loader downloads its weights from GitHub on first run, so give it internet the first time you execute. The repo's workflow.json shows a minimal graph: two LoadImage nodes into LightGlue Simple, with the Loader feeding it, and an mtb Debug node to inspect the motionbrush string.

Where people get burned

Two things, mostly. First, the images need to be the same size and roughly aligned for the matches to mean anything - this is a tracking tool, not an alignment tool. Second, the motionbrush JSON is only meaningful to DragNUWA if the coordinates land on the canvas DragNUWA expects; the multi-frame node handles that with a scale division, this one just hands you raw pixels. If you're piping this JSON into something that expects a different coordinate space, that's on your workflow, not the node.

And the honest take: this whole DragNUWA scene peaked in January 2024 and has been quietly superseded since. If you're here to make a drag-animation experiment work, great - this node is genuinely neat. If you're shopping for a modern video pipeline, this isn't where you should be spending your weekend.

CategoryLightGlue

Inputs (5)

NameTypeDefaultDescription
extractorSuperPoint
matcherLightGlue
image0IMAGE
image1IMAGE
deviceCOMBOcuda2 options: cuda, cpu

Outputs (4)

NameTypeDescription
motionbrushSTRING
matches[object Object]
points0[object Object]
points1[object Object]