Please install R and R-Studio before you try Google Vision APIs.
Calling Googlevision APIs using R Language
Click here for the slides I used in the class
Click here for Key IOT Networks comparison
Here is the code I used in R to demonstrate Google Vision APIs. Remember to install R, R studio, and other libraries first.
========================================
# library(rjson) # to get credentials for Google Cloud Console
library(“rjson”)
creds = fromJSON(file=’C:/Downloads/credentials.json’) # Retrieve Credentials file from cloud console
options(“googleAuthR.client_id” = creds$installed$client_id)
options(“googleAuthR.client_secret” = creds$installed$client_secret)
options(“googleAuthR.scopes.selected” = c(“https://www.googleapis.com/auth/cloud-platform”))
googleAuthR::gar_auth_service(json_file=”C:/Downloads/credentials.json”)
imagePath <- “C:/Downloads/Taj.jpg”
gcv_get_image_annotations(
imagePaths = imagePath,
# feature = “FACE_DETECTION”,
feature = “LANDMARK_DETECTION”,
maxNumResults = 7
)
imagePath <- “C:/Downloads/CarsAndDog.jpg”
gcv_get_image_annotations(
imagePaths = imagePath,
# feature = “LABEL_DETECTION”,
maxNumResults = 10
)
================================