Skip to contents

This function calculates the bounding boxes for a given list of contours.

Usage

object_bbox(contours)

Arguments

contours

A list of matrices, where each matrix contains two columns representing (x, y) coordinates of a contour.

Value

A list of bounding boxes, where each bounding box is represented as a list with x_min, y_min, x_max, and y_max values.

Examples

if(interactive()){
contours <- list(
  matrix(c(10, 20, 30, 40, 50, 60, 70, 80, 90, 100,
           110, 120, 130, 140, 150, 160, 170, 180, 190, 200),
         ncol = 2, byrow = FALSE)
)
bbox_list <- object_bbox(contours)
print(bbox_list)
}