You are here

How to Analyze Traffic Webcam Data With Google Cloud Vision API

Google’s Cloud Vision image recognition software uses machine learning to recognise the content of images to determine things like objects, colors, facial expressions and notable landmarks. The tool is available via the Google Cloud Vision API to enable sophisticated image analysis in apps, robots and other software systems to identify, classify and group images according to predefined parameters.

In this tutorial, Ivan Kutil shows followers how he built a simple traffic analysis tool that looks at real-time records of city traffic from webcams to determine the amount of traffic at a given time. The author set up a Google Sheet as a database for a new Apps Script project, then activated the API in the Developer Console and completed authentication with OAuth 2.0.

A simple script fetches the webcam image from its public URL as a Blob, converting it into base64 and sending it to Cloud Vision API with a parameter for label_detection. A JSON response delivers a description of the image according to the labels with a confidence score of between 0 and 1 as the highest and lowest confidence respectively.

Kutil then set up an automatic Apps Script to run every 5 minutes and results are shown on a graph over time. As an example, the “road” label showing a high confidence score (nearing 1) means the system recognised road in the image with high confidence, meaning that there was little traffic obscuring the camera’s view of the road.

Inversely, when the graph shows high confidence results for the “traffic” label, the system is confidently recognising traffic in the images, meaning the roads are busy. While this tool isn’t perfect, it serves as a valuable example of what can be achieved with Cloud Vision API and a few lines of code.

Be sure to read the next Recognition article: Why IBM's Watson Speech API Might be Right for Your App

Original Article

Analyse City Traffic from Webcams Through Google Cloud Vision API

 

Comments

sklearn

Very creative use of the API. I wonder how much web cam coverage there is.

Tp- Link-Router

The webcam image from its public URL as a Blob, converting it into base64 and sending it to Cloud Vision API with a parameter for label_detection. If anyone knows about more webcam just follow at netgear arlo support take all the information regarding.