Visit ComfyUI Online for ready-to-use ComfyUI environment
Compute optical flow between video frames using deep learning for motion analysis and manipulation.
The ExtractOpticalFlow node is designed to compute the optical flow between two consecutive frames in a video sequence. Optical flow represents the motion of objects between frames, which is crucial for tasks such as motion detection, video stabilization, and frame interpolation. This node leverages advanced deep learning models to accurately estimate the flow, providing detailed information about the movement within the scene. By using this node, you can obtain not only the flow vectors but also various masks that highlight motion edges, occlusions, and borders, along with a visual preview of the flow. This comprehensive output can significantly enhance your ability to analyze and manipulate video content.
The current_frame parameter represents the latest frame in the video sequence for which you want to compute the optical flow. This frame is compared against the previous_frame to determine the motion vectors. It is essential to provide a high-quality image to ensure accurate flow estimation.
The previous_frame parameter is the frame immediately preceding the current_frame in the video sequence. The optical flow is computed by analyzing the differences between this frame and the current_frame. Like the current_frame, it should be a high-quality image to achieve precise results.
The num_flow_updates parameter controls the number of iterations the model performs to refine the optical flow estimation. A higher number of updates can lead to more accurate flow but will require more computational resources and time. The default value is 20, with a minimum of 5 and a maximum of 100. Adjust this parameter based on the desired balance between accuracy and performance.
The Flow output provides the computed optical flow vectors between the previous_frame and the current_frame. These vectors indicate the direction and magnitude of motion for each pixel, which can be used for various motion analysis tasks.
The Motion edge mask output highlights the edges of moving objects within the scene. This mask is useful for identifying the boundaries of moving objects and can aid in tasks such as object segmentation and tracking.
The Occlusion mask output identifies areas in the current_frame that are occluded, meaning they are not visible in the previous_frame due to object movement. This mask helps in understanding which parts of the scene are newly visible or hidden between frames.
The Border mask output marks the borders of the frame where the optical flow estimation might be less reliable. This is particularly useful for handling edge cases and ensuring that the flow data is interpreted correctly.
The Flow preview output provides a visual representation of the optical flow, making it easier to understand the motion within the scene. This preview can be used for quick visual inspections and debugging purposes.
current_frame and previous_frame are of high quality and have minimal noise.num_flow_updates parameter based on the complexity of the motion in your video. Higher values can improve accuracy but will increase computation time.Motion edge mask to enhance object segmentation tasks by focusing on the boundaries of moving objects.Occlusion mask can be particularly useful in applications where understanding newly visible or hidden areas is crucial, such as in augmented reality.num_flow_updates parameter or use lower resolution frames to decrease memory usage.current_frame and previous_frame must be of the same size for the optical flow computation to work correctly.raft_device variable and ensure that the device is available and properly configured.RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Playground, enabling artists to harness the latest AI tools to create incredible art.