I’ve refined image approximations with rectangles and triangles. Let’s try with splitting regions into two with a straight line, and filling each part with the average color that they’re covering. This is the same basic idea as the rectangles, except that now the line can be at any angle, rather than just vertical or horizontal. […]

# Category: etcetera

## Image Triangulation: Voronoi Method

Voronoi diagrams are great, so let’s use them to stylize images. First, let’s just throw a bunch of points on an image, and compute the Voronoi diagram. Then for each cell, we fill it with the average or median color within: Hmm. That’s not great. It doesn’t pay attention to the edges at all, and […]

## Image Triangulation

Previously, I split an image into a bunch of rectangles. What about using triangles? This requires more thought, as it’s a little trickier to divide up the plane using triangles. The natural solution is to keep track of a set of vertices, then use a Delaunay triangulation to split up the image. First, let’s do […]

## Image Quadrangulation

I want to represent an image with a bunch of rectangles. Let’s say that each shape has constant color, as a start. First, fill a rectangle with the average color that it covers. That’s the initial approximation. Wherever the error in a rectangle (between the original image and the approximation) is too big, subdivide that […]

## Pulled String Art

Check out this art style! They dip a string in ink, lay it on a page, fold the page over, and pull the string out of the bottom. It leaves nice floral patterns with the ink, and is pleasantly complex and organic. I wanted to mimic this style algorithmically, so the first thing that I […]

Tic Tac Toe (TTT) is a minimally complicated game, so it is relatively easy to find all possible moves and see which will lead you to a victory, tie, or loss. I’ve never solved TTT before, so I threw together some code to do that! Solving Tic Tac Toe Without removing boards that are effectively […]

## Messing with Image Classification

There’s so much buzz about image recognition these days, I felt like I wanted to join in. Long ago, I saw an excellent project by Tom White in which he used image classification to generate abstract drawings reminiscent of an object. Basically, he made a feedback loop between an image generator and the image classifier, […]

## FFT-based Line Smoothing

With a jagged or noisy signal, Fourier filtering can be pretty useful for cleaning up the unwanted noise. Line drawings can be considered signals just as easily as time-varying signals, so let’s get ready for some Fourier transforms! The basic idea of smoothing (with length scale L) a polyline with a Fourier transform: Re-sample along […]

The standard Chaikin smoothing is a corner-cutting algorithm, which leads to nice results, but it no longer passes through the vertices of the original path. In cases where we trust the vertices more than the segments, what are we to do? Well, invent a new method, of course. Ideally, I want to give this method […]

## Image Orientation

I want to get a sense of the local angle of features in an image. This is a tall order at times, and isn’t even clearly defined. Do you want to follow the local gradient of the image? Be parallel to lines? We’ll try various methods and see what works. I’ll show a comparison of […]