Automatic Route Importer
Function for loading colored routes from a file. This way, a user can define his own paths without a manual coordinate input.
This commit is contained in:
@ -12,6 +12,9 @@ from tools import Worker, Isovist, TrackCollection, IndoorToolset # , Track, Is
|
||||
|
||||
if __name__ == '__main__':
|
||||
walkableTiles = 255
|
||||
trackColor = 103
|
||||
startColor = 210
|
||||
endColor = 79
|
||||
w = Worker()
|
||||
# file = 'maps\Tate.bmp'
|
||||
# file = 'maps\Map.bmp'
|
||||
@ -20,9 +23,9 @@ if __name__ == '__main__':
|
||||
# file = 'maps\doom.bmp'
|
||||
# file = 'maps\priz.bmp'
|
||||
# file = 'maps\\tum.bmp'
|
||||
file = 'maps\crossing.bmp'
|
||||
file = 'maps\\x.bmp'
|
||||
with Image.open(file) as f:
|
||||
baseToolset = IndoorToolset(np.array(f), walkableTiles, worker=w, isoVistSize=30)
|
||||
baseToolset = IndoorToolset(np.array(f), walkableTiles, worker=w)
|
||||
|
||||
baseToolset.refresh_random_clock()
|
||||
|
||||
@ -87,21 +90,31 @@ if __name__ == '__main__':
|
||||
|
||||
"""Synthesyse n-bunch Tracks/ minimum length / storage for TensorFlow"""
|
||||
# Some Explenation text here
|
||||
if True:
|
||||
if False:
|
||||
pCol = TrackCollection(baseToolset)
|
||||
pCol.add_single_track((67, 103), (67, 64), qhull=False)
|
||||
pCol.add_single_track((47, 82), (88, 82), qhull=False)
|
||||
#pCol.add_n_bunch_random(
|
||||
# pCol.add_n_bunch_random(
|
||||
# 1000, penalty=None, safe=False,
|
||||
# minLen=50
|
||||
# # minLen=int(sqrt(baseToolset.width * baseToolset.height) / 4)
|
||||
#)
|
||||
# )
|
||||
|
||||
pCol.save_to_disc('crossing')
|
||||
|
||||
# pCol3 = TrackCollection(baseToolset)
|
||||
# pCol3.recover_from_disc('synthetic_tracks_sizeDIV4')
|
||||
|
||||
"""Read Tracks from colored Bitmap"""
|
||||
if True:
|
||||
pCol = TrackCollection(baseToolset)
|
||||
pCol.read_from_basemap(startColor, trackColor, endColor)
|
||||
baseToolset.isovists.set_rangeLimit(30)
|
||||
baseToolset.isovists.add_for_trackCollection(pCol)
|
||||
print(len(pCol))
|
||||
pCol.save_to_disc('x')
|
||||
|
||||
pass
|
||||
print('Success!')
|
||||
pass
|
||||
pass
|
||||
|
Reference in New Issue
Block a user