ComfyUI Node
CV Align MTB To Reference
Aligns a batch of images to a chosen reference frame using cv2.AlignMTB.calculateShift() + shiftMat(). The reference frame passes through unchanged; every other frame is globally shifted to best match the reference's median threshold bitmap. The output matches the input format (IMAGE/MASK/NPARRAY/LATENT).
CV Align MTB To Reference
- image
- image
◄reference_index0►
◄max_bits4►
◄exclude_range4►
◄cuttrue►
Categoryimage/CV/hdr
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| image | COMFY_MATCHTYPE_V3 | Batch of 2+ images to align. Accepts IMAGE, MASK, NPARRAY (list or 4-D array), or LATENT. 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. | |
| reference_index | INT | 0 | Index of the frame to use as the alignment reference (0-based). This frame is not shifted; all others are shifted to match it. |
| max_bits | INT | 41–32 | Bit depth for the median bitmaps used by calculateShift. Values 2-4 give reliable results in this OpenCV build; higher values may return incorrect shifts on some inputs. |
| exclude_range | INT | 40–128 | Half-width of the pixel-value range excluded from the median threshold bitmap. |
| cut | BOOLEAN | true | Exclude the darkest and brightest pixels from the median threshold bitmap. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | COMFY_MATCHTYPE_V3 | Aligned images in the same format as the input. |