Nodes/comfyui_qwen_edit_pixel_perfect/Align to Reference (AKAZE)
ComfyUI Node

Align to Reference (AKAZE)

Auto-aligns a moving image to a reference image using AKAZE feature matching + RANSAC. Corrects the scale + translation (and optional rotation) drift introduced by Qwen-Image-Edit's internal resizing, so the output overlays the source pixel-perfectly. Ideal for line-art / edge-map alignment.

By oron1208·Created about a month ago·Updated about a month ago· 14
Align to Reference (AKAZE)
  • reference
  • moving
  • aligned
  • debug
transform_modesimilarity
max_features5000
ratio_threshold0.75
ransac_threshold3.0
edge_preprocessnone
output_debugfalse
Categoryimage/transform

Inputs (8)

NameTypeDefaultDescription
referenceIMAGEFixed image (e.g. the colour original the user wants to keep).
movingIMAGEImage to align (e.g. the Qwen-generated line-art).
transform_modeCOMBOsimilaritytranslation = shift only; rigid = shift + rotation; similarity = shift + scale + rotation (recommended); affine = full affine (most flexible, least stable).
max_featuresFLOAT5000500–20000Max AKAZE features to detect. Higher = more candidates, slower.
ratio_thresholdFLOAT0.750.5–0.95Lowe ratio test threshold. Lower = stricter matches.
ransac_thresholdFLOAT3.00.5–20RANSAC inlier distance in pixels. Lower = stricter fit.
edge_preprocessCOMBOnonePre-filter both images to edges before matching. canny/sobel helps a lot when the moving image is line-art and the reference is colour (very different intensities).
output_debugBOOLEANfalseAlso return a side-by-side match visualisation image.

Outputs (2)

NameTypeDescription
alignedIMAGEThe moving image warped onto the reference coordinate system.
debugIMAGEOptional match visualisation (only when output_debug is on).