Skip to content

Latest commit

 

History

History
41 lines (30 loc) · 2.76 KB

File metadata and controls

41 lines (30 loc) · 2.76 KB

ImageAnalysis-OpenCV-CloudVision

Image Recognition using OpenCV and performing Image Analysis using Google Cloud Vision API

Overview

Here is the code for image recognition using OpenCV and Google Cloud Vision API with input from webcam. OpenCV tracks faces and monitors for smiles, when a smile is detected a picture is saved locally on the computer, sent the image to Google Cloud Storage bucket, then Google Cloud Vision API is invoked to analyze that picture, and the results are sent back to console. We need a webcam to provide video input to the program.

Dependencies

Note:

Ubuntu 16.04 actually ships out-of-the-box with both Python 2.7 and Python 3.5 installed. The actual versions are:

  1. Python 2.7.12 (used by default when you type python in your terminal).
  2. Python 3.5.2 (can be accessed via the python3 command).

Make sure to create virtual environment for Python 2 while installing OpenCV. Virtualenv is a tool to create isolated Python environments. Refer: http://pythonopencv.com/install-opencv-3-3-and-python2-7-3-5-bindings-on-ubuntu-16-04/, https://www.pyimagesearch.com/2016/10/24/ubuntu-16-04-how-to-install-opencv/

If you face isssues while installing OpenCV or running the program, try re-installing OpenCV 'WITH_JPEG=OFF' in CMAKE command this time.

Usage

Run following code in the terminal,

python imagerecog-opencv-cloudvision.py

References

https://cloud.google.com/vision/docs/ https://cloud.google.com/python/ https://cloud.google.com/vision/docs/reference/libraries

Enjoy, Have Fun!