<reponame>DisenWang/google_api<gh_stars>0
import argparse
import io

from google.cloud import vision
from google.cloud.vision import types


def detect_landmarks(path):
    """Detects landmarks in the file."""
    client = vision.ImageAnnotatorClient()

    # [START migration_landmark_detection]
    with io.open(path, 'rb') as image_file:
        content = image_file.read()

    image = types.Image(content=content)

    response = client.landmark_detection(image=image)
    landmarks = response.landmark_annotations
    print('Landmarks:')

    for landmark in landmarks:
        print(landmark.description)
        for location in landmark.locations:
            lat_lng = location.lat_lng
            print('Latitude'.format(lat_lng.latitude))
            print('Longitude'.format(lat_lng.longitude))
    # [END migration_landmark_detection]
# [END def_detect_landmarks]

detect_landmarks('004.jpg')

import argparse
import io

from google.cloud import vision
from google.cloud.vision import types


def detect_landmarks(path):
    """Detects landmarks in the file."""
    client = vision.ImageAnnotatorClient()

    # [START migration_landmark_detection]
    with io.open(path, 'rb') as image_file:
        content = image_file.read()

    image = types.Image(content=content)

    response = client.landmark_detection(image=image)
    landmarks = response.landmark_annotations
    print('Landmarks:')

    for landmark in landmarks:
        print(landmark.description)
        for location in landmark.locations:
            lat_lng = location.lat_lng
            print('Latitude'.format(lat_lng.latitude))
            print('Longitude'.format(lat_lng.longitude))
    # [END migration_landmark_detection]
# [END def_detect_landmarks]

detect_landmarks('004.jpg')
Detects landmarks in the file. # [START migration_landmark_detection] # [END migration_landmark_detection] # [END def_detect_landmarks]