Created
July 22, 2019 09:51
-
-
Save DataSolveProblems/2ef7261198d40483a56935556c8ef638 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, io | |
from draw_vertice import drawVertices | |
from google.cloud import vision | |
import pandas as pd | |
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = r'ServiceAccountToken.json' | |
client = vision.ImageAnnotatorClient() | |
file_name = 'test.jpg' | |
image_folder = './images/' | |
image_path = os.path.join(image_folder, file_name) | |
with io.open(image_path, 'rb') as image_file: | |
content = image_file.read() | |
image = vision.types.Image(content=content) | |
response = client.logo_detection(image=image) | |
logos = response.logo_annotations | |
for logo in logos: | |
print('Logo Description:', logo.description) | |
print('Confidence Score:', logo.score) | |
print('-'*50) | |
vertices = logo.bounding_poly.vertices | |
print('Vertices Values {0}'.format(vertices)) | |
drawVertices(content, vertices, logo.description) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment