김태희

add Image Detection Code and Test Data

......@@ -6,7 +6,7 @@ import os
os.environ["GOOGLE_APPLICATION_CREDENTIALS"]="C:/Users/User/Downloads/SmokeDetection-ab1773dcbc6a.json"
client = vision.ImageAnnotatorClient()
path = 'D:/Curricular/5-2/CapstoneDesign2/git/Prj/test01.jpg'
path = 'D:/Curricular/5-2/CapstoneDesign2/git/Prj/TestPhoto/test02.jpg'
with io.open(path, 'rb') as image_file:
content = image_file.read()
......
"""Detects Image Part in the file."""
import io
import os
# Imports the Google Cloud client library
from google.cloud import vision
# Instantiates a client
client = vision.ImageAnnotatorClient()
# The name of the image file to annotate
file_name = os.path.abspath('D:/Curricular/5-2/CapstoneDesign2/git/Prj/TestPhoto/test02.jpg')
# Loads the image into memory
with io.open(file_name, 'rb') as image_file:
content = image_file.read()
image = vision.Image(content=content)
# Performs label detection on the image file
response = client.label_detection(image=image)
labels = response.label_annotations
print('Labels:')
for label in labels:
print(label.description)
\ No newline at end of file