Save 4 hours! We auto-setup your workflow! Free!

Drop your workflow.json — we handle every dependency, custom node, and model. Just open the link and run.

Auto-Setup Workflow Json (Free) Now!
ComfyUI > Nodes > ComfyUI_SamplingUtils > Optical Flow Composite (Global Align)

ComfyUI Node: Optical Flow Composite (Global Align)

Class Name

OpticalFlowComposite

Category
advanced/image
Author
silveroxides (Account age: 2211days)
Extension
ComfyUI_SamplingUtils
Latest Updated
2026-06-03
Github Stars
0.02K

How to Install ComfyUI_SamplingUtils

Install this extension via the ComfyUI Manager by searching for ComfyUI_SamplingUtils
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI_SamplingUtils in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Optical Flow Composite (Global Align) Description

Enhances image processing through optical flow alignment and compositing for precise change detection and alignment in images.

Optical Flow Composite (Global Align):

The OpticalFlowComposite node is designed to enhance image processing by aligning and compositing images using optical flow techniques. This node is particularly useful for detecting and aligning changes between an original and a generated image, ensuring that any modifications are accurately captured and integrated. By leveraging optical flow, the node can track pixel movements between frames, allowing for precise alignment even in the presence of motion. This capability is crucial for applications where maintaining the integrity of changes is essential, such as in video editing or image enhancement tasks. The node's primary goal is to provide a seamless and accurate composite of images, minimizing artifacts and ensuring that changes are both detected and aligned with high precision.

Optical Flow Composite (Global Align) Input Parameters:

flow_quality

This parameter determines the accuracy of the optical flow alignment between the original and generated images. It offers three options: "medium," "fast," and "ultrafast." Higher quality settings provide more precise change detection and alignment but at the cost of slower processing. Conversely, lower quality settings speed up processing but may miss subtle shifts or produce noisier masks. The default value is "medium."

occlusion_threshold

This parameter sets the sensitivity to pixels that have moved significantly and cannot be reliably matched between images. Higher values ignore more motion discrepancies, reducing false positives from camera jitter but potentially missing real edits. Lower values flag more pixels as changed, catching more edits but possibly over-detecting in noisy areas. The range is from -1.0 to 20.0, with a default of -1.0 for automatic tuning.

close_radius_pct

This parameter controls the filling of small holes and gaps inside the detected edit region. Higher values close larger gaps, creating a more solid, continuous mask, while lower values leave small holes intact, preserving finer mask detail but potentially leaving speckled artifacts. The range is from 0.0 to 5.0, with a default value of 0.5.

Optical Flow Composite (Global Align) Output Parameters:

result

This output is the final composited image, where the original and generated images are aligned and blended based on the detected changes. It represents the seamless integration of modifications, ensuring that the output maintains the intended edits with minimal artifacts.

composite_mask

The composite mask is a crucial output that indicates the regions of change between the original and generated images. It helps in understanding which areas have been modified and to what extent, providing a visual representation of the detected changes.

stats

This output provides a set of statistics about the compositing process, including the percentage of changed pixels, the number of occluded pixels, the mean and 99th percentile of flow magnitude, the median delta E, the resolution, and the diagonal in pixels. These statistics offer insights into the effectiveness and precision of the compositing process.

Optical Flow Composite (Global Align) Usage Tips:

  • For tasks requiring high precision in change detection, use the "medium" or higher flow quality setting to ensure accurate alignment and minimal artifacts.
  • If you notice excessive noise or false positives in the output, consider adjusting the occlusion threshold to a higher value to ignore minor discrepancies.
  • To maintain finer details in the mask, use a lower close radius percentage, but if you need a more solid mask, increase this value to close larger gaps.

Optical Flow Composite (Global Align) Common Errors and Solutions:

"Affine transformation matrix could not be estimated"

  • Explanation: This error occurs when the node fails to compute a reliable affine transformation matrix due to insufficient or unreliable matching points between the images.
  • Solution: Ensure that the input images have enough distinct features for matching. You may also try adjusting the flow quality to a higher setting for better alignment.

"Flow calculation failed"

  • Explanation: This error indicates that the optical flow calculation did not succeed, possibly due to incompatible image sizes or formats.
  • Solution: Verify that the input images are of the same size and format. If the issue persists, try using different flow quality settings or preprocessing the images to enhance feature detection.

Optical Flow Composite (Global Align) Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI_SamplingUtils
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.

Optical Flow Composite (Global Align)