ComfyUI-Background-Edit

ComfyUI-Background-Edit
★ 22

背景编辑视频处理CUDA加速实时流媒体
用于对图片/视频背景进行编辑的ComfyUI节点集,支持CUDA加速,实现背景模糊、抠图与替换,可用于实时视频流。
💡 在ComfyUI中用CUDA加速对直播视频进行实时背景替换。
🍴 2 Forks💻 Python🔄 2024-12-31
📦
网盘下载
复制链接后前往夸克网盘下载
https://pan.quark.cn/s/9d76119b2ef2
📦 requirements.txt
torch
torchvision
input
depth-bg-blur-output
depth-bg-black-output
depth-bg-blue-output
📄 README

ComfyUI-Background-Edit

ComfyUI-Background-Edit is a set of ComfyUI nodes for editing background of images/videos with CUDA acceleration support.

Supported use cases:

  • Background blurring
  • Background removal
  • Background swapping
  • The CUDA accelerated nodes can be used in real-time workflows for live video streams using comfystream.


  • ComfyUI-Background-Edit
  • Install
  • Comfy Registry
  • ComfyUI-Manager
  • Manual
  • Example Real-Time Live Video Workflows
  • Example Image Workflows
  • Nodes
  • Install

    Prererquisites

  • Install comfy-cli
  • The recommended installation method is to use the Comfy Registry.

    Comfy Registry

    These nodes can be installed via the Comfy Registry.

    comfy node registry-install comfyui-background-edit

    ComfyUI-Manager

    These nodes can be installed via ComfyUI-Manager in the UI or via the CLI:

    comfy node install comfyui-background-edit

    Manual

    These nodes can also be installed manually by copying them into your custom_nodes folder and then installing dependencies:

    cd custom_nodes
    git clone https://github.com/yondonfu/ComfyUI-Background-Edit
    cd ComfyUI-Background-Edit
    pip install -r requirements.txt

    Example Real-Time Live Video Workflows

    Prerequisites

  • Install ComfyUI-Depth-Anything-Tensorrt.
  • The example workflow uses TensorRT to accelerate DepthAnything2 to meet real-time requirements.
  • The workflow (API format) can be used with comfystream to run real-time background blurring on a live video stream.

    The workflow can also be saved and dropped into ComfyUI to load the workflow for further modifications.

    Example Image Workflows

    Prerequisites:

  • Install ComfyUI-DepthAnythingV2.
  • The following example workflows are applied to this input image:

    The output images can be saved and dropped into ComfyUI to load the workflows that created them.

    Background Blurring

    Background Removal

    Background Swapping

    This output just shows the background being swapped to a solid blue color, but in theory the background could be any image of your choice!

    Nodes

    | Node | Description |

    | ————— | ———————————————————————————————————– |

    | BackgroundColor | Creates black/red/green/blue images with same dimensions as input images. |

    | Composite | Creates composites of input foreground images, background images and foreground masks (CPU/CUDA supported). |

    | GaussianBlur | Applies gaussian blur to input images (CPU/CUDA supported). |