Integrate Google Cloud Vision with Spring Boot

1. Before you begin :

Create a Google Cloud Platform project with billing enabled.

2. Create Spring boot application :

https://start.spring.io/

3. Create a service account :

Follow these steps :

4. Encode the secret to base-64 encoded :

Open the Json file and copy his content.

server.port=8888 # this to change the default port to 8888spring.cloud.gcp.credentials.encoded-key=paste the encoded secret here

5. Detect Labels:

The Vision API can detect and extract information about entities in an image across a broad group of categories.

[
, mid: "/m/096mb"
description: "Lion"
score: 0.8928216
topicality: 0.8928216
, mid: "/m/0bm9sv0"
description: "Masai lion"
score: 0.88758737
............
]

6. Detect landmarks :

Landmark Detection detects popular natural and human-made structures within an image.

[
mid: "/m/02j81"
description: "Eiffel Tower"
score: 0.65436697
bounding_poly {
vertices {
x: 201
y: 53
}
vertices {
x: 359
y: 53
}
vertices {
x: 359
y: 315
}
vertices {
x: 201
y: 315
}
}
locations {
lat_lng {
latitude: 48.858461
longitude: 2.294351
}
}
...........
]

7. Optical Character Recognition (OCR):

The Vision API can detect and extract text from images.

WAITING?
PLEASE
TURN OFE
YOUR
ENGINE

8. Last word:

You can find the code from GitHub :

I'm Hamdi, a software engineer 👨‍💻, and writer 📝