Fiddling around with RoogleVision (calls to the Google Cloud Vision API). This was heavily cribbed from https://www.stoltzmaniac.com/google-vision-api-in-r-rooglevision/.

# Normal Libraries
library(tidyverse)
library(knitr)
# Uncomment the following line if you don't have the package installed already.
# devtools::install_github("flovv/RoogleVision")
library(RoogleVision)
library(jsonlite) # to import credentials
# For image processing. Uncomment the next two lines the first time you run
# to get the library loaded (it may take a while).
# source("http://bioconductor.org/biocLite.R")
# biocLite("EBImage")
library(EBImage)
# For Latitude Longitude Map
library(leaflet)
# Get Google Analytics credentials and set them. 
ga_client_id <- Sys.getenv("GA_CLIENT_ID")
ga_client_secret <- Sys.getenv("GA_CLIENT_SECRET")
# Authenticate
options(googleAuthR.client_id = ga_client_id)
options(googleAuthR.client_secret = ga_client_secret) 
options("googleAuthR.scopes.selected" = c("https://www.googleapis.com/auth/cloud-platform"))
googleAuthR::gar_auth()
2017-08-07 18:38:25> Token cache file: .httr-oauth
2017-08-07 18:38:25> Scopes: https://www.googleapis.com/auth/cloud-platform

Let’s do the labels test and the landmark detection test.

# Set the image
image_to_chk <- "images/DSC_0040.jpg"
# Load the image for display
image_plot <- readImage(image_to_chk)
# Scale down; the height is determined automatically so that
# the aspect ratio is preserved. This could be more elegant -- assumes
# the image being checked is roughly...large.
image_plot <- resize(image_plot, dim(image_plot)[1]/8)
# Show the scaled image
display(image_plot,
        method = "raster")

# Detect labels
image_label_detection = getGoogleVisionResponse(image_to_chk,
                                                feature = "LABEL_DETECTION")
# Display labels
kable(image_label_detection)

mid description score
/m/05_5t0l landmark 0.9319534
/m/01bqvp sky 0.9245625
/m/01wkk9 town square 0.8642233
/m/0pgl9 tourist attraction 0.8545930
/m/01c6yl spire 0.8338503

# Detect landmarks
image_landmark_detection = getGoogleVisionResponse(image_to_chk,
                                                   feature = "LANDMARK_DETECTION")
# Display landmarks table
image_landmark_detection
# Get the landmark location (for the first landmark ID'd)
latt = image_landmark_detection$locations[[1]][[1]][[1]]
lon = image_landmark_detection$locations[[1]][[1]][[2]]
map_plot = leaflet() %>%
  addProviderTiles(providers$CartoDB.Positron) %>%
  setView(lng = lon, lat = latt, zoom = 5) %>%
  addMarkers(lng = lon, lat = latt)
# Display the location on a map
map_plot
LS0tCnRpdGxlOiAiRnVuIHdpdGggUm9vZ2xlVmlzaW9uIgpvdXRwdXQ6IGh0bWxfbm90ZWJvb2sKLS0tCgpGaWRkbGluZyBhcm91bmQgd2l0aCBSb29nbGVWaXNpb24gKGNhbGxzIHRvIHRoZSBHb29nbGUgQ2xvdWQgVmlzaW9uIEFQSSkuIFRoaXMgd2FzIGhlYXZpbHkgY3JpYmJlZCBmcm9tIFtodHRwczovL3d3dy5zdG9sdHptYW5pYWMuY29tL2dvb2dsZS12aXNpb24tYXBpLWluLXItcm9vZ2xldmlzaW9uL10oaHR0cHM6Ly93d3cuc3RvbHR6bWFuaWFjLmNvbS9nb29nbGUtdmlzaW9uLWFwaS1pbi1yLXJvb2dsZXZpc2lvbi8pLgoKYGBge3J9CgojIE5vcm1hbCBMaWJyYXJpZXMKbGlicmFyeSh0aWR5dmVyc2UpCmxpYnJhcnkoa25pdHIpCgojIFVuY29tbWVudCB0aGUgZm9sbG93aW5nIGxpbmUgaWYgeW91IGRvbid0IGhhdmUgdGhlIHBhY2thZ2UgaW5zdGFsbGVkIGFscmVhZHkuCiMgZGV2dG9vbHM6Omluc3RhbGxfZ2l0aHViKCJmbG92di9Sb29nbGVWaXNpb24iKQpsaWJyYXJ5KFJvb2dsZVZpc2lvbikKbGlicmFyeShqc29ubGl0ZSkgIyB0byBpbXBvcnQgY3JlZGVudGlhbHMKCiMgRm9yIGltYWdlIHByb2Nlc3NpbmcuIFVuY29tbWVudCB0aGUgbmV4dCB0d28gbGluZXMgdGhlIGZpcnN0IHRpbWUgeW91IHJ1bgojIHRvIGdldCB0aGUgbGlicmFyeSBsb2FkZWQgKGl0IG1heSB0YWtlIGEgd2hpbGUpLgojIHNvdXJjZSgiaHR0cDovL2Jpb2NvbmR1Y3Rvci5vcmcvYml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