ComfyUI  >  Nodes  >  ComfyUI-post-processing-nodes >  CannyEdgeMask

ComfyUI Node: CannyEdgeMask

Class Name

CannyEdgeMask

Category
postprocessing/Masks
Author
EllangoK (Account age: 2833 days)
Extension
ComfyUI-post-processing-nodes
Latest Updated
8/9/2024
Github Stars
0.2K

How to Install ComfyUI-post-processing-nodes

Install this extension via the ComfyUI Manager by searching for  ComfyUI-post-processing-nodes
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-post-processing-nodes 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

CannyEdgeMask Description

Detect edges in images using Canny edge detection algorithm for precise feature manipulation.

CannyEdgeMask:

The CannyEdgeMask node is designed to detect edges within an image using the Canny edge detection algorithm, a popular technique in computer vision. This node processes an input image to highlight areas of significant intensity change, which typically correspond to edges. By converting the image to grayscale and applying the Canny algorithm, it produces a binary mask where edges are marked, making it easier to identify and manipulate these features in subsequent processing steps. This node is particularly useful for tasks that require precise edge detection, such as object recognition, image segmentation, and artistic effects.

CannyEdgeMask Input Parameters:

image

The image parameter is the input image that you want to process. This image should be in the form of a tensor, typically containing RGB values. The node will convert this image to grayscale before applying the Canny edge detection algorithm.

lower_threshold

The lower_threshold parameter sets the lower bound for the hysteresis thresholding in the Canny edge detection algorithm. Pixels with gradient values below this threshold are considered non-edges. Adjusting this value can help control the sensitivity of edge detection. The minimum value is 0, the maximum value is 500, and the default value is 100. This parameter is an integer and can be adjusted in steps of 10.

upper_threshold

The upper_threshold parameter sets the upper bound for the hysteresis thresholding in the Canny edge detection algorithm. Pixels with gradient values above this threshold are considered strong edges. Adjusting this value can help control the sensitivity of edge detection. The minimum value is 0, the maximum value is 500, and the default value is 200. This parameter is an integer and can be adjusted in steps of 10.

CannyEdgeMask Output Parameters:

IMAGE

The output is an IMAGE parameter, which is a binary mask highlighting the edges detected in the input image. Each pixel in the output image will either be part of an edge (marked with a high value) or not (marked with a low value). This mask can be used for further image processing tasks, such as segmentation or feature extraction.

CannyEdgeMask Usage Tips:

  • Adjust the lower_threshold and upper_threshold parameters to fine-tune the sensitivity of the edge detection. Lower values will detect more edges, including weaker ones, while higher values will focus on stronger edges.
  • Use this node as a preprocessing step for tasks that require precise edge information, such as object detection or image segmentation.
  • Experiment with different threshold values to achieve the desired level of detail in the edge detection results.

CannyEdgeMask Common Errors and Solutions:

"Input image is not a tensor"

  • Explanation: The input image provided is not in the expected tensor format.
  • Solution: Ensure that the input image is correctly formatted as a tensor before passing it to the node.

"Threshold values out of range"

  • Explanation: The lower_threshold or upper_threshold values are outside the allowed range.
  • Solution: Check that the threshold values are within the specified range (0 to 500) and adjust them accordingly.

"Image dimensions are incorrect"

  • Explanation: The input image does not have the expected dimensions (batch size, height, width, channels).
  • Solution: Verify that the input image has the correct dimensions and reshape it if necessary before passing it to the node.

CannyEdgeMask Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-post-processing-nodes
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.