Webcam Capture CV2(WebcamCaptureCV2)
This node is implemented based on the OpenCV (CV2) library and acquires camera data by calling the system's video capture interface.
Webcam Capture CV2
The Webcam Capture CV2 node, implemented based on the OpenCV (CV2) library, acquires camera data by calling the system's video capture interface.
The Webcam Capture CV2 node is a tool for capturing image frames in real-time from a computer's webcam. It can directly import the camera feed into a ComfyUI workflow as an input source for image processing, enabling real-time interactive image generation.
Node Functionality
This node is implemented based on the OpenCV (CV2) library and acquires camera data by calling the system's video capture interface. The captured image frames are converted into IMAGE tensors in the standard ComfyUI format and support cropping a specified area from the original frame. The node internally manages the camera connection state to optimize performance during continuous calls.
Node Parameter Description - Webcam Capture CV2
Control Parameters (Parameters)
| Parameter Name | Data Type | Required | Default Value | Range/Options | Description |
|---|---|---|---|---|---|
x | INT | Yes | 0 | 0 - 4096 (Step: 1) | Defines the top-left X coordinate of the crop area. Range 0-4096, step 1. |
y | INT | Yes | 0 | 0 - 4096 (Step: 1) | Defines the top-left Y coordinate of the crop area. Range 0-4096, step 1. |
width | INT | Yes | 512 | 0 - 4096 (Step: 1) | Defines the width of the captured and cropped image. Range 0-4096, step 1. |
height | INT | Yes | 512 | 0 - 4096 (Step: 1) | Defines the height of the captured and cropped image. Range 0-4096, step 1. |
cam_index | INT | Yes | 0 | 0 - 255 (Step: 1) | Specifies the index number of the camera device to use. Range 0-255, step 1. |
release | BOOLEAN | Yes | False | - | Controls whether to immediately release the camera resources after this capture. |
Output
| Parameter Name | Data Type | Description |
|---|---|---|
| image | IMAGE | Outputs the captured and cropped image tensor. |
Use Cases
This node is ideal for building workflows involving real-time image processing or style transfer. For example, users can connect it to an image preprocessing node, then feed the output into a text-to-image or image-to-image model, enabling continuous, dynamic AI image generation using the live camera feed as a reference or initial image.
Notes
Ensure that a camera device is connected and correctly recognized by the system. If the workflow execution fails, check if the cam_index parameter points to the correct camera and confirm that no other program is exclusively using the camera resource.
Webcam Capture CV2 Node Source Code Link
The Webcam Capture CV2 node is from the ComfyUI-KJNodes node package.
Comments
Sign in with GitHub to join the discussion.