Intelligent Maze Solving Robot Based On Image Processing and Graph Theory Algorithms
Intelligent Maze Solving Robot Based On Image Processing and Graph Theory Algorithms
net/publication/321121617
Intelligent Maze Solving Robot Based on Image Processing and Graph Theory
Algorithms
CITATIONS READS
7 5,097
6 authors, including:
Majde Elhabbash
Synaptic Solar, United State
1 PUBLICATION 7 CITATIONS
SEE PROFILE
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by Mohammad O.A. Aqel on 05 February 2018.
49
processing. The camera should be calibrated in order to get its (2)
intrinsic and extrinsic parameters. Camera calibration is a
necessary step in computer vision which provides the ability to
(2) (1) (2)
establish a relation between 2D image pixels coordinates and (2) (1) (0) (1) (2)
real-world coordinates [10-12]. (2) (1) (2)
B. Preprocessing of Maze Image (2)
This is an important step which involves image pre- Fig. 4. Cell traversal manner using breadth first search.
processing to prepare the maze image to be analyzed using one
of graph theory algorithms. This step includes image filtering time in order to be implemented in this proposed maze-solving
and detection of starting and end points of maze. The code is robotic system.
developed using Visual C++ and OpenCV libraries. First, the Breadth First Search is an algorithm for searching graph
code imports the captured maze image and applies some filters data structures. It can be used for searching the maze cells or
for image enhancement. After that and from the colored maze nodes [13]. The job of this algorithm is to reach the goal cell
image, the starting location and end location of the maze are from the starting cell. It starts at starting cell of the maze and
detected. The red colored line represents the starting location explores the neighbor cells first before moving to the next
or the maze entrance while the yellow colored line represents level neighbors. It uses cost storage to determine the order of
the end location of maze or the maze exit gate as shown in Fig. cells visited as shown in Fig. 4 and keeps records of which cell
2. Finally and after detection of maze entrance and exit are immediate neighbors of starting cell. Starting cell is
locations and based on color intensity thresholds, the colored labeled as (0). The algorithm expands cells in order of their
image is converted into binary image as shown in Fig. 3 and distance from the starting cell, generating one level of the tree
becomes ready for applying one of graph theory algorithms on at a time. It traverses the tree by layer through creating a list of
it as described in the next step. nodes/cells to traverse and adding the children of each node in
the list at the end of the generated list. This cell expanding
C. Finding Shortest Path Using Graph Theory Algorithms continues until finding the goal or the end cell. By this way,
For solving the maze and finding the shortest path between the breadth-first search can find the shortest path to the goal
the starting and end points, three types of graph theory cell and the time required to find this path is proportional to
algorithms are implemented and their results are compared in the number of cells generated as each cell can be generated in
order to select the best one. Breadth First Search, Best First constant time.
Search and A* algorithms are implemented and tested on A* is a search algorithm that can be used in path-finding.
different simple and complex mazes and their results compared A* searches among all possible maze paths from start point to
based on the required solving time and the resulted path length end point in order to find the path that needs the smallest cost
from each method. The goal of this comparison is to select the according to the Equation (1) [14]:
best algorithm that can provide the shortest path with the least f(n) = g(n) + h(n) (1)
where n is the last node on the path, h(n) is the distances to
each node from the goal node and g(n) is the path cost from
start node to n. A* starts from a specific node of a graph and
constructs a tree of paths starting from that node. It keeps
expanding paths one step at a time by taking the node with
least value of evaluation function f(n), until one of its paths
ends at the predetermined goal node (Fig. 5).
Best First Search algorithm can also be used for path
Fig. 2. Original colored image of maze finding. To find the best path to the target destination node, at
each node of the graph it evaluates which node to be expanded
50
Fig. 6. Best first search algorithm sequence. a. Maze 1 b. Solution of Breadth First Search
(Path: 31 steps, time: 3.2ms)
next based on the lowest cost using evaluation function which
measures the distance from the node in concern to the goal as
shown in Fig. 6 [14].
The graph theory algorithms are applied on the binary image
of maze to find the shortest solution path between starting
point and end point. The flowchart of the developed Visual
C++ code is shown in Fig. 7.
D. Converting the Shortest Path from Image Coordinates to c. Solution of Best First Search d. Solution of A* Search
(Path: 33 steps, time: 1.1ms) (Path: 33 steps, time: 2.8ms)
Real World coordinates and Sending it to Robot
Fig. 8. Results of maze solving using AI search algorithms
The found shortest solution path is converted from pixel
coordinates (in pixels) to real world coordinates (in cm) by maze. In the experiments conducted for this study a Lego
applying a camera calibration processes using NI Vision Mindstorms NXT2 Robot was used.
Assistant Module which powered by LabVIEW [15]. The AI graph theory algorithms (Breadth First Search, Best First
constructed path is translated to a guiding path to be sent to Search, A* search) are tested on different mazes as shown in
robot through Bluetooth. The guiding path consists of group of Figs. 8 and 9. The solution path length and solving time are
sequence instructions as translation distance in cm and computed from start point to the end point of each maze to
movement directions (turn right, turn left, move forward, and determine which algorithm is the most efficient in finding the
move reverse). Finally, these guiding path instructions are shortest path. Fig. 8 illustrates results of testing the three
exported to text file and sent to the robot wirelessly via algorithms on a maze. The blue cell and red cell represents the
Bluetooth to guide it through the maze to reach its final target start point and end point; respectively. The green cells
destination. represent the resulted shortest solution path.
Based on Figs. 10 and 11, it is found that Breadth First
IV. RESULTS AND DISCUSSION Search gives always the shortest path in all tested mazes and
Several experiments have been conducted to evaluate the Best First search was the fastest. Finally, because the most
accuracy of the developed maze-solving robot system. A important factor in maze solving systems is finding the
single consumer-grade 15 megapixel Logitech C920 webcam
has been employed in this system and mounted above the
c. Maze 4 d. Maze 5
Fig 7. Program flowchart.
Fig. 9. Different shape of mazes solved using AI search algorithms
51
Fig. 10. Mazes solving time using AI search algorithms
Fig. 15. NXT2 Lego robot follows the received solution path
a. The captured maze before finding solution path a. The captured maze before finding solution path a. The captured maze before finding solution path
b. The maze after finding the solution path b. The maze after finding the solution path b. The maze after finding the solution path
Fig. 12. Simple maze with one solution Fig. 13. Maze with multiple solutions Fig. 14. Complex maze with multiple solutions
52
TABLE I. COMPARISON BETWEEN TRADITIONAL AND PROPOSED Technology Summit (Confluence), 2014 5th International Conference-,
METHODS 2014, pp. 323-328.
[4] A. Singh and G. S. Sekhon, "A New Shortest Path Finding Algorithm
Travelled
Time to reach goal For a Maze Solving Robot With Simulator," International Journal of
distance to Computer Science and Communication, vol. 2, (2), pp. 445-449, 2011.
Method (maze analysis+
reach goal
travelling) (second) [5] Y. Z. Cong and S. Ponnambalam, "Mobile robot path planning using ant
(cm)
Traditional method 387 50.2 colony optimization," in Advanced Intelligent Mechatronics, 2009. AIM
The proposed method 213 29.6 2009. IEEE/ASME International Conference on, 2009, pp. 851-856.
[6] S. Chia et al, "Ant colony system based mobile robot path planning,"
in Genetic and Evolutionary Computing (ICGEC), 2010 Fourth
found that the proposed intelligent approach based on Breadth International Conference on, 2010, pp. 210-213.
First Search algorithm is so far better than the traditional [7] B. Rahnama, A. Elçi and S. Metani, "An image processing approach to
method in term of the path length (travelled distance) and time solve labyrinth discovery robotics problem," in Computer Software and
consumed to reach the goal as illustrated in Table I. Applications Conference Workshops (COMPSACW), 2012 IEEE 36th
Annual, 2012, pp. 631-636.
From Table I, it is clear that the robot could reach its goal
[8] H. Dang, J. Song and Q. Guo, "An efficient algorithm for robot maze-
destination using the proposed approach in less time and solving," in Intelligent Human-Machine Systems and Cybernetics
travelled distance comparing to the traditional method. That is (IHMSC), 2010 2nd International Conference on, 2010, pp. 79-82.
because the traditional method pushes the mobile robot to [9] M. Sharma, "Algorithms for micro-mouse," in Future Computer and
move through the maze cell by cell until finding its destination Communication, 2009. ICFCC 2009. International Conference on, 2009,
point. The proposed approach provides the robot system the pp. 581-585.
opportunity for preplanning the travelling path and avoids its [10] M. O. Aqel et al, "Estimation of image scale variations in monocular
visual odometry systems," IEEJ Transactions on Electrical and
trapping and falling in infinity loops that may be happened Electronic Engineering, vol. 12, (2), pp. 228-243, 2017.
with the traditional technique. [11] M. O. Aqel et al, "Optimal Configuration of a Downward-Facing
Monocular Camera for Visual Odometry," Indian Journal of Science and
V. CONCLUSION Technology, vol. 8, (32), 2016.
[12] M. O. Aqel et al, "Adaptive-search template matching technique based
In this paper, a maze-solving robot system with an intelligent on vehicle acceleration for monocular visual odometry system," IEEJ
approach based on image processing and a graph theory Transactions on Electrical and Electronic Engineering, vol. 11, (6), pp.
algorithm was introduced. The efficiency of three algorithms 739-752, 2016.
in solving mazes, with a variant complexity, was compared. [13] J. Silvela and J. Portillo, "Breadth-first search and its application to
The results of maze solving using Breadth First Search, Best image processing problems," IEEE Trans. Image Process., vol.
10, (8), pp. 1194-1199, 2001.
First Search and A* algorithms were compared based on the
[14] R. Dechter and J. Pearl, "Generalized best-first search strategies and the
consumed solving time and length of the resulted solution optimality of A," Journal of the ACM (JACM), vol. 32, (3), pp. 505-536,
path. Although Best first search was the fastest one, the 1985.
Breadth First Search algorithm was the most accurate one in [15] T. Klinger, Image processing with LabVIEW and IMAQ Vision. Prentice
finding the shortest path for all tested mazes. Therefore, the Hall Professional, 2003.
final program that can solve real mazes was developed based
on Breadth First Search algorithm.
The developed system determines the best path for a car-like
robot from its start position to its final destination position
while navigating through a real maze. In order to find the
shortest path, the whole image of maze is captured by a camera
and then processed and analyzed by the developed program
based on Breadth First Search algorithm. The resulted shortest
path data is sent to the robot through Bluetooth as a guiding
path to reach its target destination. The results proved that the
proposed intelligent technique is fast and efficient in solving
any maze, whatever its complexity, and allows the mobile
robot to reach its destination accurately through the shortest
path.
REFERENCES
[1] H. Kern and J. Saward, Through the Labyrinth: Designs and Meanings
Over 5,000 Years. Prestel New York, 2000.
[2] A. M. Sadik et al, "A comprehensive and comparative study of maze-
solving techniques by implementing graph theory," in Artificial
Intelligence and Computational Intelligence (AICI), 2010 International
Conference on, 2010, pp. 52-56.
[3] B. Gupta and S. Sehgal, "Survey on techniques used in autonomous
maze solving robot," in Confluence the Next Generation Information
53