ocv_crop_annotorious | R Documentation |
Crop annotations to a bounding box
ocv_crop_annotorious(data, bbox)
data |
an object as returned by |
bbox |
a vector with elements x, y, xmax, ymax |
data
where column polygon
and the rectangle information in x, y, width, height
is limited to the provided bounding box
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.