Thomas_F1
15-05-2017, 15:29
Buon pomeriggio, c'č qualcuno che gentilmente mi puņ spiegare questo programma? non dico riga per riga ma quasi :asd::mumbe:
import argparse
import base64
import picamera
from googleapiclient import discovery
from oauth2client.client import GoogleCredentials
def takephoto():
camera = picamera.PiCamera()
camera.capture('image.jpg')
def main():
takephoto() # First take a picture
"""Run a label request on a single image"""
credentials = GoogleCredentials.get_application_default()
service = discovery.build('vision', 'v1', credentials=credentials)
with open('image.jpg', 'rb') as image:
image_content = base64.b64encode(image.read())
service_request = service.images().annotate(body={
'requests': [{
'image': {
'content': image_content.decode('UTF-8')
},
'features': [{
'type': 'LOGO_DETECTION',
'maxResults': 1
}]
}]
})
response = service_request.execute()
print response
if __name__ == '__main__':
main()
import argparse
import base64
import picamera
from googleapiclient import discovery
from oauth2client.client import GoogleCredentials
def takephoto():
camera = picamera.PiCamera()
camera.capture('image.jpg')
def main():
takephoto() # First take a picture
"""Run a label request on a single image"""
credentials = GoogleCredentials.get_application_default()
service = discovery.build('vision', 'v1', credentials=credentials)
with open('image.jpg', 'rb') as image:
image_content = base64.b64encode(image.read())
service_request = service.images().annotate(body={
'requests': [{
'image': {
'content': image_content.decode('UTF-8')
},
'features': [{
'type': 'LOGO_DETECTION',
'maxResults': 1
}]
}]
})
response = service_request.execute()
print response
if __name__ == '__main__':
main()