Image segmentation-based pathfinding