我是一个R用户,在使用Python进行图像分析时遇到了问题。什么是计算图像中心建筑物面积的有效方法?其目标是将边缘算法应用于googlemaps静态图像,并计算地址屋顶的表面积。在from pygeocoder import Geocoder
import urllib
import numpy as np
from scipy import ndimage
from skimage import filter, io, measure
import matplotlib.pyplot as plt
def getMap(address):
"""Geocode address and retreive image centered
around lat/long"""
results = Geocoder.geocode(address)
lat, lng = results[0].coordinates
zip_code = results[0].postal_code
map_url = 'https://maps.googleapis.com/maps/api/staticmap?center={0},{1}&size=640x640&zoom=19&sensor=false&maptype=roadmap&&style=visibility:simplified|gamma:0.1'
request_url = map_url.format(lat, lng)
req = urllib.urlopen(request_url)
return(req)
def