ComfyUI  >  Nodes  >  Masquerade Nodes >  Mask Morphology

ComfyUI Node: Mask Morphology

Class Name

Mask Morphology

Category
Masquerade Nodes
Author
BadCafeCode (Account age: 485 days)
Extension
Masquerade Nodes
Latest Updated
6/19/2024
Github Stars
0.3K

How to Install Masquerade Nodes

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

Mask Morphology Description

Perform morphological operations on image masks for refining and enhancing structures, removing noise, and filling gaps.

Mask Morphology:

The Mask Morphology node is a powerful tool designed to perform various morphological operations on image masks. These operations include dilation, erosion, opening, and closing, which are essential for refining and manipulating masks in image processing tasks. By applying these operations, you can enhance the structure of masks, remove noise, and fill gaps, making them more suitable for subsequent processing steps. This node is particularly useful for AI artists who need to preprocess masks to achieve better results in their creative projects.

Mask Morphology Input Parameters:

image

This parameter represents the input image mask that you want to process. The mask should be in the form of an image tensor. The quality and structure of the input mask will directly impact the results of the morphological operations.

distance

The distance parameter controls the extent of the morphological operation. It determines how many pixels the operation will affect. The value can range from 0 to 128, with a default value of 5. A higher distance value will result in a more pronounced effect, while a lower value will have a subtler impact.

op

The op parameter specifies the type of morphological operation to be performed. The available options are "dilate", "erode", "open", and "close". Each operation serves a different purpose: "dilate" expands the mask, "erode" shrinks it, "open" removes small objects, and "close" fills small holes. Choose the operation that best suits your needs.

Mask Morphology Output Parameters:

IMAGE

The output of the Mask Morphology node is an image tensor representing the processed mask. This output mask will have undergone the specified morphological operation, resulting in a refined and manipulated version of the input mask. You can use this output for further processing or directly in your creative projects.

Mask Morphology Usage Tips:

  • To remove small noise from a mask, use the "open" operation with a small distance value.
  • To fill small holes in a mask, use the "close" operation with an appropriate distance value.
  • Experiment with different distance values to achieve the desired effect for your specific use case.
  • Use the "dilate" operation to expand the mask and cover more area, which can be useful for certain artistic effects.

Mask Morphology Common Errors and Solutions:

"Input image tensor is not valid"

  • Explanation: This error occurs when the input image mask is not in the correct format or is corrupted.
  • Solution: Ensure that the input image mask is a valid image tensor and is properly formatted before passing it to the node.

"Distance value out of range"

  • Explanation: This error occurs when the distance parameter is set to a value outside the allowed range (0 to 128).
  • Solution: Adjust the distance parameter to a value within the specified range to avoid this error.

"Invalid operation type"

  • Explanation: This error occurs when the op parameter is set to a value that is not one of the allowed options ("dilate", "erode", "open", "close").
  • Solution: Ensure that the op parameter is set to one of the valid operation types to prevent this error.

Mask Morphology Related Nodes

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