Sep 28 2007

Peduncle

Published by at 9:28 pm under Code

Drip CrabI started working on an image processing system/language the other week, called Peduncle. I started it partly to get back into programming more, and also because I am very interested in the intersection of time and brushes. This comes from the work I used to do at Xaos Tools many years ago. My boss, Michael Tolson, was a major influence on my thinking.

A peduncle is a stem which has flowers off of it. This applies to many of the image processing concepts I have, such as tapping into a data stream, using a flow of operators to generate a final image, etc. The image on the right actually has only one operator applied to it, a drip operator.

The big “breakthrough” that I had is that images can be handled in the same fashion as the C++ STL. I have data structures, iterators, and operators. The data structures are usually images. The iterators are ways to move through the data structures. And the operators work on the data structures through the iterators. This is exactly how the STL works with its orthogonal approach to data. In Peduncle, I can do things like:

const ClDataByte3 *pSrcData = <...something...>
ClDataByte3 *pDstData = <...something...>
ClIteratorConstByte3 srcIter(pSrcData);
ClIteratorByte3 dstIter(pDstData);
do
{
   *dstIter = *srcIter;
    dstIter++;
} while (srcIter++);

This is just a copy operator, but the “meat” of it could be:

// add a constant color to the source
*dstIter = *srcIter + *constColor;

or

// invert the source color
*dstIter = ClByte3(255, 255, 255) - *srcIter;

Again, trivial operations, but it starts to show the power of it. As one adds more operations, much like the STL, then it becomes easy to add new operators.

Crab BrushMy next step is to add time and looping to the system. Right now, it only deals with still images, but it should be fairly straightforward to add movie reading and writing. When I added loops to the main processing section, everything worked basically as expected. Once time and looping work correctly, then I will add a scripting language on top of it. main() is where I am doing my scripting right now, so it is just C++ code. That is fine while I am testing out concepts, but not sustainable in the long run.

I am fascinated by brushes on images, especially when they evolve over time. Michael Spaw, a good friend of mine, is probably the reason I am continuing to look into all of this. He constantly reminds me of the amazing images which can be created with brushes. Michael Tolson reminds me how brushes can evolve.

No responses yet

Trackback URI | Comments RSS

Leave a Reply

You must be logged in to post a comment.