Calls the 'Google Vision' API to return annotations. The function automatically creates batches

get_annotations(images, features, max_res, mode)



A character vector for images to be annotated. Can either be url strings or local images, as specified with mode.


A character vector for the features to be returned. Accepts 'all' or any combination of the following inputs: 'label', 'web', 'text', 'face', 'landmark', 'logo', 'safe_search', 'object', 'properties'


An integer specifying the maximum number of results to be returned for each feature.


Accepts 'url' for image urls and 'local' for file paths to local images.


An response object of class 'gvision_annotations'.

See also

Google Vision features and quotas.


# \dontrun{ gvision_init()
#> Succesfully initialized authentification credentials.
# one image url sw_image <- '' results <- get_annotations(images = sw_image, # image character vector features = 'all', # request all available features max_res = 10, # maximum number of results per feature mode = 'url') # maximum number of results per feature
#> [1] "Sending API request(s).."
# multiple image urls finn_image <- '' padme_image <- '' input_imgs <- c(sw_image, finn_image, padme_image) results <- get_annotations(images = input_imgs, features = c('label', 'face'), max_res = 5, mode = 'url')
#> [1] "Sending API request(s).."
# one local image temp_img_path <- tempfile(fileext = '.png') download.file(finn_image, temp_img_path, mode = 'wb', quiet = TRUE) results <- get_annotations(images = temp_img_path, features = c('label', 'face'), max_res = 5, mode = 'local')
#> [1] "Sending API request(s).."
# }