gcv_get_raw_response: Get raw API response 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 raw response from the API. For a friendlier response, refer to the 'gcv_get_image_annotations' function, which returns results in a data.table format (however, the information returned is limited compared to the raw response).

Usage

1
2
3
4
5
gcv_get_raw_response(
  imagePaths,
  feature = "LABEL_DETECTION",
  maxNumResults = 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", "IMAGE_PROPERTIES", "OBJECT_LOCALIZATION"

maxNumResults

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

Value

a response object returned by the API. To get the image annotations, take the "content" element from the object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
    imagePath <- system.file(
      "extdata", "golden_retriever_puppies.jpg", package = "googleCloudVisionR"
    )
    raw_response <- gcv_get_raw_response(imagePaths = imagePath, maxNumResults = 7)

    str(raw_response)
    raw_response

## End(Not run)

cloudyr/googleCloudVisionR documentation built on April 2, 2020, 10:56 p.m.