Visit ComfyUI Online for ready-to-use ComfyUI environment
Detect edges in images using Canny edge detection algorithm for AI artists to extract prominent lines with customizable sensitivity.
The CannyEdgePreprocessor is a powerful tool designed to detect edges within an image using the Canny edge detection algorithm. This node is particularly useful for AI artists who want to extract prominent lines and edges from their images, which can be used for various artistic effects or as a preprocessing step for further image analysis. The Canny edge detection method is renowned for its ability to detect a wide range of edges in an image while minimizing noise, making it an essential tool for creating clean and precise edge maps. By adjusting the thresholds, you can control the sensitivity of the edge detection, allowing for a high degree of customization based on your specific needs.
The low_threshold
parameter sets the lower boundary for edge detection. Edges with gradient values below this threshold will be discarded, meaning they will not be considered as edges. This parameter helps in filtering out weak edges that are likely caused by noise. The value ranges from 0 to 255, with a default value of 100. Adjusting this value can help in fine-tuning the sensitivity of the edge detection process.
The high_threshold
parameter sets the upper boundary for edge detection. Edges with gradient values above this threshold are considered as strong edges and are definitely included in the edge map. This parameter works in conjunction with the low_threshold
to create a hysteresis effect, where edges that fall between the two thresholds are included only if they are connected to strong edges. The value ranges from 0 to 255, with a default value of 200. Modifying this value allows you to control the strictness of the edge detection.
The output of the CannyEdgePreprocessor is an IMAGE
that contains the detected edges. This image is a binary map where the edges are highlighted, and the rest of the image is set to black. This output can be used directly for artistic purposes or as an input for further image processing tasks. The edge map provides a clear and precise representation of the prominent lines and contours in the original image.
low_threshold
value to include more edges, but be cautious as this might also include more noise.high_threshold
value to ensure only the strongest edges are detected.ValueError: low_threshold must be less than high_threshold
low_threshold
value is set higher than or equal to the high_threshold
value.low_threshold
value is always less than the high_threshold
value to maintain the proper functioning of the edge detection algorithm.TypeError: image must be a valid image format
RuntimeError: Failed to execute Canny edge detection
© Copyright 2024 RunComfy. All Rights Reserved.