ComfyUI  >  Nodes  >  ComfyUI Layer Style >  LayerMask: MaskBoxDetect

ComfyUI Node: LayerMask: MaskBoxDetect

Class Name

LayerMask: MaskBoxDetect

Category
😺dzNodes/LayerMask
Author
chflame163 (Account age: 445 days)
Extension
ComfyUI Layer Style
Latest Updated
6/24/2024
Github Stars
0.6K

How to Install ComfyUI Layer Style

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

LayerMask: MaskBoxDetect Description

Detect and analyze specific regions within a mask image for precise image editing and layer manipulation.

LayerMask: MaskBoxDetect:

The LayerMask: MaskBoxDetect node is designed to detect and analyze specific regions within a mask image, providing valuable information about the bounding box of the detected area. This node is particularly useful for AI artists who need to identify and manipulate specific parts of an image based on mask data. By leveraging different detection methods, such as the minimum bounding rectangle, maximum inscribed rectangle, or mask area, this node offers flexibility in how the bounding box is determined. The node also allows for adjustments in the position and scale of the detected box, making it a powerful tool for precise image editing and layer manipulation.

LayerMask: MaskBoxDetect Input Parameters:

mask

The mask parameter is the input mask image that the node will analyze to detect the bounding box. This parameter is essential as it defines the area within which the detection will occur. The mask should be provided in a format compatible with the node's processing capabilities.

detect

The detect parameter specifies the detection method to be used. It can take one of three values: min_bounding_rect, max_inscribed_rect, or mask_area. The min_bounding_rect method finds the smallest rectangle that can enclose the mask area, max_inscribed_rect finds the largest rectangle that can fit within the mask area, and mask_area calculates the bounding box based on the mask's area. This parameter allows you to choose the most suitable detection method for your specific needs.

x_adjust

The x_adjust parameter allows you to adjust the detected bounding box's position along the x-axis. It accepts integer values ranging from -9999 to 9999, with a default value of 0. This adjustment can be useful for fine-tuning the position of the bounding box to better fit your requirements.

y_adjust

The y_adjust parameter allows you to adjust the detected bounding box's position along the y-axis. It accepts integer values ranging from -9999 to 9999, with a default value of 0. Similar to x_adjust, this parameter helps in fine-tuning the bounding box's position.

scale_adjust

The scale_adjust parameter allows you to scale the detected bounding box. It accepts floating-point values ranging from 0.01 to 100, with a default value of 1.0. This parameter is useful for resizing the bounding box to better match the desired dimensions.

LayerMask: MaskBoxDetect Output Parameters:

box_preview

The box_preview output parameter provides an image preview of the detected bounding box. This image helps visualize the detected area and any adjustments made to the bounding box.

x_percent

The x_percent output parameter indicates the x-coordinate of the center of the detected bounding box as a percentage of the mask's width. This value helps in understanding the relative position of the bounding box within the mask.

y_percent

The y_percent output parameter indicates the y-coordinate of the center of the detected bounding box as a percentage of the mask's height. This value helps in understanding the relative position of the bounding box within the mask.

width

The width output parameter provides the width of the detected bounding box. This value is useful for understanding the dimensions of the detected area.

height

The height output parameter provides the height of the detected bounding box. This value is useful for understanding the dimensions of the detected area.

x

The x output parameter provides the x-coordinate of the top-left corner of the detected bounding box. This value helps in positioning the bounding box within the mask.

y

The y output parameter provides the y-coordinate of the top-left corner of the detected bounding box. This value helps in positioning the bounding box within the mask.

LayerMask: MaskBoxDetect Usage Tips:

  • Use the detect parameter to choose the most appropriate detection method for your specific task. For example, use min_bounding_rect for tight bounding boxes and max_inscribed_rect for larger, inscribed rectangles.
  • Adjust the x_adjust and y_adjust parameters to fine-tune the position of the bounding box, ensuring it aligns perfectly with the desired area.
  • Utilize the scale_adjust parameter to resize the bounding box, making it easier to fit the detected area into your overall image composition.

LayerMask: MaskBoxDetect Common Errors and Solutions:

"Mask dimension error"

  • Explanation: This error occurs when the input mask does not have the expected dimensions.
  • Solution: Ensure that the mask is provided in the correct format and dimensions. If the mask is 2D, it should be unsqueezed to add an extra dimension.

"Invalid detection method"

  • Explanation: This error occurs when an unsupported detection method is specified in the detect parameter.
  • Solution: Verify that the detect parameter is set to one of the supported values: min_bounding_rect, max_inscribed_rect, or mask_area.

"Scale adjustment out of range"

  • Explanation: This error occurs when the scale_adjust parameter is set to a value outside the allowed range.
  • Solution: Ensure that the scale_adjust parameter is within the range of 0.01 to 100. Adjust the value accordingly to fit within this range.

LayerMask: MaskBoxDetect Related Nodes

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