Automatic lane detection and navigation using pattern matching mode