def test_walk(self): walker = BoxWalker(self.ZurichBellvue(), True) walker.load_convnet() walker.load_tiles() walker.load_streets() walker.walk() crosswalkNodes = walker.plain_result self.assertIsNotNone(crosswalkNodes) self.assertGreater(len(crosswalkNodes), 0)
def detect(bbox, redis): walker = BoxWalker(bbox) walker.load_convnet() walker.load_tiles() walker.load_streets() crosswalkNodes = walker.walk() redis_connection = Redis(redis[0], redis[1], password=redis[2]) q = Queue(Constants.QUEUE_RESULTS, connection=redis_connection) q.enqueue_call(func=store, args=(crosswalkNodes,), timeout=Constants.TIMEOUT)
def get_tile_streets(self, bbox): boxwalker = BoxWalker(bbox, False) boxwalker.load_tiles() boxwalker.load_streets() return boxwalker.tile, boxwalker.streets
def test_load_tile(self): walker = BoxWalker(self.smallTestBbox(), False) walker.load_tiles() self.assertIsNotNone(walker.tile)
def test_compare_detected_with_osm_different_points(self): walker = BoxWalker(self.smallTestBbox(), False) detected_crosswalks = [Node(47.0, 8.0), Node(47.1, 8.1)] walker.osm_crosswalks = [Node(48.0, 8.0), Node(48.1, 8.1)] result = walker._compare_osm_with_detected_crosswalks(detected_crosswalks) self.assertTrue(len(result) == 2)
def test_load_streets(self): walker = BoxWalker(self.smallTestBbox(), False) walker.load_streets() self.assertIsNotNone(walker.streets)
from src.detection.BoxWalker import BoxWalker from src.base.Bbox import Bbox from src.base.TileDrawer import TileDrawer ''' This example visualizes the results of the boxwalker ''' zurich_bellevue = Bbox.from_lbrt(8.814650, 47.222553, 8.825035, 47.228935) # Take the BBox you want walker = BoxWalker(zurich_bellevue) walker.load_convnet() walker.load_tiles() walker.load_streets() walker.walk() # Walk through the streets. This could take some time... crosswalkNodes = walker.plain_result # Takes all results found #crosswalkNodes = walker.compared_with_osm_result # Takes only the results which are not already in OSM # Draw and show the result drawer = TileDrawer.from_tile(walker.tile) for node in crosswalkNodes: drawer.draw_point(node) drawer.drawsection.save("boxsave.jpg") drawer.drawsection.show()