Press "Enter" to skip to content

Posts tagged as “Google”

A Lead to Using the Google Vision API

With everything on the internet, its flexibility and usage have crossed all bounds. From simple communication between people to demonstrating the hardest codes and presentations, everything in the modern world is through the internet.

One of the vast uses of the internet is API. An acronym for Application Program Interface is a communication between two software programs through the internet. One program; connects with the other through its API and gains access to the functionality and data of each other.

A wing of API is the vision API specific to images. These include face and landmark detection, image labeling, tagging of explicit content, and optical character recognition. But why do we need a vision API? The job of a vision API is to quickly analyze the entire content related to an image.

Advantages:

  • This interface reduces the complexity involved in regular image processing algorithms.
  • It provides increased accuracy in terms of object detection.
  • It performs image content analysis on the complete image and allots relevant labels like keywords, etc.
  • If there’s any text, it provides optical character recognition – OCR to identify the text.
  • Detects landmarks using landmark detection feature.
  • Using the face detection feature, it figures out the key elements of a face like orientation, etc.
  • Detects various companies’ logos with the help of a logo detection feature.
  • Enables us to avoid nudity, violence, or any other negativities related to images.

Hold on! Though there are numerous advantages of vision APIs, we can’t ignore the threats and frauds from the internet, right? To enjoy the features while securing our data on the internet, Google has introduced its version of vision API widely known as the Google Vision API.

Steps to using Google Vision API:

Before starting to use the API, we need to set up the project and Cloud Storage Bucket from Google by following the steps given below:

  • Setting up Project:
  1. Go to Google’s project selector page
  2. Create or select a project on the Cloud Console Page
  3. Enable the billing services for the cloud project
  4. Then enable the Cloud Vision API
  • Creating the Storage Bucket:
  1. Go to the Cloud Storage Browser page on the Cloud Console
  2. Click on ‘create bucket’
  3. Mention the following attributes in the dialogue box that appears: a unique name with no sensitive content as the bucket name is universally visible and the default storage class to be ‘standard’
  4. Then choose the location to store the bucket and click on ‘create’

Now to use the API after setting up the storage bucket, use the following steps:

  1. Download a demo image ‘demo-img.jpg’
  2. Then open the ‘cloud console storage browser’
  3. Select the bucket that you have created using the previous steps
  4. Click on ‘upload files’ and select the demo image file to upload wither from your local device or the cloud storage bucket
  5. Share the image publicly after it is successfully uploaded and listed on the cloud storage browser
  6. Complete the interactive API Explorer template, by replacing ‘cloud-samples-data/vision’ in the ‘image.source.imageUri’ field with the name of the Cloud Storage bucket where you uploaded the ‘demo-img.jpg’ file.
  7. Then click on ‘execute’ to send a request to the service.

That’s it! you’ve made the first request to the Google Vision API service. In case you wish to avoid unnecessary charges, you can use the cloud console to erase the project and cloud storage bucket when not needed.