ComfyUI  >  Nodes  >  ComfyUI-Image-Filters >  Dilate/Erode Mask

ComfyUI Node: Dilate/Erode Mask

Class Name

DilateErodeMask

Category
mask/filters
Author
spacepxl (Account age: 295 days)
Extension
ComfyUI-Image-Filters
Latest Updated
6/22/2024
Github Stars
0.1K

How to Install ComfyUI-Image-Filters

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

Dilate/Erode Mask Description

Modify mask images by expanding or shrinking masked areas for precise boundary refinement in image processing workflows.

Dilate/Erode Mask:

The DilateErodeMask node is designed to modify mask images by either expanding (dilating) or shrinking (eroding) the masked areas. This node is particularly useful for AI artists who need to refine mask boundaries in their image processing workflows. By adjusting the radius and shape parameters, you can control the extent and form of the dilation or erosion, allowing for precise manipulation of the mask. This can be beneficial for tasks such as enhancing details, removing noise, or preparing masks for further image processing steps.

Dilate/Erode Mask Input Parameters:

masks

This parameter accepts the mask images that you want to process. A mask is typically a binary image where the areas of interest are marked. The node will apply dilation or erosion to these masks based on the other parameters provided.

radius

The radius parameter determines the extent of the dilation or erosion. It accepts integer values ranging from -1023 to 1023, with a default value of 0. Positive values will dilate (expand) the mask, while negative values will erode (shrink) it. The magnitude of the radius controls how much the mask is expanded or shrunk.

shape

The shape parameter specifies the form of the structuring element used for dilation or erosion. It can be either "box" or "circle". A "box" shape will use a rectangular structuring element, while a "circle" shape will use a circular one. This affects the appearance of the modified mask edges.

Dilate/Erode Mask Output Parameters:

MASK

The output is a modified mask image where the areas have been either dilated or eroded based on the input parameters. This processed mask can be used in subsequent image processing steps to achieve the desired effects.

Dilate/Erode Mask Usage Tips:

  • To remove small noise from a mask, use a small negative radius with a "circle" shape to erode the mask slightly.
  • For enhancing the details of a mask, use a small positive radius with a "box" shape to dilate the mask.
  • Experiment with different radius values and shapes to achieve the best results for your specific image processing task.

Dilate/Erode Mask Common Errors and Solutions:

Invalid radius value

  • Explanation: The radius value provided is outside the acceptable range of -1023 to 1023. - Solution: Ensure that the radius value is within the specified range.

Unsupported shape type

  • Explanation: The shape parameter is set to a value other than "box" or "circle".
  • Solution: Set the shape parameter to either "box" or "circle".

Mask processing failure

  • Explanation: An error occurred during the dilation or erosion process, possibly due to incompatible mask dimensions or data types.
  • Solution: Verify that the input masks are correctly formatted and compatible with the node's requirements. Ensure that the masks are binary images and have consistent dimensions.

Dilate/Erode Mask Related Nodes

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