ComfyUI Node: HSVThresholdMask

Class Name

HSVThresholdMask

Category
postprocessing/Masks
Author
EllangoK (Account age: 2833days)
Extension
ComfyUI-post-processing-nodes
Latest Updated
2024-08-09
Github Stars
0.16K

How to Install ComfyUI-post-processing-nodes

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

HSVThresholdMask Description

Create image masks based on HSV color space thresholds for color isolation and manipulation.

HSVThresholdMask:

The HSVThresholdMask node is designed to create a mask from an image based on specified thresholds in the HSV (Hue, Saturation, Value) color space. This node is particularly useful for isolating specific colors or intensity ranges within an image, allowing you to focus on or manipulate certain parts of the image based on their color properties. By converting the image to the HSV color space, the node can apply thresholds to the hue, saturation, or value channels, generating a binary mask that highlights the areas of the image that fall within the specified thresholds. This can be beneficial for tasks such as color-based segmentation, object detection, or any scenario where color properties are a key factor.

HSVThresholdMask Input Parameters:

image

This parameter expects an image tensor in the format of a 4D tensor (batch_size, height, width, channels). The image will be processed to generate the mask based on the specified HSV thresholds.

low_threshold

This parameter sets the lower bound of the threshold for the selected HSV channel. It is a float value ranging from 0 to 1, with a default value of 0.2. Adjusting this value will determine the minimum value of the HSV channel that will be included in the mask.

high_threshold

This parameter sets the upper bound of the threshold for the selected HSV channel. It is a float value ranging from 0 to 1, with a default value of 0.7. Adjusting this value will determine the maximum value of the HSV channel that will be included in the mask.

hsv_channel

This parameter specifies which HSV channel to apply the threshold to. It can be one of the following options: "hue", "saturation", or "value". Selecting the appropriate channel will determine which aspect of the color space the thresholds will be applied to.

HSVThresholdMask Output Parameters:

IMAGE

The output is a binary mask image where the pixels that fall within the specified HSV thresholds are highlighted. This mask can be used for further image processing tasks, such as segmentation or object detection.

HSVThresholdMask Usage Tips:

  • To isolate specific colors in an image, use the "hue" channel and adjust the low and high thresholds to the desired color range.
  • For tasks requiring intensity-based segmentation, use the "value" channel to focus on brightness levels within the image.
  • Experiment with different threshold values to fine-tune the mask and achieve the desired level of detail and accuracy.

HSVThresholdMask Common Errors and Solutions:

Image tensor shape mismatch

  • Explanation: The input image tensor does not have the expected shape (batch_size, height, width, channels).
  • Solution: Ensure that the input image tensor is correctly formatted as a 4D tensor with the appropriate dimensions.

Invalid HSV channel selection

  • Explanation: The specified HSV channel is not one of the allowed options ("hue", "saturation", "value").
  • Solution: Verify that the hsv_channel parameter is set to either "hue", "saturation", or "value".

Threshold values out of range

  • Explanation: The low_threshold or high_threshold values are outside the allowed range of 0 to 1.
  • Solution: Adjust the threshold values to be within the range of 0 to 1.

HSVThresholdMask Related Nodes

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