Toyota Motor has announced it is quitting Formula One, joining an exodus of Japanese automakers from the sport.