This project can be used to compute the path between two pixels of a map image. Various path finding algorithms like BFS, DFS, A* and Dijkstra can be used to find a path between pixels of images representing geographical features. It also shows real-time traversing of pixels using the OpenCV module.
The below diagrams show how provided terrain.png
is traversed using Breadth First Search, Depth First Search, A* and Dijkstra algorithms respectively.
The repository contains the requirements.txt
file with all the required modules.
Use this command to install all dependencies:
python3 -m pip install -r requirements.txt
-
Provide a sample file as an input to the program.
-
Specify path using
path.txt
-
Edit the
scripts/load.py
file to configure terrain and pixel colors to identify the terrain details. -
Run using the below command:
python3 run.py <terrain file> <algorithm(bfs,dfs,ucs,astar)>
python3 run.py terrain.png astar
Although all algorithms can be used to find the path, it is recommended to use A* to find the shortest path using heuristic search.