Zach Archer Blog This blog is GO!

18Feb/106

Reconstructing Images With Text

I was inspired by Roger Alsing's supposed "genetic" image compression. It begs for further experimentation!

Here's my second batch of image reconstruction using Times New Roman characters. The algorithm is a brute-force affair: New characters are colored & positioned randomly. Any characters that make the canvas look more like the original image are saved. And that's about it. Oh, and the font sizes start large (5120pt) and end small (10pt), so that fine details have a chance of survival.

monarch_1 monarch_2 monarch_3 monarch_4 monarch_5 monarch_6 monarch_7 monarch_original

mona_original mona_reconstruction
Time lapse of the Mona Lisa reconstruction on YouTube, with silly music.

moth_0 moth_1 moth_2 moth_3 moth_4 moth_5 moth_6 moth_7 moth_original

My first batch uses a different algorithm. Each canvas allocates a certain quantity of letters, and progressively mutates them, trying to mimic the original image as closely as possible. This technique is more akin to image compression. This batch is still in progress, it's very slow. I'll post these when they're ready!

12Dec/090

Strange Attractors in Flash

Have you seen (or played) the demo for Polynomial, the space shooter? Quick! Watch the video:

I spent a couple hours generating strange attractors in Flash, just a simple 2D version for now. Click to play:

Here Be Strange Attractors

Click the black region to generate new polynomial coefficients and redraw. You will have to click many times to generate something interesting. That's the nature of fractals, I'm afraid. Some coefficients are automatically thrown out if the drawing exceeds a certain size. Unfortunately, the inverse is not true: the code isn't smart enough to trash any drawings that shrink to microscopic size.

I believe that you can stabilize any coefficients by scaling the values of each coefficient, gradually nudging them larger/smaller until the drawing is stable. I'll try this when I get more time. I've been gung-ho on my first proper iPhone app, trying to finish it before Christmas! Stay tuned...

Also, here's the source code for the strange attractor harness! Enjoy.

15Mar/094

8-bit NTSC artifacts using Pixel Bender

By request, here's a quick 'n dirty test harness, and sample code, for NTSC artifacts in the style of the 8-bit Nintendo Entertainment System (NES):

Click the animation to change scale & scroll speed.

Source code & .fla: nes_ntsc.zip

The .pbk code is not optimized yet. The code is fairly explicit, I tried to explain how it works in the comments. Blargg's pages have better explanations tho.

The test harness lets you select two flavors of the effect. The numbers 8 and 12 denote the width of the lowpass window used for applying crosstalk. 12 is more processor-intensive, but will look "smoother", which may not be what you want. The mathematics can be reduced to a few (long) lines, which should reduce processor overhead; I want to do this in the future. unic0rn left some nice comments suggesting more routes to optimization.

The filter still needs some tuning. Areas of solid (non-black) color have diagonal stripes in them. I believe that normalizing the strengths of the filters will fix this.

To be continued...

Filed under: Flash, Games, Graphics 4 Comments
29Dec/084

Fractal Transform, made with Pixel Bender

I made a Pixel Bender filter that performs Julia Set transformations on images. It looks great when it animates, the colors morph and twist like mathematical slime. Try it (Flash Player 10 required): JuliaTile.swf

Source code: julia_tile_src.zip. Pixel Bender code is in src/shader/.

The default image is Seattle's Space Needle. You can upload custom images. Very large images may set your processor on fire.