Save 4 hours! We auto-setup your workflow! Free!

Drop your workflow.json — we handle every dependency, custom node, and model. Just open the link and run.

Auto-Setup Workflow Json (Free) Now!
ComfyUI > Nodes > opencv-comfyui > OpenCV Canny_0

ComfyUI Node: OpenCV Canny_0

Class Name

Canny_0

Category
image/OpenCV
Author
geroldmeisinger (Account age: 1432days)
Extension
opencv-comfyui
Latest Updated
2026-07-22
Github Stars
0.04K

How to Install opencv-comfyui

Install this extension via the ComfyUI Manager by searching for opencv-comfyui
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter opencv-comfyui in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

OpenCV Canny_0 Description

Canny_0 node uses OpenCV to detect image edges, transforming input into a binary edge-highlighted image.

OpenCV Canny_0:

The Canny_0 node is designed to perform edge detection on images using the Canny edge detection algorithm, a popular technique in computer vision for identifying the boundaries within an image. This node leverages the OpenCV library to apply the Canny method, which is known for its ability to detect a wide range of edges in images with precision. The primary goal of this node is to transform an input image into a binary image where the edges are highlighted, making it easier to identify contours and outlines. This can be particularly useful in various applications such as image segmentation, object detection, and artistic rendering, where understanding the structure and boundaries of objects within an image is crucial.

OpenCV Canny_0 Input Parameters:

image

The image parameter is the input image on which the Canny edge detection will be applied. It should be provided as a NumPy array (NPARRAY), which is a common format for image data in Python. This parameter is essential as it serves as the source from which edges will be detected.

threshold1

The threshold1 parameter is a floating-point value that sets the lower threshold for the hysteresis procedure in the Canny edge detection algorithm. It determines the minimum intensity gradient that will be considered as an edge. The value should be between 0 and 1, with a default setting that typically works well for most images. Adjusting this value can help in fine-tuning the sensitivity of edge detection, where a lower value might detect more edges, including noise.

threshold2

The threshold2 parameter is another floating-point value that sets the upper threshold for the hysteresis procedure. It defines the maximum intensity gradient that will be considered as an edge. Like threshold1, this value should also be between 0 and 1. The difference between threshold1 and threshold2 helps in distinguishing between strong and weak edges, where strong edges are more likely to be detected as true edges.

apertureSize

The apertureSize parameter is an integer that specifies the size of the Sobel kernel used for finding image gradients. It must be an odd number, typically 3, 5, or 7. This parameter affects the accuracy of the edge detection, with larger values providing more precise gradient calculations but potentially increasing computational cost.

L2gradient

The L2gradient parameter is a boolean that determines whether a more accurate L2 norm should be used for gradient magnitude calculation. When set to True, the L2 norm is used, which can provide more accurate edge detection at the cost of increased computation. If set to False, the default L1 norm is used, which is faster but less precise.

OpenCV Canny_0 Output Parameters:

nparray

The nparray output parameter is the resulting image after the Canny edge detection has been applied. It is a NumPy array that represents a binary image where the detected edges are highlighted. This output is crucial for further image processing tasks, as it provides a clear delineation of the edges within the original image, allowing for easy identification of contours and shapes.

OpenCV Canny_0 Usage Tips:

  • Experiment with threshold1 and threshold2 to find the optimal balance for your specific image, as different images may require different sensitivity levels for edge detection.
  • Use a larger apertureSize for images with fine details to improve the accuracy of edge detection, but be mindful of the increased computational cost.
  • Consider enabling L2gradient for applications where precision is more critical than speed, as it can enhance the accuracy of the detected edges.

OpenCV Canny_0 Common Errors and Solutions:

"Invalid image format"

  • Explanation: This error occurs when the input image is not in the expected NumPy array format.
  • Solution: Ensure that the input image is correctly converted to a NumPy array before passing it to the node.

"Threshold values out of range"

  • Explanation: This error indicates that the threshold1 or threshold2 values are not within the acceptable range of 0 to 1. - Solution: Adjust the threshold values to be within the specified range to ensure proper edge detection.

"Aperture size must be odd"

  • Explanation: The apertureSize parameter must be an odd number, and this error occurs if an even number is provided.
  • Solution: Change the apertureSize to an odd number, such as 3, 5, or 7, to comply with the requirements of the Sobel operator.

OpenCV Canny_0 Related Nodes

Go back to the extension to check out more related nodes.
opencv-comfyui
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.

OpenCV Canny_0