1 | initial version |
You can check the wiki page of Maze solving algorithms for possible solutions.
An interesting approach finds connected components of walls (second image on the right). Cris on his nice page describes how to use connected components to find the way through the maze (among other methods).
In your case first of all you should remove the lighter shade from the lower triangle by darkening all the pixels there in the value channel of the HSV color space (cvtColor and add). Next step is to remove color differences of wall and open path areas for example with a median filter or with a threshold. Then you can flood fill the image to get an image similar to this (I have done the modifications in gimp but after playing with the constant it can be done in OpenCV as well):
Then - according to Cris - you can select the wall color next to the arrow and use only this color. When you dilate this binary image with a few pixels and erode it back the difference of the dilated and the eroded image gives the path through the maze.