ComfyUI > Nodes > Bmad Nodes > CLAHE

ComfyUI Node: CLAHE

Class Name

CLAHE

Category
Bmad/CV/Thresholding
Author
bmad4ever (Account age: 3591days)
Extension
Bmad Nodes
Latest Updated
2024-08-02
Github Stars
0.05K

How to Install Bmad Nodes

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

CLAHE Description

Enhance image contrast locally with CLAHE for improved visibility and noise control in various applications.

CLAHE:

CLAHE, which stands for Contrast Limited Adaptive Histogram Equalization, is a powerful image processing technique designed to enhance the contrast of images. Unlike traditional histogram equalization, which applies a global transformation to the entire image, CLAHE works on small regions in the image, called tiles. This localized approach allows for better contrast enhancement in areas with varying lighting conditions, making it particularly useful for improving the visibility of details in both bright and dark regions of an image. CLAHE also includes a clip limit parameter to prevent over-amplification of noise, ensuring that the enhanced image remains visually pleasing and free from artifacts. This method is widely used in medical imaging, night vision, and other applications where enhancing local contrast is crucial.

CLAHE Input Parameters:

src

The src parameter represents the source image that you want to enhance using CLAHE. This input should be an image in a compatible format that the node can process.

clip_limit

The clip_limit parameter controls the contrast enhancement limit. It prevents the amplification of noise by clipping the histogram at a specified value. The default value is 2, and it can be adjusted in steps of 1. A higher clip limit increases contrast but may introduce noise, while a lower clip limit reduces the risk of noise but may result in less contrast enhancement.

tile_grid_x

The tile_grid_x parameter specifies the number of tiles in the horizontal direction. The default value is 8, with a minimum value of 2. This parameter determines the size of the local regions where histogram equalization is applied. Increasing the number of tiles can enhance local contrast but may also increase computational complexity.

tile_grid_y

The tile_grid_y parameter specifies the number of tiles in the vertical direction. Similar to tile_grid_x, the default value is 8, with a minimum value of 2. This parameter, along with tile_grid_x, defines the grid size for local histogram equalization, affecting the balance between local contrast enhancement and computational load.

CLAHE Output Parameters:

IMAGE

The output parameter IMAGE represents the enhanced image after applying CLAHE. This image will have improved local contrast, making details in both bright and dark areas more visible. The output is in the same format as the input image, ensuring compatibility with subsequent processing steps.

CLAHE Usage Tips:

  • Adjust the clip_limit parameter to balance between contrast enhancement and noise suppression. Start with the default value and increase or decrease it based on the visual quality of the output.
  • Experiment with different values for tile_grid_x and tile_grid_y to find the optimal grid size for your specific image. Smaller tiles can enhance local details but may increase processing time.
  • Use CLAHE for images with varying lighting conditions or where local contrast enhancement is needed, such as medical images or night-time photographs.

CLAHE Common Errors and Solutions:

"Invalid image format"

  • Explanation: The input image format is not compatible with the CLAHE node.
  • Solution: Ensure that the input image is in a supported format, such as a grayscale or RGB image.

"Clip limit out of range"

  • Explanation: The clip_limit parameter is set to a value outside the acceptable range.
  • Solution: Adjust the clip_limit parameter to be within the valid range, typically starting from 1 and increasing as needed.

"Tile grid size too small"

  • Explanation: The values for tile_grid_x or tile_grid_y are set too low, resulting in insufficient tiles for processing.
  • Solution: Increase the values for tile_grid_x and tile_grid_y to at least 2 to ensure proper grid formation for local histogram equalization.

"Tile grid size too large"

  • Explanation: The values for tile_grid_x or tile_grid_y are set too high, causing excessive computational load or memory issues.
  • Solution: Reduce the values for tile_grid_x and tile_grid_y to a more manageable size, balancing between local contrast enhancement and computational efficiency.

CLAHE Related Nodes

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