CV Stitch Canvas
Computes the output canvas for stitching two images: given the homography that maps image_warp into image_ref's frame (from 'CV Find Homography'), it projects image_warp's corners, takes the union with image_ref's rectangle, and outputs the canvas size plus the matrices that place each image on that canvas: warp_matrix (= translation x homography) for image_warp and ref_matrix (a pure translation) for image_ref. Feed both into cv2.warpPerspective with the dsize output and borderMode=BORDER_CONSTANT (the default BORDER_DEFAULT reflects the image into the empty canvas area, which breaks the coverage masks), then combine with 'OpenCV Feather Blend'. Robust: a degenerate homography (non-finite projection) is treated as identity, and the canvas is capped at max_size per axis - the reference frame always stays fully contained, so a bad estimate can never allocate a huge image.
- image_warp
- image_ref
- homography
- warp_matrix
- ref_matrix
- dsize
- width
- height
- size
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image_warp | NPARRAY,IMAGE,MASK | Image that the homography maps into the reference frame (only its size is used here). 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. | |
| image_ref | NPARRAY,IMAGE,MASK | Reference image; stays axis-aligned on the canvas (only its size is used here). 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. | |
| homography | NPARRAY | 3x3 matrix mapping image_warp coordinates to image_ref coordinates. | |
| max_size | INT | 8192256–32768 | Canvas width/height cap in pixels - protects against degenerate homographies that would project corners kilometers away. |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| warp_matrix | NPARRAY | 3x3 matrix that places image_warp on the canvas (translation x homography). |
| ref_matrix | NPARRAY | 3x3 translation that places image_ref on the canvas. |
| dsize | STRING | '(width, height)' canvas size literal, for the composite params that are still free-text. |
| width | INT | — |
| height | INT | — |
| size | CV_TUPLE | The canvas (width, height) as ONE composite value - wire it into cv2.warpPerspective's dsize. |