ImageKit is a personal project of mine, which I use for rapidly developing image processing filters and computer vision algorithms. The library is written in C, with CPython bindings, making it easy to prototype a filter/algorithm in Python to be later ported it to C.

The primary motivation for this project comes from the lack of libraries that focus on fast prototyping. While OpenCV may be great for doing production quality computer vision projects, its API is very complex, and even different between languages. This makes developing new algorithms slow and tedious, and porting them to a faster language difficult.

Color Palette Extractor - I developed my own algorithm for extracting human-useful color information, which runs in slightly worse than O(N) time. My algorithm returns an array of color samples, along with how frequently they appear. Unlike other algorithms (typically based on k-means clustering), my algorithm takes into account colors that don't appear frequently, but have very high meaning to humans, such as highlights and font colors.

Tetris Playfield to Graph - This is the basis for a larger and more ambitious project of mine. In its current state, it can detect playfields in Tetris, and convert them to graphs. Eventually, I would like to turn this into a machine-learning project, which plays the NES version of Tetris on an actual NES console, with the aid of a camera and a Teensy dev board for sending input events.

Outside the competitive Tetris community, it may be difficult to understand why games like NES Tetris are difficult, when compared to games like Tetris The Grand Master. Below are two videos illustrating excellant performances by top players in the world in each respective game.

Tetris The Grand Master 2: GM by Kashiwa0903

NES Tetris: Maxout by Kitaru

To the layman, it may seem like the first video is much more difficult than the second. In reality, they are both incredibly difficult, but for entirely different reasons.

The “Tetris The Grand Master” series was created to be played very fast. NES Tetris was not. When you play Tetris The Grand Master, it’s easy to move any piece where you want it in very little time, because the game lets you charge up the directionals before the piece spawns on to the play field. And because the lock delay timings are also different, you can easily scrape pieces along the top of the stack to get them where you want them. You cannot do either of these things in NES Tetris. These two things combined with the rotation system, allow you to easily fix any mistakes you might make, and/or play through them.

In NES Tetris, the speed in which you can move pieces is limited by the game to a maximum of 3 Hz. What this means, is at level 19, having your stack above a certain height will result in an insta-death. And did I mention it’s incredibly difficult to keep the directionals charged in NES Tetris? When you see videos where it looks like it takes a really long time for the piece to start moving, this is because the player lost their DAS charge and has to hold one of the directionals to charge it back up before the piece starts moving. One slip of the thumbs is all it takes to ruin a great run at or above level 19. Getting a maxout score is incredibly difficult, because of this, as well as the number of tetrises required.

It’s also worth mentioning that the randomizer in NES Tetris is much less uniform than in Tetris The Grand Master, which often leads to piece “droughts” (when a piece doesn’t appear for a really long time) and “floods” (when you get the same piece a bunch of times in a row).

You could say the difficulty in Tetris The Grand Master lies in speed, and your ability to fix mistakes, whereas the difficulty in NES Tetris lies in playing around the rigidness of the game, avoiding any mistakes at all costs, and making a very high percentage of tetrises.