ComfyUI > Nodes > tri3d-comfyui-nodes > Calculate max and min values for rescaling histogram v4.7.3

ComfyUI Node: Calculate max and min values for rescaling histogram v4.7.3

Class Name

tri3d-get_histogram_limits

Category
TRI3D
Author
TRI3D-LC (Account age: 770days)
Extension
tri3d-comfyui-nodes
Latest Updated
2025-05-21
Github Stars
0.03K

How to Install tri3d-comfyui-nodes

Install this extension via the ComfyUI Manager by searching for tri3d-comfyui-nodes
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter tri3d-comfyui-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
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Calculate max and min values for rescaling histogram v4.7.3 Description

Calculate histogram limits based on threshold fraction for image processing tasks.

Calculate max and min values for rescaling histogram v4.7.3:

The tri3d-get_histogram_limits node is designed to calculate the lower and upper limits of a histogram based on a given threshold fraction. This node is particularly useful in image processing tasks where you need to determine the range of pixel intensities that are significant within an image. By analyzing the luminosity of an image and applying a threshold, this node helps in identifying the boundaries of the histogram that contain the most relevant data, effectively filtering out noise or less significant pixel values. This can be beneficial for tasks such as contrast adjustment, image segmentation, or any application where understanding the distribution of pixel intensities is crucial. The node operates by converting the input image from a PyTorch tensor to a NumPy array, computing the histogram, and then determining the limits where the cumulative sum of the histogram reaches the specified threshold fraction from both ends.

Calculate max and min values for rescaling histogram v4.7.3 Input Parameters:

luminosity_as_mask

The luminosity_as_mask parameter is a mask input that represents the luminosity of the image you are analyzing. This input is crucial as it provides the data from which the histogram will be calculated. The mask should be in a format compatible with PyTorch tensors, as it will be converted to a NumPy array for processing. The quality and accuracy of the histogram limits depend significantly on the input mask, so ensure that it accurately represents the luminosity of the image.

threshold_fraction

The threshold_fraction parameter is a floating-point value that determines the fraction of the histogram's cumulative sum used to calculate the limits. It essentially sets the sensitivity of the node to the pixel intensity distribution. The default value is 0.001, with a minimum of 0.0 and a maximum of 0.5. This parameter allows you to control how much of the histogram's tails are considered insignificant and thus excluded from the limits. A lower threshold will result in wider limits, potentially including more noise, while a higher threshold will narrow the limits, focusing on the most significant pixel values.

Calculate max and min values for rescaling histogram v4.7.3 Output Parameters:

histogram lower limit (x1) as INT

The histogram lower limit (x1) as INT output represents the lower boundary of the histogram where the cumulative sum of pixel intensities first exceeds the specified threshold fraction. This integer value indicates the starting point of significant pixel intensity values in the image, helping to identify the minimum intensity that should be considered in further processing.

histogram upper limit (x2) as INT

The histogram upper limit (x2) as INT output is the upper boundary of the histogram where the cumulative sum of pixel intensities from the other end first exceeds the threshold fraction. This integer value marks the endpoint of significant pixel intensity values, indicating the maximum intensity that should be considered. Together with the lower limit, it defines the range of pixel intensities that are most relevant for the image analysis task at hand.

Calculate max and min values for rescaling histogram v4.7.3 Usage Tips:

  • To achieve optimal results, ensure that the luminosity_as_mask accurately represents the image's luminosity, as this directly affects the histogram calculation.
  • Adjust the threshold_fraction based on the specific requirements of your task. For images with a lot of noise, a higher threshold might be beneficial to focus on the most significant pixel values.

Calculate max and min values for rescaling histogram v4.7.3 Common Errors and Solutions:

Invalid mask input

  • Explanation: The luminosity_as_mask input is not in the correct format or is incompatible with the node's processing requirements.
  • Solution: Ensure that the mask is a PyTorch tensor and accurately represents the luminosity of the image. Convert any other formats to the required tensor format before inputting.

Threshold fraction out of range

  • Explanation: The threshold_fraction value is set outside the allowed range of 0.0 to 0.5.
  • Solution: Adjust the threshold_fraction to be within the specified range. Use values between 0.0 and 0.5 to ensure proper functionality of the node.

Calculate max and min values for rescaling histogram v4.7.3 Related Nodes

Go back to the extension to check out more related nodes.
tri3d-comfyui-nodes
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Playground, enabling artists to harness the latest AI tools to create incredible art.