Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Image
- import math
- import ox
- data = ox.file.read_file('common_rpf/data/maps/paths.ipl')
- points = [
- [float(value) for value in line[1:].split(', ')[:3]]
- for line in data.split('\n')[27:1301]
- ]
- extrema = [
- [min(value), max(value)] for value in [
- [point[i] for point in points] for i in range(3)
- ]
- ]
- size = [int(math.ceil(value[1] - value[0])) for value in extrema]
- image = Image.new('L', (size[0], size[1]))
- pixel = image.load()
- for point in points:
- pixel[
- int(point[0] - extrema[0][0]),
- int(point[1] - extrema[1][0])
- ] = 64 + int(math.sqrt((point[2] - extrema[2][0]) / size[2]) * 192)
- image.save('paths.png')
Advertisement
Add Comment
Please, Sign In to add comment