ComfyUI  >  Nodes  >  ComfyUI >  ImageMorphology

ComfyUI Node: ImageMorphology

Class Name

Morphology

Category
image/postprocessing
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

ImageMorphology Description

Perform morphological operations on images for image enhancement, noise removal, and feature extraction using powerful functions like dilation and erosion.

ImageMorphology:

The Morphology node is designed to perform various morphological operations on images, which are essential techniques in image processing and computer vision. These operations can help in enhancing image structures, removing noise, and extracting relevant features. The node leverages powerful functions such as dilation, erosion, opening, closing, gradient, top hat, and bottom hat to manipulate the shapes and structures within an image. By applying these operations, you can achieve effects like smoothing, sharpening, and highlighting specific elements in your images, making it a valuable tool for post-processing in AI art and other visual tasks.

ImageMorphology Input Parameters:

image

This parameter represents the input image on which the morphological operations will be performed. The image should be in a format that the node can process, typically a tensor representation of the image.

operation

This parameter specifies the type of morphological operation to be applied to the image. The available options are erode, dilate, open, close, gradient, top_hat, and bottom_hat. Each operation has a distinct effect on the image: erode shrinks the bright regions, dilate expands them, open removes small objects, close fills small holes, gradient highlights edges, top_hat extracts small elements and details, and bottom_hat highlights dark regions on a bright background.

kernel_size

This parameter defines the size of the structuring element (kernel) used in the morphological operation. It is an integer value with a default of 3, a minimum of 3, and a maximum of 999. The kernel size impacts the extent of the operation; larger kernels will have a more pronounced effect on the image.

ImageMorphology Output Parameters:

IMAGE

The output parameter is the processed image after the specified morphological operation has been applied. This image will reflect the changes made by the operation, such as enhanced edges, reduced noise, or highlighted features, depending on the chosen operation.

ImageMorphology Usage Tips:

  • To remove small noise from an image, use the open operation with a small kernel size.
  • For edge detection, the gradient operation can be very effective.
  • Use the dilate operation to make features in the image more prominent.
  • Experiment with different kernel sizes to see how they affect the outcome of the morphological operations.

ImageMorphology Common Errors and Solutions:

Invalid operation <operation> for morphology. Must be one of 'erode', 'dilate', 'open', 'close', 'gradient', 'tophat', 'bottomhat'

  • Explanation: This error occurs when an invalid operation name is provided.
  • Solution: Ensure that the operation parameter is set to one of the valid options: erode, dilate, open, close, gradient, top_hat, or bottom_hat.

Kernel size must be an odd integer greater than or equal to 3

  • Explanation: This error occurs if the kernel size is set to an even number or a value less than 3. - Solution: Set the kernel size to an odd integer value that is 3 or greater.

Image tensor must be in the correct format

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

ImageMorphology 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.