Oh I see what you want to do. Yes it is. Sorry for replying a bit late, was out of town. Anyways I'll explain the code.
So the first 6 lines are just importing the necessary modules.
In the definition of the
takephoto() function it creates an object called camera and uses it to take the picture.
In the main function the first line obviously takes a photo then it does some setup with Google. That is done in the next two lines? First the "credentials" object is created and on the next line the "service" object is created. In that line it's telling Google your goin to be using the vision API.
Then we get to the with open area. So basically the image is opened and when it is (next line) it basically primes the photo for being sent to Google. Skipping down to the
service_request = .... that line is telling Google what exactly you want to do with the image and sends the image. Notice the part that says
LANDMARK_DETECTION. That's saying obviously you want to do landmark detection. I also would like to highlight that when it says
'content': image_content.decode('UTF-8') That is telling google what image to send.
So now that Google knows what you want from the image just sent, it's time to get the image data
So go down to the
response = service_request.execute() line. That creates the object called response which allows us to get data about the image from Google.
After that it prints out the response.
And for the last 2 lines that obviously runs the main() function.
I hope this helps. If my explanation was to complex or too basic please ask for clarification.