GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — java-docs-samples/vision/landmark-detection at master · yanago/java-docs-samples

Expand file tree

/

landmark-detection

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
 
 
/

landmark-detection

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
src
src
 
 
README.md
README.md
 
 
pom.xml
pom.xml
 
 

README.md

Outline

Google Cloud Vision API Java Landmark Detection example

Open in Cloud Shell

This sample takes in the URI for an object in Google Cloud Storage, and identifies the landmark pictured in it.

Download Maven

This sample uses the Apache Maven build system. Before getting started, be sure to download and install it. When you use Maven as described here, it will automatically download the needed client libraries.

Setup

  • Create a project with the Google Cloud Console, and enable the Vision API.

  • Set up your environment with Application Default Credentials. For example, from the Cloud Console, you might create a service account, download its json credentials file, then set the appropriate environment variable:

    export GOOGLE_APPLICATION_CREDENTIALS=/path/to/your-project-credentials.json
  • Upload an image to Google Cloud Storage (for example, using gsutil or the GUI), and make sure the image is accessible to the default credentials you set up. Note that by default, Cloud Storage buckets and their associated objects are readable by service accounts within the same project. For example, if you're using gsutil, you might do:

    gsutil mb gs://<your-project-bucket>
    gsutil cp landmark.jpg gs://<your-project-bucket>/landmark.jpg
    # This step is unnecessary with default permissions, but for completeness,
    # explicitly give the service account access to the image. This email can
    # be found by running:
    # `grep client_email /path/to/your-project-credentials.json`
    gsutil acl ch -u <[email protected]>:R \
        gs://<your-project-bucket>/landmark.jpg

Run the sample

To build and run the sample, run the following from this directory:

mvn clean compile assembly:single
java -cp target/vision-landmark-detection-1.0-SNAPSHOT-jar-with-dependencies.jar com.google.cloud.vision.samples.landmarkdetection.DetectLandmark "gs://your-project-bucket/landmark.jpg"
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.