I had a possibly interesting conversation over email. I'm posting it here in case it interests someone:
Hello!
I know your site Apophenia now for a long time. I was wondering about the bluring algorithm.
Would it be possible to send me the source code of the algorithm? I'd like to find out if there is a way to "undo" it in a way (even if some parts are deterministically random).
If you know that there is a way then of course I understand, that you wont send it to me
But I though I'd ask anyway. It's a riddle on its own for me (to try to improve the image quality) ^^
Thanks and best wishes!
Hello there Peter.
I'd like to think it through before I send you the source so please give me some time for that. ;-)
But here is a pretty accurate description of what happens:
0. I am using mt_rand seeded with a secure hash of the contents of the picture.
1. The image is overlayed with an offset copy of itself. The offset of the overlay is both in the X and Y axis and the opacity of this overlay is fixed at some A%. These offsets are linearly reduced in as time passes till it reaches 0.
2. After being merged with this overlay into a single image, I randomly grab ALL pixels in the image and replace each one with a triangle. The color of the triangle is the same as the pixel. The triangle is defined by three points, one of them is the source pixel (the one that is getting replaced by the triangle, the other two are spread in a square around the source pixel, randomly. As time passes those two points are linearly moved towards the starting point.
3. After doing this for ALL pixels (that's 400x400 pixels), I do the same thing for a random subset of pixels but this time the triangles are B% transparent. This causes a glassy effect instead of a confetti effect. The bigger the subset, the more glassy it looks. If you ignore this step the final picture looks like confetti.
Things that are likely to change in this algorithm:
a. I am thinking about removing step 2.
b. I am thinking about making all three points of each triangle being randomized, not just two while holding one of them exactly on the source pixel. Probably using randomized polar coords.
I doubt there is way that would make the picture cleaner than squeezing your eyes since too much information is lost in step 3. If I served the files as png you could in theory find triangle edges (clean lines) and guess which of the three corners is the source corner and then recreate some source pixels in their proper positions. Then you could create a Voronoi diagram out of those points and paint it using the source color. I am not sure if this would actually help you recognize the picture but it would certainly provide a different visual representation ofr the picture. The bad news is that there are hundreds of visible triangles so guessing which corner is the correct one for those triangles would be very hard. And since there are JPG compression artifact in the resulting picture, detecting triangle edges based on their color would work for LOTS of overlapping triangles.
Oh also this picture is still open:
(no it's not open. I'll post a new one asap)