ComfyUI Node: HistogramMatching

Class Name

HistogramMatching

Category
Eden 🌱
Author
aiXander (Account age: 302days)
Extension
Various custom nodes by Eden.art
Latest Updated
2024-07-23
Github Stars
0.04K

How to Install Various custom nodes by Eden.art

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

HistogramMatching Description

Adjust color distribution of target images to match reference image, ensuring consistency and uniform look in various applications.

HistogramMatching:

The HistogramMatching node is designed to adjust the color distribution of one or more target images to match the color distribution of a reference image. This process, known as histogram matching, is particularly useful in image processing tasks where you want to ensure consistency in color tones across different images. By aligning the histograms of the target images with that of the reference image, this node helps in achieving a uniform look and feel, which is essential in various applications such as photo editing, medical imaging, and computer vision. The node leverages advanced techniques to perform this operation efficiently, ensuring that the resulting images maintain their visual quality while adopting the desired color characteristics from the reference image.

HistogramMatching Input Parameters:

ref_image

This parameter represents the reference image whose color distribution will be used as the standard for matching. The reference image should be provided in an appropriate format, typically as an image tensor. The quality and characteristics of this image will directly influence the outcome of the histogram matching process.

target_images

This parameter consists of one or more target images that need to be adjusted to match the color distribution of the reference image. These images should be provided in a list format, and each image will undergo the histogram matching process to align its color distribution with that of the reference image.

matching_fraction

This parameter controls the extent to which the target images' histograms are adjusted to match the reference image's histogram. It is a floating-point value ranging from 0 to 1, with a default value of 0.75. A value of 1 means a full match to the reference histogram, while a value closer to 0 means a lesser degree of matching.

channels

This parameter specifies the color channels to be considered during the histogram matching process. It is provided as a string, with the default value being "0,1,2", which corresponds to the RGB channels. You can customize this parameter to include only specific channels if needed.

HistogramMatching Output Parameters:

IMAGE

The output of the HistogramMatching node is a list of images that have been adjusted to match the color distribution of the reference image. These images are returned as tensors, ready for further processing or saving. The resulting images will have their color tones aligned with the reference image, ensuring a consistent visual appearance.

HistogramMatching Usage Tips:

  • Ensure that the reference image is of high quality and representative of the desired color distribution to achieve the best results.
  • Adjust the matching_fraction parameter to fine-tune the degree of histogram matching based on your specific needs. A value of 1 will fully match the reference image, while lower values will blend the original and reference histograms.
  • Use the channels parameter to focus on specific color channels if you only need to match certain aspects of the image's color distribution.

HistogramMatching Common Errors and Solutions:

Invalid image path <path>

  • Explanation: This error occurs when the specified path for an image does not exist or is incorrect.
  • Solution: Verify that the image path is correct and that the file exists at the specified location. Ensure that the path is properly formatted and accessible.

Cannot write image with type <dtype>

  • Explanation: This error occurs when the image data type is not supported for writing to disk.
  • Solution: Ensure that the image data type is either np.float32 or np.uint8 before attempting to write it to disk. Convert the image to the appropriate data type if necessary.

Output directory <directory> does not exist

  • Explanation: This error occurs when the specified output directory for saving images does not exist.
  • Solution: Create the output directory before attempting to save images. Ensure that the directory path is correctly specified and accessible.

Input shapes mismatch

  • Explanation: This error occurs when the shapes of the reference image and target images do not match the expected dimensions.
  • Solution: Verify that the reference image and target images have compatible shapes and dimensions. Ensure that they are properly formatted as image tensors.

HistogramMatching Related Nodes

Go back to the extension to check out more related nodes.
Various custom nodes by Eden.art
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.