Learn R Programming

googleCloudVisionR (version 0.2.0)

gcv_get_raw_response: Get raw API response 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 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

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"

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

Run this code
# 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[["content"]]
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab