Visit ComfyUI Online for ready-to-use ComfyUI environment
Extract bounding box info from text using regex, convert to objects for AI image tasks, flexible coordinate options.
The ParseBoundingBoxes
node is designed to extract bounding box information from a given string, making it a valuable tool for AI artists working with image data. This node utilizes a regular expression to identify and parse bounding box coordinates from text, converting them into a list of bounding box objects. These objects are compatible with other tools and systems that handle bounding boxes, such as mtb
. The node offers flexibility in how bounding boxes are defined, allowing you to choose between relative coordinates, which are expressed as float values between 0 and 1, or absolute image coordinates. Additionally, you can specify whether the bounding boxes should be defined by their corner points or by their width and height. This versatility makes the ParseBoundingBoxes
node an essential utility for efficiently managing and interpreting bounding box data in various image processing tasks.
The image
parameter represents the image data that the bounding boxes will be applied to. This parameter is crucial as it provides the context in which the bounding box coordinates are interpreted, especially when using relative coordinates. The image's dimensions are used to calculate the absolute positions of the bounding boxes if the relative
parameter is set to true.
The string
parameter is the text input from which the bounding box coordinates are extracted. This string should contain the bounding box data formatted in a way that the node's regular expression can recognize. The accuracy and completeness of the bounding box extraction depend on the correct formatting of this string.
The relative
parameter is a boolean that determines whether the bounding box coordinates are interpreted as relative or absolute. When set to true, the coordinates are considered relative, meaning they are expressed as float values between 0 and 1, representing a proportion of the image's dimensions. When false, the coordinates are treated as absolute pixel values. The default value is true.
The corners_only
parameter is a boolean that specifies the format of the bounding box coordinates. If true, the bounding box is defined by its corner points, i.e., [(x1, y1), (x2, y2)]. If false, the bounding box is defined by its top-left corner and its dimensions, i.e., [(x1, y1), (width, height)]. The default value is true.
The BBOX
output parameter is a list of bounding box objects extracted from the input string. Each bounding box is represented by a tuple containing its coordinates and dimensions, formatted according to the corners_only
parameter. This output is essential for further processing or analysis of the image data, as it provides the precise locations and sizes of the areas of interest within the image.
relative
parameter to easily scale bounding boxes across different image sizes without manually recalculating coordinates.corners_only
parameter to match the expected input format.© Copyright 2024 RunComfy. All Rights Reserved.