normalize_box: Normalize a bounding-box

View source: R/prepare_dataset.R

normalize_boxR Documentation

Normalize a bounding-box

Description

Takes one or more bounding box and normalize each of their dimensions to size. If you notice it is just like calculating percentage except takes size = 1000 instead of 100.

Usage

normalize_box(bbox, width, height, size = 1000)

Arguments

width

(int): total width of the image

height

(int): total height of the image

size

(int): target value to normalize bounding_box to. (default 1000)

box

(vector of 4 int): the original bounding-box coordinates (xmin, ymin, xmax, ymax)

Value

a vector of size 4 integers with values normalised to size.

Examples

# normalise bounding-box in percent
normalize_box(c(227,34,274,41), width = 2100, height = 3970, size = 100)

cregouby/docformer documentation built on May 27, 2023, 11:19 p.m.