Introduction: Scan Fabrics at Super High Resolution With LadyBug, a Motorized Microscope
I'm not what you would call "good at crafts". I can't sew a button and I couldn't tell you whether a stitch was cross-hatched or crocheted or bayoneted. All my shirts have holes in them. But for all that, I do know something about stitching images (ha!) in the form of a scanner I made for school. And I thought it did a really neat job on fabrics, which is why I'm sharing here --- and I'm hoping one of you experts will pipe in on whether or not this is actually useful for anything!
This guide is really super not technical, but if you actually are interested in doing this project and you need more info, I break down all the fundamental electronics down in my other Instructables, LadyBug, a scanner made out of Blu-Ray players, and you can learn more about the general frustrations involved with scanning at my Hackaday Blog on the sequel, LadyBug Beefy. I've also been planning a kickstarter for 2 years, so sign up on my website if you want to be around for when that happens.
Step 1: Step One: Get a USB Microscope
The first thing you'll need is a USB microscope. At first I'd suggest just getting the cheapest one you can find, they're like 12 bucks on amazon, and most of the claims on magnification and resolution and such are bogus. They're just webcams with more powerful lenses and a dial, and while they're known for having all sorts of problems, like limited field of view and being hard to hold still and warping at the edges, they honestly can do a lot for how cheap they are! You might even find they it's good enough for your application and stop right here.
A couple example individual fabric images are up above. They are just 640x480 pixels, but we're going to improve that pretty soon, by combining up to thousands of pictures together.
Step 2: Get a 3D Printer or Some DVD/blu-ray Players
The basic trick to scanning fabric is to take our USB microscope, plonk it in a machine that can move where we want it to, and then take lots and lots of pictures from different vantage points and stick them together. How you do that is up to you, but I've done it in two ways:
1: DVD/Blu-Ray players. This was my first instructables and it actually went a little further, to 3D scan little things with a rotary motor (don't go if you're squeamish around bugs). I think it's a great little device, tiny/cheap/cute, but it's also more work than the next option.
2: Use a 3D printer. It already is meant for accurately positioning something, only it's the print head instead of a camera. Literally, in some printers you can just plop in the camera!
You might also be able to repurpose/hijack a laser cutter, CNC machine, or similar --- I think it would be really cool to stick on a scope and scan the thing you're making.
Step 3: Plop in the Camera
With great force and vigor, squish the USB microscope into the extruder hole of the 3D printer. Try not to make eye contact.
At this point if you can control your 3D printer you can just fly around the object and take pictures manually.
Step 4: Add a Bunch of Electronics If Necessary
So I'm using a busted 3D printer. That means I had to make a new control board for the motors and software to control it and stuff. But this would work equally well (better actually) with a 3D printer that was already working, and you could send it commands it already understood like gcode. I'm working on that, check back in 6 years.
The basic ingredients above are stepper motor drivers, a raspberry Pi, power supply (from an old laptop), a breadboard and oodles of wires.
Step 5: Use the Software to Take Lots of Pictures of Fabric!
I used binder clips to afix the fabric onto the plate and keep it steady and flat, focus the camera at my magnification, and tell the software where to scan. You can find the program for a raspberry pi controlled system on my Github page (BeefyGui.py).
For some really high detailed scans, like at the magnification in the first image above, it can be tens of thousands of images for a few square inches. Or it can be just a couple dozen --- depends on what your demands are!
Step 6: Stitch Your Pictures and You're Done!
Presumably you want to see all the images as one piece. The easiest way to do that is with Microsoft ICE (image composite editor). It is really just as simple as drag and drop your images into the program, and let it figure it out. Note that for really large scans, you can expect problems with color distortion, especially for monochrome images! This is a bug with ICE, not the scanner. If you want to spend more time to get just the right results, you can try the open source Hugin.
I have some example stitched images above --- a fuzzy blanket, some burlap, those stretchy gold sequin things, a caterpillar pattern. A couple of them are cut out and already zoomed in, and the others are the full images, which I'm not sure whether instructables will display properly or not. They can get pretty massive --- if I scanned the whole caterpillar fabric at the highest resolution, it could be as big as a gigapixel!
I hope you enjoyed this (very quick) overview of one of my projects. If you liked it, or want to learn more, please feel free to sign up for email updates, check out the main Hackaday Page, or if you're reading this in April, stop by the Kickstarter.
Participated in the
Fiber Arts Contest