Functional Images [Was: [plt-scheme] newbie - plotting points]

From: andrew cooke (andrew at acooke.org)
Date: Fri Jan 20 06:17:30 EST 2006

[Sorry Noel; sent first reply to you alone]

If you're interested in a more functional paradigm for images you might
look at Pan - http://conal.net/pan/

The idea is to represent images as functions.

Pan uses C code in places for speed - it's implemented as a language
embedded in Hakell that's somehow compiled via C (I can't remember the
details any more but there are papers at http://conal.net/pan/papers.htm)

I wrote a pure Haskell version because I wasn't that concerned about speed
and was frustrated with the limitations of the embeddded language.  It's
called Pancito and is available here -
http://www.acooke.org/jara/pancito/index.html  Someone once put some
effort into speeding it up (using unboxed types, mutable arrays), but they
never gave me the code, unfortunately.

You can get an idea of the code from the literate source, which is also
the manual - http://www.acooke.org/jara/pancito/Pancito2.pdf

Some images of mine are here (not all use Pancito) -
http://www.acooke.org/pancito/intnleng/index.html

The style of image you get with this approach is very different to DBN. 
DBN places much more emphasis on lines / boxes (things with hard edges);
with functional images it's very difficult to get a line, much easier to
vary things smoothly across the surface of the image.

For example this image - http://www.acooke.org/pancito/intnleng/paper.html
- is defined using a function that shades a surface either side of a "fold
line"; the function is also a function of position/angle (of the fold). 
So the final image is defined by currying that function with random fold
points and then composing those curried functions to get a final transform
for the whole surface.  Computing that image at 6000x6000 took several
days on a 2MHz desktop a few years ago.

The lines in an image like this -
http://www.acooke.org/pancito/intnleng/migraine.html - come from the
underlying plane that is transformed.  So that image is the result of
applying many functions to a plane that originally contained a single
(hard-edged) circle.

Since I'm already in an orgy of self links, here are the details of what I
ended up doing in scheme thanks to the help from people here (not pretty!
- just exploring numeric values)
http://www.acooke.org/cgi/photo.py?start=fib-fractal
http://www.acooke.org/cgi/photo.py?start=fib-curves

Andrew


Noel Welsh wrote:
> --- Danny Yoo <dyoo at hkn.eecs.berkeley.edu> wrote:
>
>> Tangent question: has anyone looked at Design by Numbers?
>>
>>    http://dbn.media.mit.edu/
>>
>> I'm was curious what other PLT Scheme folks think about
>> it.
>
> Skimmed it in the bookstore, thought it was *very*
> imperative.  Seemed to concentrate on visualising the
> contents of a 2D memory -- which seems quite unrelated to
> what to me is the true nature of programming.  Was quite
> disappointed as John Maeda's other work has impressed me.
>
> But that's like 2 minutes flipping through the book.
> Should I look again?
>
> N.
>
> Email: noelwelsh <at> yahoo <dot> com   noel <at> untyped <dot> com AIM:
noelhwelsh
> Blogs: http://monospaced.blogspot.com/  http://www.untyped.com/untyping/
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
>






Posted on the users mailing list.