KJNodes/experimentalgenerated

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

image
x
0
y
0
width
512
height
512
cam_index
0
release
KJNodes

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 NameData TypeRequiredDefault ValueRange/OptionsDescription
xINTYes00 - 4096 (Step: 1)Defines the top-left X coordinate of the crop area. Range 0-4096, step 1.
yINTYes00 - 4096 (Step: 1)Defines the top-left Y coordinate of the crop area. Range 0-4096, step 1.
widthINTYes5120 - 4096 (Step: 1)Defines the width of the captured and cropped image. Range 0-4096, step 1.
heightINTYes5120 - 4096 (Step: 1)Defines the height of the captured and cropped image. Range 0-4096, step 1.
cam_indexINTYes00 - 255 (Step: 1)Specifies the index number of the camera device to use. Range 0-255, step 1.
releaseBOOLEANYesFalse-Controls whether to immediately release the camera resources after this capture.

Output

Parameter NameData TypeDescription
imageIMAGEOutputs 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.

The Webcam Capture CV2 node is from the ComfyUI-KJNodes node package.

Comments

Sign in with GitHub to join the discussion.

Loading comments…