gcv_get_image_annotations {googleCloudVisionR}R Documentation

Get parsed image annotations from the Google Cloud Vision API

Description

Given a list of images, a feature type and the maximum number of responses, this functions calls the Google Cloud Vision API, and returns the image annotations in a data.table format.

Usage

gcv_get_image_annotations(imagePaths, feature = "LABEL_DETECTION",
  maxNumResults = NULL, batchSize = 64L, savePath = NULL)

Arguments

imagePaths

character, file paths, URLs or Cloud Storage URIs of the images, can be a combination of all three

feature

character, one out of: "LABEL_DETECTION", "FACE_DETECTION", "TEXT_DETECTION", "DOCUMENT_TEXT_DETECTION", "LOGO_DETECTION", "LANDMARK_DETECTION"

maxNumResults

integer, the maximum number of results (per image) to be returned.

batchSize

integer, the chunk size for batch processing

savePath

character, if specified, results will be saved to this path (as .csv)

Value

a data frame with image annotation results

Examples

## Not run: 
    # Label Detection (default), with maximum 7 results returned per image
    imagePath <- system.file(
      "extdata", "golden_retriever_puppies.jpg", package = "googleCloudVisionR"
    )
    gcv_get_image_annotations(imagePaths = imagePath, maxNumResults = 7)

    # Face detection
    imagePath <- system.file(
      "extdata", "arnold_wife.jpg", package = "googleCloudVisionR"
    )
    gcv_get_image_annotations(imagePaths = imagePath, feature = "FACE_DETECTION")

    # Google Cloud Storage URI as input
    gcv_get_image_annotations("gs://vision-api-handwriting-ocr-bucket/handwriting_image.png")

## End(Not run)


[Package googleCloudVisionR version 0.2.0 Index]