Quilting Around the Birds
Sorry if you're a chemistry fan, I'm afraid this is another quilting post... I promise to go back to elements and molecules and reactions soon. In the mean time, I tried another experiment over the holiday weekend: Using image processing and Mathematica to create a quilting pattern that outlines the figures on a piece of printed fabric.
I clamped the fabric (with extra-thick batting under it) to the quilting frame, and then photographed it from directly above (see photo). Using some index marks I placed at the four corners of the fabric, I used PhotoShop to straighten up and clip the image so I had an image that exactly corresponded to an identifiable space within the frame. (In other words, I could determine the exact coordinates to send the machine to so it would reach each of the four corners of the image.)
Then I used PhotoShop to select and blank out the background, leaving just silhouettes of the birds, which I expanded using Mathematica's Erosion and Dilation functions, resulting in outlines a bit larger than the actual birds. Nina kindly used Flash (which has good auto-tracing features) to convert the silhouettes into polygons, and fixed up some missing bits. (Yes, I probably could have done all of this in Mathematica, except that the automatic MorphologicalComponents function couldn't actually get the objects right, and there's no automatic outline tracing that works well enough.)
Next it was back to Mathematica, where I added a set of parallel lines and masked them out where the birds were (using the excellent new Region features in V10). Finally I used the ever-useful FindPostmanTour function to generate a single-line path through the entire pattern. (Which took maybe 10 minutes: It's a big pattern, but nowhere near as complicated as our currency designs.)
And here's the result: semi-3D birds popping off a lined background:
The big question I was trying to answer is whether it's practical to quilt around pre-printed designs on fabric. This would be a very cool thing to be able to do in an automated way. The problem is that it's difficult to get the fabric into an exactly known location in the quilting frame, and it might be distorted in different ways each time, making it difficult to use a fixed pattern multiple times. By taking a photograph of the fabric after it's already stretched into the frame, all these problems are eliminated.
But, it's a kind of a pain to do so much processing for a single piece: It all has to be repeated for the next piece of fabric, even if it's exactly the same pattern. The experiment worked (and if I'd been less sloppy with my PhotoShop scaling, it could have come out quite a bit more perfectly aligned). But in retrospect, I think a better system would be to make fabric with printed reference marks that allow it to be positioned very consistently in the hoop. I already know that's possible from my previous project, where I was able to put a piece of fabric back into the hoop and have it align nearly perfectly with how it was previously mounted. (See previous blog post.)