Skip to content

Commit aa569d7

Browse files
Adjusts comments
1 parent 7c0d55f commit aa569d7

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

api.py

+4
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@ def toBase64(image):
1818
def process(image, meters_squared_per_pixel, size ,taps=3, grid=20):
1919
downscale = int(size / grid)
2020
height, width, _ = image.shape
21+
# Detect roof colours
2122
recoloured_image = recolour.find_silver(image)
23+
# Detect houses & area
2224
houses, percentage, housearea = contours.get_contour_nodes(recoloured_image, meters_squared_per_pixel)
25+
# Generate tap locations
2326
tap_locations = TapWork.greedy_brute(houses,taps,(height,width), downscale)
27+
# Draw result image
2428
result = TapWork.draw_network(houses,tap_locations, size, image, meters_squared_per_pixel)
2529
population = round(housearea / 7)
2630
recommendation = round(population / 250)

contours.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def get_contour_nodes(image, meters_squared_per_pixel):
2121

2222
nodes = []
2323

24-
totalarea = 0;
24+
totalarea = 0
2525

2626
# loop over the contours
2727
for c in cnts:

map_downloader.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@ def download_patch(lat_long,api_key, size, zoom=19,file_format='png'):
1515
meters_squared_per_pixel = (156543.04 * math.cos(math.radians(float(latitude))) / (2**zoom))**2
1616
print("Meters squared per pixel: {} ".format(str(meters_squared_per_pixel)))
1717
# metadata = requests.get(("{}&mapMetadata=1&key={}").format(URL, api_key))
18-
# boundingbox = metadata.json()["resourceSets"][0]["resources"][0]["bbox"]
18+
# boundingbox = metadata.json()["resourceSets"][0]["resources"][0]["bbox"]
1919
# print(metadata.text);
20-
2120
image_array = numpy.asarray(bytearray(image.content), dtype=numpy.uint8)
2221
map_image = cv2.imdecode(image_array, -1)
23-
2422
# Crop
2523
map_image = map_image[0:int(size), 0:int(size)]
2624
return map_image, meters_squared_per_pixel

0 commit comments

Comments
 (0)