Converts bounding box data between three common formats: xyxy, xywh, and centerwh. Can also convert between relative and absolute measurements if image width and height is known.
Usage
bbox_convert(
bbox,
from,
to,
image = NULL,
img_width = NULL,
img_height = NULL,
value_type = "absolute"
)Arguments
- bbox
character vector. Bounding box values.
- from, to
fromcharacter vector. Bounding box format to convert from.tocharacter vector. Bounding box format to convert to.Options: "xyxy", "xywh", and "centerwh"
- image
character or magick-image. The image to extract width and height from. Only used if converting between value types (
value_typeis opposite of the provided bounding box). Value type of the input bounding box is inferred. Mutually exclusive withimg_widthandimg_height.- img_width, img_height
numeric. The width and height of the image this bounding box belongs to. Only used if converting between value types (
value_typeis opposite of the provided bounding box). Value type of the input bounding box is inferred. Mutually exclusive mutually exclusive withimage.- value_type
character. Type of values to use for the converted bounding box measures. Either "absolute" for pixel values or "relative" for scaled values.
