comfyui_cv Introduction
comfyui_cv adds computer-vision tools to ComfyUI. Computer vision means using software to inspect or change images: finding shapes, separating an object from its background, matching features across photos, or correcting perspective. The extension turns many functions from the OpenCV library into nodes you can connect in a ComfyUI workflow.
The pack includes approximately 470 automatically generated, low-level cv2.* wrappers and a smaller collection of curated nodes designed for more complete tasks. You can use them to build image-processing steps around your AI art workflow, such as preparing a mask, extracting a surface from a photograph, or experimenting with depth and image alignment. The gallery shows what some example workflows produce.
This is an independent project, not an official OpenCV extension. It does not expose every OpenCV function, and its example workflows are demonstrations rather than production-ready recipes. The author notes that the project was developed with substantial assistance from generative AI; some behavior may have been fitted too closely to test examples. Check important results against your own images before relying on them, especially in consequential workflows. Updates and prompt support are not planned.
How comfyui_cv Works
Think of a ComfyUI workflow as a workbench: each node performs one job, and its output becomes another node’s input. comfyui_cv supplies additional tools for that workbench.
- Low-level wrappers expose individual OpenCV functions. They give you flexibility, but you may need to convert data between node types or handle unusual inputs yourself.
- Curated nodes package operations into more approachable steps. Some combine OpenCV functions; a few implement their own algorithms rather than calling an OpenCV function directly.
- Example workflows and subgraphs show how nodes can work together. A subgraph is a reusable arrangement you can open as a single-node workflow and build around.
For example, a perspective-warp workflow can take a photographed rectangular surface seen at an angle and transform it into a flatter view. A masking workflow can identify part of an image so you can process it separately. The exact nodes and settings depend on the image and the result you want; examples are starting points, not universal presets.
Some workflows use a DNN, or deep neural network, through OpenCV’s cv2.dnn tools. Those workflows need separately downloaded model files, typically in ONNX format. Model compatibility is limited: a model that works in another application, or even a valid ONNX export, may not load through this extension.
comfyui_cv Features
Image selection and geometry. The examples include GrabCut annotation, quadrilateral extraction and filling, thin-plate warps, and relative remapping. These can help you isolate a subject, straighten a photographed area, or reshape image content. Your selections and geometry determine what is affected: changing the chosen corners of a quadrilateral, for instance, changes the area extracted by a perspective warp.
Masks and image analysis. Gallery examples show clean-plate mattes and K-means masks. These are useful when you need to identify or separate areas of an image before another step. Different source images and workflow settings can produce different boundaries, so inspect the mask itself as well as the final composite.
Alignment and image adjustment. CV Photometric Align (Gain/Bias) estimates per-channel brightness and offset adjustments, while CV Local Linear Fit performs a local, pixel-by-pixel fit. These are curated algorithms, not direct wrappers for functions with those names in OpenCV. The custom-node catalog describes their intended use and limits.
Model-backed experiments. The examples include feature matching with LightGlue, neural style transfer, scene depth, YuNet face detection, and RIFE frame interpolation through OpenCV’s DNN tools. Model-backed workflows need external files and may require preparation or adjustment before they run.
Other illustrated tasks. The gallery also shows panorama stitching and QR-code encoding. Explore the custom-node catalog for usage notes rather than assuming that a similarly named low-level wrapper handles the entire task.
Reusable starting points. The subgraph blueprints document 65 reusable compositions. They can save you from rebuilding a familiar sequence of processing steps. The extension also provides CV Install Example Inputs, which copies packaged sample files into ComfyUI’s input folder so example workflows can find them.
Not every possible setting has a single recommended value. In particular, some demonstration pipelines were tuned to specific sample material, including sky-mask and stereo examples based on StereoGeo-CARLA. Expect to adjust a workflow for your own artwork and check its output at each stage.
comfyui_cv Models
comfyui_cv does not bundle its DNN, LLM, or VLM models. The complete list of external model sources, download locations, target folders, and recorded licenses is in model_sources.txt. Some workflows may also require a model to be converted to .onnx; the author mentions .tflite as a possibility but did not test it.
The supplied context identifies these model-backed examples, but does not provide a complete model-by-model catalog:
| Example | What it demonstrates | What to keep in mind |
|---|---|---|
| RIFE frame interpolation | Creating an intermediate frame between a pair of frames using an ONNX export through cv2.dnn. | This example runs on the CPU, processes one frame pair per execution, and requires the input to be padded to a multiple of 32. For practical video interpolation, use ComfyUI’s native Run Frame Interpolation Model node and its loader, which support RIFE and FILM. |
| LightGlue | Image-feature matching, illustrated in the gallery. | Consult the workflow and model-source notes for its required file and compatibility details. |
| Neural style transfer | Applying a model-backed visual style, illustrated in the gallery. | The required model is external; check the workflow notes and model sources. |
| Scene depth | Producing depth-related output, illustrated in the gallery. | The example does not guarantee that every depth model will work with OpenCV DNN. |
| YuNet face detection | Finding faces in an image, illustrated in the gallery. | Check the example workflow and model sources for the required model. |
Use these workflows to learn how the pieces fit together or to try a model that ComfyUI does not otherwise support. A model running well in PyTorch does not guarantee that its ONNX version will load in the pinned OpenCV build. Review model_sources.txt before downloading or redistributing a model; some models have license terms stricter than those of the extension.
comfyui_cv Examples
The images below illustrate selected results. They are examples of what workflows can do, not promises that the same settings will work on every image.
| Annotate GrabCut | Quadrilateral warp extraction |
| Quadrilateral warp fill | Thin-plate warp |
| Thin-plate warp over a background | Clean-plate matte |
More examples: K-means masks, LightGlue, neural style transfer, panorama stitching, scene depth, relative remapping, YuNet face detection, and QR-code encoding.
To make the supplied example workflows’ media available in ComfyUI:
- Open
workflows/01_install_example_inputs.json. - Run its single CV Install Example Inputs node.
- Reload the ComfyUI page so the Load Image, Load Video, and Load 3D dropdowns refresh.
The node keeps existing files by default. Its dry-run mode lists what would be copied without writing anything; its overwrite option is intended for restoring a packaged sample you changed. It does not delete files. If copying fails, inspect the node’s report output. Models are not included in these example inputs.
Two inputs are not packaged because of size: the driving clip for exercise_visual_odometry_video.json and the flash/no-flash photo pair for 10_ximgproc_edge_aware_filters.json. Notes on those workflows’ canvases explain where to get them.
Troubleshooting comfyui_cv
An example workflow opens with red media-loading nodes.
- Run
workflows/01_install_example_inputs.jsononce. - Reload the ComfyUI page; the file dropdowns will not refresh until you do.
- If files still do not appear, check the install node’s
okvalue andreportfor a missing source folder or a file that could not be written. - For the two unbundled inputs noted above, follow the note on the relevant workflow canvas instead.
A model-backed workflow cannot find its model or opens with missing inputs.
- Check the workflow’s on-canvas notes.
- Open model_sources.txt for the model’s source and target folder.
- Confirm that you obtained a format the workflow expects. Models are not copied by CV Install Example Inputs.
- If an ONNX model is present but fails to load, consider OpenCV DNN compatibility; a successful conversion alone does not guarantee support.
Contrib nodes are missing.
The standard and contrib OpenCV Python packages share the same cv2 installation location. Installing a non-contrib package over a contrib package can make contrib submodules disappear. The included tools/repair_opencv_contrib.py can diagnose this with --check and repair it with --apply. Ask whoever manages your ComfyUI Python environment to check which OpenCV distribution is installed before changing packages.
A low-level node appears but fails when run.
Some OpenCV builds expose a function without including everything needed to execute it. On the author’s reference build, ximgproc.fastBilateralSolverFilter, for example, raises an error saying it needs EIGEN support. Try a different operation or a compatible OpenCV build; changing the image alone will not supply a missing compiled feature. The extension’s behavior was curated against OpenCV contrib headless 5.0.0.93 (https://pypi.org/project/opencv-contrib-python-headless/5.0.0.93/), so other versions may behave differently.
An example workflow asks for nodes from another package.
Some examples and subgraphs also use ComfyUI-Inspire-Pack, ComfyUI-Custom-Scripts, or Basic Data Handling. Check the particular workflow before assuming every example has the same dependencies.
Frequently asked questions
- Does comfyui_cv include all of OpenCV? No. It has many generated wrappers and curated nodes, but some class-based APIs and complex functions are not exposed.
- Are the low-level nodes as guided as the curated nodes? No. They are automatically generated and uncurated, so you may need to manage conversions and edge cases.
- Do I need an external model for every feature? No. Many image-processing operations do not use a DNN model. Model-backed workflows require separate downloads.
- Is the RIFE example the best way to interpolate a video? No. It demonstrates OpenCV DNN. ComfyUI’s native frame-interpolation node is the recommended choice for practical video interpolation.
- Can I use the example outputs or assets commercially? Check the applicable source and model licenses first. In particular, the bundled KITTI ground-truth pose file is non-commercial; model licenses can also impose additional restrictions.
Learn More about comfyui_cv
- Custom nodes: descriptions, intended uses, and limits of the hand-written nodes.
- Subgraph blueprints: 65 reusable workflow compositions.
- OpenCV 5.0 documentation (https://docs.opencv.org/5.0/): the upstream reference for precise behavior of low-level
cv2.*functions. - Model sources: external model locations and license information.
- Example input sources and gallery asset sources: provenance and licenses for sample media and README visuals.
comfyui_cv is a fork of opencv-comfyui and is licensed under GPL-3.0-only. OpenCV is a registered trademark of the Open Source Vision Foundation; this extension is independent of the official OpenCV project.
