ocv_crop_annotorious {recogito} | R Documentation |
Crop annotations to a bounding box
Description
Crop annotations to a bounding box
Usage
ocv_crop_annotorious(data, bbox)
Arguments
data |
an object as returned by |
bbox |
a vector with elements x, y, xmax, ymax |
Value
data
where column polygon
and the rectangle information in x, y, width, height
is limited to the provided bounding box
Examples
library(opencv)
data(openseadragon_areas)
url <- attr(openseadragon_areas, "src")
img <- ocv_read(url)
bbox <- ocv_info(img)
bbox <- c(xmin = 0, ymin = 0, xmax = bbox$width - 1, ymax = bbox$height - 1)
x <- ocv_crop_annotorious(data = openseadragon_areas)
x <- ocv_crop_annotorious(data = openseadragon_areas, bbox = bbox)
img
area <- x[2, ]
ocv_polygon(img, pts = area$polygon[[1]], crop = TRUE)
area <- x[1, ]
ocv_rectangle(img, x = area$x, y = area$y, width = area$width, height = area$height)
area <- x[3, ]
ocv_rectangle(img, x = area$x, y = area$y, width = area$width, height = area$height)
[Package recogito version 0.2.1 Index]