# \dontshow{
if(require(opencv))
{
# }
library(opencv)
data(openseadragon_areas)
# \dontshow{
url <- system.file(package = "recogito", "examples",
"Cat_and_dog_standoff_(3926784260).jpg")
attr(openseadragon_areas, "src") <- url
# }
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)
# \dontshow{
}
# }
Run the code above in your browser using DataLab