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/text at master · PoulsQ/java-docs-samples

Expand file tree

/

text

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
 
 
/

text

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
data
data
 
 
src
src
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
pom.xml
pom.xml
 
 

README.md

Outline

Text Detection using the Vision API

This sample requires Java 8.

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.

Introduction

This example uses the Cloud Vision API to detect text within images, stores this text in an index, and then lets you query this index.

Initial Setup

Install and Start Up a Redis server

This example uses a redis server, which must be up and running before you start the indexing. To install Redis, follow the instructions on the download page, or install via a package manager like homebrew or apt-get as appropriate for your OS.

The example assumes that the server is running on localhost, on the default port, and it uses redis dbs 0 and 1 for its data. Edit the example code before you start if your redis settings are different.

Set up OpenNLP

Download Tokenizer data and save it to this directory.

wget http://opennlp.sourceforge.net/models-1.5/en-token.bin

Run the sample

To build and run the sample, run the jar from this directory. You can provide a directory to index the text in all the images it contains.

mvn clean compile assembly:single
java -cp target/vision-text-1.0-SNAPSHOT-jar-with-dependencies.jar com.google.cloud.vision.samples.text.TextApp data/

Once this builds the index, you can run the same command without the input path to query the index.

java -cp target/vision-text-1.0-SNAPSHOT-jar-with-dependencies.jar com.google.cloud.vision.samples.text.TextApp
You are visitor 01402775 — 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.