ComfyUI  >  Nodes  >  ComfyUI >  Canny

ComfyUI Node: Canny

Class Name

Canny

Category
image/preprocessors
Author
ComfyAnonymous (Account age: 598 days)
Extension
ComfyUI
Latest Updated
8/12/2024
Github Stars
45.9K

How to Install ComfyUI

Install this extension via the ComfyUI Manager by searching for  ComfyUI
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter 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
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Canny Description

Detect image edges using Canny edge detection for object recognition and image enhancement.

Canny:

The Canny node is designed to detect edges within an image using the Canny edge detection algorithm, a popular technique in computer vision. This node is particularly useful for identifying the boundaries and contours of objects within an image, which can be beneficial for various image processing tasks such as object recognition, image segmentation, and artistic effects. By applying this node, you can enhance the structural details of your images, making it easier to highlight and manipulate specific features. The Canny edge detection method works by identifying areas of rapid intensity change, which typically correspond to edges, and it uses two threshold values to determine the strength of the edges to be detected.

Canny Input Parameters:

image

The image parameter is the input image on which the Canny edge detection will be performed. This parameter expects an image in the form of a tensor, which will be processed to detect edges. The image should be in a format compatible with the node's processing capabilities.

low_threshold

The low_threshold parameter sets the lower bound for edge detection. Edges with intensity gradients below this threshold will be discarded. This parameter helps in controlling the sensitivity of the edge detection process. The value should be a float between 0.01 and 0.99, with a default value of 0.4. Adjusting this value can help in fine-tuning the detection of weaker edges.

high_threshold

The high_threshold parameter sets the upper bound for edge detection. Edges with intensity gradients above this threshold are considered strong edges and are more likely to be detected. This parameter works in conjunction with the low_threshold to filter out noise and irrelevant details. The value should be a float between 0.01 and 0.99, with a default value of 0.8. Adjusting this value can help in capturing more prominent edges.

Canny Output Parameters:

image

The output image parameter is the result of the Canny edge detection process. This output is an image tensor where the detected edges are highlighted, typically in a binary format where edges are marked with high intensity values. This processed image can be used for further image analysis or as a base for additional artistic effects.

Canny Usage Tips:

  • To achieve optimal edge detection, start with the default threshold values and adjust them incrementally based on the specific details and noise level of your input image.
  • Use the low_threshold to control the sensitivity to weaker edges and the high_threshold to ensure that only significant edges are detected, reducing noise and irrelevant details.
  • Experiment with different images to understand how the Canny node responds to various textures and patterns, which can help in fine-tuning the parameters for your specific use case.

Canny Common Errors and Solutions:

"Input image tensor is not in the correct format"

  • Explanation: This error occurs when the input image is not provided in the expected tensor format.
  • Solution: Ensure that the input image is correctly converted to a tensor format compatible with the node's processing requirements.

"Threshold values out of range"

  • Explanation: This error occurs when the low_threshold or high_threshold values are set outside the allowed range of 0.01 to 0.99. - Solution: Adjust the threshold values to be within the specified range to avoid this error.

"Device mismatch error"

  • Explanation: This error occurs when there is a mismatch between the device used for processing the image and the device expected by the node.
  • Solution: Ensure that the image tensor is moved to the correct device (e.g., CPU or GPU) as required by the node's processing functions.

Canny Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI
RunComfy

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.