gcv_get_image_annotations: Get parsed image annotations from the Google Cloud Vision API

Description Usage Arguments Value Examples

View source: R/get_google_vision_response.R

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

1
2
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## 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)

googleCloudVisionR documentation built on March 26, 2020, 7:13 p.m.