AI Free Code

Piano Tiles Bot using OpenCV – Simple & Fun Project

We hope you and your family are keeping safe. In this tutorial, we are developing a short and fun project Piano Tiles Bot using OpenCV. The question may arise in our mind, “What type of game is piano tiles”, so, the piano tiles game is simply we should tap the black tiles very fast without losing any of them or hitting a white tile.

The concept used here is, we first by selecting a region to track for black tiles. Then within that region, if the pixel value of any column goes below the threshold (let’s say 100, then it is black). Then we simply simulate a mouse click over that region. The game consists of 4 vertical lanes so the bot checks only one column per lane and if it finds a pixel with black color it clicks the mouse at its position and then starts to search for the new tile to hit.

Additional Project: Do checkout our previous projects on “A computer vision based vehicle detection and counting system


  • 1. OpenCV
  • >>> pip install opencv-contrib-python
  • 2. Imutils
  • >>> pip install imutils
  • 3. Keyboard
  • >>> pip install keyboard
  • 4. Numpy
  • >>> pip install numpy
  • 5. Pyautogui
  • >>> pip install Pyautogui
  • 6. Pytesseract
  • >>> pip install pytesseract
  • 7. Win32api
  • >>> pip install win32api
  • 8. Win32con
  • >>> pip install win32con



Note: The required resources are available in the GitLab section below. You can easily download and run it, too.

☺ Thanks for your time ☺

What do you think of this “Piano Tiles Bot using OpenCV“? Let us know by leaving a comment below. (Appreciation, Suggestions, and Questions are highly appreciated).

Leave a Reply

Your email address will not be published. Required fields are marked *