ComfyUI > Nodes > Bmad Nodes > InRange (hsv)

ComfyUI Node: InRange (hsv)

Class Name

InRange (hsv)

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

InRange (hsv) Description

Facilitates color detection and segmentation in images using HSV color space, specifying range of values for isolation.

InRange (hsv):

The InRange (hsv) node is designed to facilitate color detection and segmentation within images by leveraging the HSV (Hue, Saturation, Value) color space. This node allows you to specify a range of HSV values to isolate specific colors or color ranges within an image. By setting both lower and upper bounds for hue, saturation, and value, you can create masks that highlight areas of the image that fall within the specified color range. This is particularly useful for tasks such as object detection, image filtering, and color-based image analysis. The node provides various methods to handle hue intervals, including ignoring hue, using a single interval, or splitting the interval to ensure accurate color detection.

InRange (hsv) Input Parameters:

samples

This parameter represents the HSV samples extracted from an image. It is used to determine the color range for the inRange operation. The samples are typically obtained from a previous node that samples colors from an image.

percentage_modifier

This integer parameter adjusts the range of HSV values based on a percentage. It allows you to fine-tune the sensitivity of the color detection. The default value is 50, with a minimum of 1 and a maximum of 100. Increasing this value broadens the range, making the node more inclusive of similar colors, while decreasing it narrows the range for more precise color detection.

interval_type

This parameter specifies the method used to calculate the HSV interval. It offers several options, including "median to extremes interpolation," "average +- 3x max deviation," "average +- 2x standard deviation," and "sample percentage centered at median." Each option determines how the HSV bounds are calculated based on the provided samples and percentage modifier. The default option is "median to extremes interpolation."

InRange (hsv) Output Parameters:

HSV_COLOR

This output represents the upper bounds of the HSV color range. It is an array containing the maximum values for hue, saturation, and value that define the color range.

HSV_COLOR

This output represents the lower bounds of the HSV color range. It is an array containing the minimum values for hue, saturation, and value that define the color range.

hue_modes

This output indicates the hue mode used for the inRange operation. It can be one of several modes, such as "SMALLEST," "LARGEST," "IGNORE," "SINGLE," or "SPLIT," each determining how the hue interval is handled during the color detection process.

InRange (hsv) Usage Tips:

  • To achieve precise color detection, start with a lower percentage_modifier and gradually increase it until the desired color range is accurately captured.
  • Use the "IGNORE" hue mode if you are only interested in detecting colors based on saturation and value, disregarding the hue component.
  • Experiment with different interval_type options to find the most suitable method for calculating the HSV bounds based on your specific image and color detection requirements.

InRange (hsv) Common Errors and Solutions:

"Invalid HSV range"

  • Explanation: This error occurs when the specified HSV bounds are not valid, such as when the lower bound is greater than the upper bound.
  • Solution: Ensure that the lower bounds for hue, saturation, and value are less than or equal to the corresponding upper bounds.

"Image not in HSV format"

  • Explanation: This error occurs when the input image is not in the HSV color space.
  • Solution: Convert the input image to the HSV color space before using the InRange (hsv) node. You can use a color conversion node to achieve this.

"Invalid percentage_modifier value"

  • Explanation: This error occurs when the percentage_modifier value is outside the allowed range (1 to 100).
  • Solution: Adjust the percentage_modifier value to be within the valid range, ensuring it is between 1 and 100.

InRange (hsv) 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.