The Advent of… the Sprinkle

June 3rd, 2010 by Stephanie Leave a reply »

Sara and I have returned for the summer session of Serious Programming Awesomeness, and we’re diving right into the world of 2d-to-3d transformations.  We’ve used Python and Blender together to take greyscale images and turn them into 3d constructs- this is going a long way toward bridging the gap between diagrams and tangible Cupcake-printed output.

We have a long way to go toward a streamlined, elegant program, but the important thing is that we’re making great progress toward our first completely home-grown print job.  (Which means the beginning of scanned diagram prints, and that means using our doe-eyed little Cupcake printer to take over the world.  Aww, look at its cute opto-endstop wires spewing all over with happiness.)

Anyway, this is where the Sprinkle comes in.  Pixels are too small for a printer like the Cupcake to use- I mean, it’s possible, but it’d be sort of like using a fat marker to trace a line  and then an even thinner line, and expecting anyone to tell the difference.  At this point it’s much more efficient to work with the Cupcake instead of encouraging it to explode in gear-jittering frustration.

The Sprinkle is a construct that we came up with to simplify the breaking-up of pictures.  It’s like a pixel, but bigger.  In Python, we analyze a picture to determine which lines warrant printing, based on how much of a Sprinkle is “covered”.  It’s sort of like laying a transparent sheet of graph paper over a diagram and then checking which boxes are darkened past a certain threshold.  If a Sprinkle is chosen to become part of something so much bigger and more noble than itself, then its coordinates are stored and its contents subsequently blackened entirely, and mapped onto a second image.  The result is a somewhat blocky version that is a) simplified, and b) useful for the next step- adding a third dimension.

Both the Sprinkle size and the threshhold percentage (what decides whether or not a Sprinkle is going to be used) can be changed, giving us a little refinement in Sprinklation.  Here are some pictures.  I did not draw that stick figure and take no responsibility for its  face.

Original

Sprinkle size, 7 pixels. Threshold 70%

Reduced threshold to 30%

Increased Sprinkle size to 20 pixels.

Advertisement

Leave a Reply

Powered by WP Hashcash