Nodes/comfyui_cv/CV Align MTB To Reference
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).

By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
CV Align MTB To Reference
  • image
  • image
reference_index0
max_bits4
exclude_range4
cuttrue
Categoryimage/CV/hdr

Inputs (5)

NameTypeDefaultDescription
imageCOMFY_MATCHTYPE_V3Batch 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_indexINT0Index of the frame to use as the alignment reference (0-based). This frame is not shifted; all others are shifted to match it.
max_bitsINT41–32Bit 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_rangeINT40–128Half-width of the pixel-value range excluded from the median threshold bitmap.
cutBOOLEANtrueExclude the darkest and brightest pixels from the median threshold bitmap.

Outputs (1)

NameTypeDescription
imageCOMFY_MATCHTYPE_V3Aligned images in the same format as the input.