Introduction: LadyBug: a Motorized Microscope and 3D Scanner for Very Small Things, Made Almost Entirely Out of Blu-Ray Players
We're going to build a 4-axis, motorized microscope, that can 3D scan very small things.
If you think this concept is neat, and decide you would like to be a part of it somehow --- please! Leave a comment, or stop by our website. Really, I would be thrilled if a single other person out there decided to go through and make this.
Step 1: Hooray, We Won!!!
Exactly as planned, the TinkerCAD judge's prize is ours! Huzzah! Thanks so much to everyone who made this possible. And a real hat off to Instructables and autodesk, who included not one, but five t-shirts!
Step 2: Insects and Facts
LadyBug is a picture-based 3D scanner, meaning that it's primary function is to take photographs of an object from all sides, which can then be turned into a 3D model. What's special about it is what it takes the pictures with, how it takes the pictures, and what it's made of. First, it uses a high-powered USB microscope, which is both cheap and effective --- as long as you're just looking at a tiny part of the object!
LadyBug solves this by using motors to do 3D scanning on top of 2D scanning! The images you see above were actually stitched together from many sub-images. You'll see a lot more bugs throughout the guide; they make great subjects for the scanner because they are the right size, are easily found for free and dead, and of course have lots of really interesting colors and geometry.
The actual structure of the scanner is made entirely out of Blu-Ray players and 3D printed parts, all of which were designed in TinkerCAD. As you will learn, the author is a huge fan of both of these things.
(PS, if you're on Reddit, considering adding to our little community!)
Step 3: Why the Heck Would We Want to Do This?
Well, it's cool! But actually, it started with a project to do time lapses of cultured cells. I wanted a cheap way to do it --- normally, you take your cells out of the incubator, and then buy a special and super expensive incubator attachment for your microscope. But why not just make the whole microscope small enough to fit inside the incubator?
I combined that goal with my newfound passion for Blu-Ray players (which persists more than two years later). They were perfect. Tiny, sophisticated, and literally being thrown away! Oh, Blu-Ray players, how I love you.
An offshoot of that project became LadyBug --- a 4-axis, motorized microscope, which can 3D scan small things. Take a look!
Step 4: Things You'll Need
- 2x optical disk drives, ideally the "fat" Playstation 3 Blu-Ray drive, the KES-400a. Note that I am not just using this drive because I had it lying around; I've explored a number of assemblies, and this one is especially capable and hackable. If you are interested in learning more about this extraordinary machine, visit my friend Sam's website, where he breaks it down in detail. Also, thanks to him for sending me 34 of them!
- A camera, with some kind of magnification. In this guide I am using the most generic USB microscope that exists; if it looks like the picture above, it'll probably work. Just buy the cheapest one and don't get swept up in bogus claims of magnification.
- An Arduino or Raspberry Pi and any necessary peripherals. This guide is based on the Raspberry Pi version, but we're working on Arduino, too.
- Between 2-4 Stepper motor drivers: We have tried A4988s and DRV8825s, but they squeal, and provide too much current at minimum for some of the smaller motors. The best we've found so far is the EasyDriver (if only they weren't so big!). You might also get away with driving the smallest motors directly.
- Access to a 3D printer: The parts are entirely constructed and optimized for 3D printing using TinkerCAD. This makes most things particularly easy to adjust, even if you're a kid or have never 3D modeled anything before. Seriously, if you've never tried it before, give it a go! Embedded TinkerCAD files are below and you can get the STL files on our website or Thingiverse.
- Electronics tools, like a breadboard, jumper cables, a couple of resistors, wires, and soldering iron/skills (or be prepared to learn). I like small, flexible, silicone cables, but I'm even more of a fan of using whatever you have lying around.
- A source of DC power for the stepper motors, like a benchtop power supply or just an old 9-12 volt or so wall adapter.
- If making the 3-axis version, a small rotary stepper motor and 0.5 mm sequin pins, and if making the 4-axis version, a M3x15 nut/bolt/washer.
- Misc supplies like screwdriver, small file set, glue gun, and zip ties are all helpful.
Optional: printed circuit board with all the components and connectors already on it. This is something we're still working on, but it should make the whole project much simpler, as well as enabling hacking of the other components inside the Blu-Ray player.
Step 5: Step 1: Ready Your Blu-Ray Players, We're Gonna Build a 2D Scanner
To build a 2D scanner, we're going to need to move at least two things back and forth. This is where our Blu-Ray players come in. Disk drives use a stepper motor to move an optical pickup while reading a disk (see the poorly labeled diagram in the previous step). We're going to exploit that fact by 3D printing a carriage that slides instead of the pickup. We'll have one Blu-Ray player carry a carriage with a camera, and have another move our sample. Then, we'll literally put these two assemblies on top of each other!
To prepare, remove the optical pickup unit by unscrewing the rod bracket holding one of the polished rods in place, and slide the rod out (again, see the poorly labeled diagram). The optical pickup unit should come free. Unscrew the white plastic "slide nut" from the pickup, and save the screw, nut, and pickup unit in a safe place --- try not to touch the lens in the front, and also be careful about storing it with any metal as it has magnets on it.
Step 6: Step 1 Continued: Start 3D Printing the Parts for 2D Motion Control
My first modeI used gluesticks to hold the Blu-Ray player frames relative to each other! I think the 3D printed versions are just a bit more functional. This instructable has embedded, interactive TinkerCAD files, so you can change the original models. If you want just the STLS, though, you can find them on TwoBlueTech.com or Thingiverse.
We need a few parts to get the scanner running, and the biggest is the frame. It holds two Blu-Ray drives perpendicular to each other, and besides the curved legs, it's as simple as could be! You'll mount the frames of the Blu-Ray players on top of the pillars, and then you can screw the whole thing onto a block of wood or something else heavy if you want.
Next, we have to print two "top" pieces, which provide motion control for our USB microscope. The first piece is a carriage piece, and like all of the carriage pieces, slides along the rods where the pickup used to go, incorporates holes for mounting the "slide nut", and has a little 'flag' to press a switch. This carriage piece also has two cylindrical grooves, which snaps together with piece #2's cylindrical protrusions.
Piece #2 then attaches to our USB microscope, making it easy to adjust the height! The whole assembly can be seen below:
And just for fun, here's the file showing part of the design process:
Lastly, you'll want to print any of a number of bottom pieces, which will carry your sample. I've posted a few examples below --- but don't fret if you don't see your particular application here --- just modify it to fit in TinkerCAD!
Step 7: Finish and Assemble Your 2D Scanner
In all likelihood, your 3D printer is not exactly the same as mine, and does not print perfectly round holes. If it does, congratulations! Otherwise, you will have to finish your parts.
We want our 3D printed carriages to slide with just the slightest amount of friction across the Blu-Ray's 3 mm rods. So after 3D printing, we'll use a drill bit or round file to get the holes to that perfect fit. I use a file to remove a bit of material from both sides and try to slide a rod through the holes --- a little loose is better than too tight, and anyway, the stitching software is actually pretty tolerant of small imperfections.
Next, you have to attach the white "slide nut" to the bottom of the assembly:
(Note that this thing is not meant to be 3D printed! If you can figure out how, though, it would make it a lot easier to use other disk drives.)
This part attaches to the underside of your bottom and top pieces and couples it to the main stepper motor. First, align the protrusions of the slide nut to the holes on your 3D printed part. It should fit in firmly, but don't force it too much! If the holes are too small, use a file to widen them (or change your slicer settings or the original 3D model). Then, tap the middle hole by screwing in the screw. If it's too small, widen that, too.
Now that the white thing is on, you can put it in the frame, in between the rods, so that the teeth of the slide nut mesh with the stepper motor. When you turn the motor by hand, the piece should slide back and forth; if it binds, remove some more material from your part, and if it's way too loose, you might have taken off too much.
Lastly, once both the "bottom piece" and "top piece" are attached to their Blu-Ray assemblies, you can go ahead and place them onto the larger main structure. They're meant to be screwed on with the original rubber thingies, but you can also just glue them on or even leave them loose for testing.
Step 8: Take Your Scanner Apart Again So That You Can Do the Electronics
For the 2D scanner configuration, there's only really a couple of "electronics" things we have to worry about, most important of which are the stepper motors. They enable motion that is countable and repeatable, so we can move a certain amount and then come back exactly where we started. If you'd like to learn more about their theory, check out Great Scott's video, but for our purposes, it's enough to know that if we have a magic driver board, we can send that driver board a signal, and the board will handle everything and make our motor move.
If we don't have the circuit board, we'll have to solder 4 wires to the back of our two motors. (If you're not very confident about soldering, watch this video.) If using my Blu-Ray drives, follow the above picture to see which coils of the motor are connected. Otherwise, you can check which coils are which by touching an LED to two of the solder points and spinning the motor; if they're connected, it'll light up. (You can also just use a multimeter.)
I recommend at least a foot of wire, and then soldering the ends onto pin headers for easy mounting into a breadboard. You can use zip ties and hot glue to keep the wires from flopping around and breaking off the motor.
The second electronics thing are the switches, though strictly speaking this is optional for now. The switches will act as endstops, allowing us to set a "zero" and help keep track of where we are. This means we can do stuff like restart after a power loss. The onboard switch is right next to the spinny disk motor. Just attach a wire to each solder point. One will go to ground, and the other to a pin on our Raspberry Pi --- when the switch is pressed, the Pi pin will get connected to ground.
Once you've got your wires soldered, we can setup everything as in the breadboard diagram above. The beeper is optional but used as an indicator. For the power supply, I use an old 9-12 volt wall adapter. The whole circuit is a a bit overkill --- only one ground really needs to be connected per easydriver, for instance. Note that this wire configuration is for my software on the Raspberry pi, but you can easily move them around to whatever is convenient.
Step 9: A Prelude Before Getting Into Software
Kudos for making it this far! You now get to sort through the cacophony that is... the project GitHub page!
This guide is focused on the Raspberry Pi. However, there is no reason that you cannot run the scanner through an Arduino, communicating with a computer. In fact, we are working on that! It would be great if you could help, it is based around Processing.
The Pi version is version one, though, and it works. Mostly. It is an unholy abomination of code that I don't fully understand, and about 600 lines is enabling keyboard control because Tkinter. And I can't figure out why the USB disconnects and YES I've tried using a different camera and yes I've tried using a different raspberry pi and a different library for taking pictures and a powered USB hub and even restarting the USB bus, but you can't do that on the Pi anymore, and then OMG, the solution that finally works is physically shutting down the raspberry pi and automatically restarting...
Look, all I can say is, it's the first time I did anything like this. You have been warned with what you will see, please don't judge me.
Step 10: Setting Up the Pi
The Raspberry Pi system has some shortcomings, like price and speed, but also its fair share of advantages, too. Mainly, it's totally self-enclosed --- the thing that moves the motors takes and saves the pictures, so you can do things like plop it in your cupboard and do a scan for 5 days straight. Also, everything is in Python, which makes it more accessible to non-programmers like me.
The operating system is just stock Raspbian installed through NOOBS. Technically, the scanner should be able to run headless, but I don't do that because my school blocks SSH connections (thanks a lot!). Converting it should be fairly straightforward (cutting out everything GUI-related). Don't worry if you don't know what this means; this and other more advanced features will be discussed later, for survivors only.
Once everything is running, and you can do things like access this Instructable, go ahead and execute the following Terminal commands:
sudo apt-get update; sudo apt-get install cheese tkinter rpi.gpio subprocess select pickle fswebcam; git clone <a href="https://github.com/yuji3w/ladybug" rel="nofollow"> <a href="https://github.com/yuji3w/ladybug" rel="nofollow"> https://github.com/yuji3w/ladybug>>></a>>
These should get you everything you need, but if you run the scanner and get an error saying something like
ImportError: TheMostObviousPackage could not be found
The usual fix is to go back to the Terminal and run
sudo apt-get install TheMostObviousPackage
The most important file is "4Steppergui.py". This single file, defying all style guides in existence, is about 1,200 lines and contains essentially everything that happens on the Pi. There is some very strange stuff going on, especially in the Tkinter-based graphic interface. If you read my code and think you can improve it, please, by all means, do that!
Despite the length of the file, the stepper motor control is, at it's core, quite simple. To actually move a stepper motor, all you do is turn the GPIO pin connected to the EasyDriver's STEP input on and off a certain number of times:
for i in range(numsteps): GPIO.output(XSTEP, GPIO.HIGH) time.sleep(delay) GPIO.output(XSTEP,GPIO.LOW)
Changing direction is even easier:
Where direction is just 0 or 1.
Finally, keeping track of where you are is as simpler as
if direction == XForward: GlobalX +=numsteps else: GlobalX -= numsteps
Not too terrible! So what's the rest of the code for? Well, things like homing procedures, diagnostic tests, setting scan parameters, running the scan, and of course a bloated user interface. If you want to learn more, I just spent about four hours reformatting the code and adding comments to hopefully make it clearer. But I won't go into much more detail here; I just wanted to show you that you shouldn't be afraid of basic stepper motor control. Go play around with it!
Okay, we can finally go ahead and run 4StepperGui with an editor like Thonny. The main window should pop up with a bunch of options you can play around with. The ultimate test for motion control at this point is to just hit "Home X" and "Home Y", and depending on how things are connected, a number of things can happen:
- X and Y move towards the switch, hit it, move forward a bit, and come back until they're touching the switch. Huzzah! Motion control success! You can move on!
- The X or Y moves, but away from the switch. Your motor is backward. Remove power, then flip the pin header containing the motor wires on the breadboard.
- The X or Y jitters but does not move. This can be a couple of things. Check that your breadboard wiring is correct, especially around the direction and step pins and grounds; you would not believe how often the problem is that different grounds are not connected. If that doesn't work, the plastic on your part might be too tight, or the power supply might be too weak, or the current turned too low (with the little potentiometer dial on the EasyDriver). It might also be that the motor wires aren't soldered correctly, or are on the breadboard wrong. Jittering is common when the connected pairs are switched around; they should be adjacent to each other at the input to the EasyDriver.
- The motor does not move at all. If you also can't move the motor by hand, it just means the right GPIO pin isn't connected to the EasyDriver step input. If the motor turns freely, it means the motor isn't energized at all, and the problem is with the EasyDriver, or how its connected.how it's connected.
Alright! We're still in the game, 加油！Now we can go ahead and try running our first scan.
Step 11: Optional Advanced Step: Enable Automatic Scan Resumption
I am tired because this guide has turned out way longer than I ever thought it would be, so I am just going to post the comment I wrote when I implemented this myself:
If a scan fails due to a USB disconnect now, the program will beep as before, waiting to see if the user will come and save the scan. After a few seconds, however, the raspberry pi will restart after saving the remaining scan to a pickle file. The raspberry pi is set to load the 4steppergui automatically upon reboot: How this is done is up to the user (it was a PITA to get to work in a not good way), but what is set up on the original device is to autorun a bash file that opens a terminal with the program running. Specifically, in /home/pi/.config/lxsession/LXDE-pi/autostart add @/home/pi/Desktop/bashfile.sh to the last line. The bashfile looks like: lxterminal --command="/bin/bash -c '/home/pi/Desktop/ladybug/4steppergui.py; /bin/bash'" and don't foret to make it and python file executable. For whatever reason, this is the only thing that worked!!! When the 4steppergui loads, it checks to see if there is a pickle file in the folder location. If not, do nothing. If so, home the axes and run gridscan with the saved parameters. Rinse and repeat... A ridiculous bandaid solution to a ridiculous problem.
Step 12: Your First Scan
Now that we have motors that move, we have a motorized microscope! Just pop the USB microscope onto the top carriage, and you can start moving it around and looking at stuff. Cool! Way better than trying to hold things still by hand! If you have a big screen, this can be a good classroom exercise by itself, just let the best-behaved kid have the controls.
Note that while you can view the camera itself on the Pi by running the program
in the terminal, you can get a faster preview image by plugging into a totally separate computer or phone.
Alright, moving on to automatic scanning:
The first thing you'll want to do is find something relatively flat. Like a coin, or circuit board, or a microscope slide, or something inside a mini petri dish, or some money or paper or some dust that you think might contain micrometeorites, or a moth... Whatever! Just remember that we can't automatically adjust the focus at this point, so flat is good.
Now, depending on your bottom piece/stage, affix your sample using a bit of double sided tape, or glue, or a clip or magnet or something. It really depends on what your stage and sample are; if you've made it this far, you're resourceful enough to figure that out.
Next, after making sure the X and Y positions are homed, we can set the scan parameters and run the scan. Mostly, this means defining the perimeter of the scan, or the minimum and maximum X and Y values; the scanner will then take pictures in a raster pattern within that rectangular shape. No part of the object you care about should stick out of this rectangle. Step by step, using the GUI:
- Move the camera to the bottom left corner of the rectangle --- the X and Y values on the screen should be their smallest. Write down the X and Y values at this location, and hit "set X min " and the "set Y min" buttons.
- Do the same for the top right corner, but with set X max and set Y max.
- Make sure that your camera is connected to the Pi.
- Hit the big "SCAN!!!" button!
- A file dialog will pop up, asking you where you want to save your pics, like on a flashdrive. Do so and click ok.
- If all goes well, it should start scanning! Moving from location to location and taking lots of pics. Woo!
- When the scan is done, you can take out your flashdrive and get ready to stitch.
Hooray! We got lots of pictures!
Step 13: What They Use to Stitch Their Images Will Shock You!
There are a number of ways to do image stitching. We've tried AutoStitch, Hugin, FIJI, and some implementations of OpenPano and OpenCV, to varying degrees of success. But by far, the best results have been obtained through Microsoft's Image Composite Editor (ICE).
And this is really easy and works well for 2D scans. After installing, you can probably figure it out on your own. Otherwise, have a video. The most important thing is hitting "Planar Stitching".
Ordered stitching, utilizing the fact that we actually have a scanner, is also possible, but unordered stitching works perfectly most of the time too.
We would love to be able to have a programmatic solution --- ICE's API leaves some things to be desired, as you'll see with 3D stitching! If that's something you know how to do, please, by all means, head on over to the Github page.
Step 14: Start Work on the Last Two Axes.
Alright! We have a functioning 2D scanner. But I said that this was a 4-axis motorized microscope, so we still have two more motors to go: A small, linear stepper motor that serves as a Z axis, and a small, rotary stepper motor that actually spins our sample around. In the full version, they work in unison; the Z axis carries the mini stepper motor. The full configuration looks like this:
Like before, we have a 3D-printed main carriage (red) that slides along coupled to our big stepper motor. To this mounts a mini linear stepper motor (black), and optionally a circuit board with connectors and cables (green). Then, with a bolt/nut/washer (not shown), a second 3D printed piece (blue) fits into the linear stepper motor. And then to that, a mini rotary stepper motor (white/orange) snaps/slides into place. Finally, an adapter piece (transparent) is placed on the motor, with a needle (white) for stabbing things.
So first things first, we'll need a mini linear Z motor. This one actually comes from inside the optical pickup of the KES-400a! It's used to move a focusing lens back and forth for reading multi-layer blu-ray disks. All Blu-Ray players have one, but the KES-400a is the only one that I've seen which is so hackable, in that you can actually take it out of the player and run it separately. It has mounting points, a ribbon cable, 1 micron precision at 8th stepping resolution, and incredibly, an embedded optical interrupt switch that allows you to home it, just like the bigger motors. I've been searching for small motors that have all of these features for over a year and have yet to find one commercially, so let me know if you have any leads.
Remove the sheet metal cover on the optical pickup unit and peer inside at the glory of mass production and humankind's domination over the forces of nature. Once you are finished, take out the motor by removing and saving its 3 mounting screws (notice the super tiny washers!). For the next part, you will need an X-acto knife and a willingness to risk cutting yourself...
There is probably a better way to do this, but you will actually cut out the lens by (carefully!) picking at the glue holding it in place. There are three spots, and after you are done the lens should pop out if you pry a bit. But be careful, because the motors are almost as fragile as your fingers. Then save the lens, you can clip it to your smartphone or use it to read tiny messages...
Next, we are going to have to connect to that motor and optical switch. If you have the PCB, just plug it into the board. Otherwise, you are going to have to solder onto those 8 points.
Hoo, boy. Did I destroy a lot of motors. Do not attempt this as your first soldering experience, unless you have dozens to spare. But it absolutely can be done, and now that I know how, the fatality rate is much lower.
I'm going to assume you're an expert (and I'm running out of time to submit this), but quickly: Prepare your work space. Use a good, shiny, fine-tipped iron, thin fluxy solder, and color-coded flexible silicone wire (I've also used magnet wire). Snip and tin your wires and 2x4 sets of pin headers and attach one side of wires. On the other end, trim the wire until just a bit of metal is exposed, and once the motor is gripped in the gentle embrace of a vise, you can solder, following the charts and schematics above.
Great! One way or another, the Z axis is wired into the system. It runs just like our X and Y axes, except it uses that optical endstop instead of a mechanical one, and it has a range of three whole milimeters. You can use it to carry stuff like a coverslip slide or other tiny stage, or (as I assume you want to) you can lift up a rotary motor.
Step 15: More on the Rotary Motor
First off, let me just say that you don't need to put the rotary motor on the Z axis. You can get a lot of the same functionality by having it fixed in place, or adjustable with a snap fit. Maybe something like this?
Where does the rotary motor come from? Not from a Blu-Ray player, unfortunately. I'm sure there's an assembly with a suitable one out there, but for this project I went ahead and bought some on Ebay (25 cents each). I tried a few motors, and ended up using ones with gears for ease of mounting. I used relatively large ones at first and then switched to the smaller ones (dime picture). The mounting methods are the same, though, with a snap fit around the barrel of the motor.
This is neat, but it's also kind of flawed, for one main reason: Motors get hot, and the 3D printed plastic will soften or melt! You can circumvent this problem somewhat by printing in resin or ABS, or just running the stepper motor at low power, either with some not-recommended hacks to the easydriver, or by energizing the coils directly on GPIO pins. I've had success with that in Arduino, and it comes with the added advantage of not needing yet another stepper motor driver.
The attachment piece that actually fits onto the gear is very small, so small that you will certainly have to make some adjustments with your printer. It is possible to print on an FDM printer, though. It needs to be relatively tight so that it doesn't wobble during the print.
The specimen mount I came up with is a 0.5 millimeter sequin pin, and if you have a resin printer you can print that in place. Otherwise, insert it pointy side first through the gear hole and out the round hole; this should also require some tinkering to get tight. For insects, you can gore them directly on this needle or use hot glue --- my best advice for this delicate task is to find someone with small fingers.
Step 16: Detailed Motor Control/3D Scanning
We have just a few steps left.
At this point, if everything is hooked up correctly, you can control the X, Y, Z, and rotational axes of your LadyBug.
While you can still use the GUI, you should probably know the syntax for controlling it by hand.
There's two main functions that handle everything. There's DefineScan, which uses scan parameters to generate scan locations,
def DefineScan(XMin, XMax, YMin, YMax, ZMin, ZMax, RMin, RMax, XSteps=100, YSteps=100, ZSteps=1, RSteps=1):
and then you pass this off to GridScan, which moves to these locations and handles taking pictures and stuff.
Let's say you want to do a complex scan with X and Y minimums and maximums of 0 and 200 with a step size of 100, you want to take each of these pictures at six different Z heights between 0 and 3000, and you want to get all of these images from 4 different perspectives over the whole object. So you would say:
MyScan = DefineScan(0,200,0,200,0,3000,0,160,100,100,500,40) GridScan(MyScan)
And the file dialog box will pop up to start your scan.
Hopefully the naming makes it somewhat clear what is going on here. 0 and 160 are the start and endpoint of the rotation, since there are 160 positions possible when 8th microstepping with a 20 step motor, and we want four views so our stepsize is 40 (160/4). Likewise, because we want to view 6 different Z heights between 0 and 3000, we set our step size to be 500 (3000/6).
The output of DefineScan is a dictionary with four keys, X,Y,Z, and R, each of which holds a list of where that axis should be at every point in the scan. As long as the input to GridScan is of this format, you should be able to scan any arbitrary pattern you want.
Step 17: Stitching Many Files Or: Why I Want Microsoft to Notice This Instructable
Get ready for the most bandaid solution of the project --- even moreso than the automatic restarting of the Pi:
We are going to run a Visual Basic script to automate the 2D stitching process. It will simulate physical keypresses and run through the Microsoft ICE menu. Yes, really.
This 'fix' is the product of Yujie, my resourceful highschool intern/programmer in Summer 2018. I said, "Find me a way to 2D stitch hundreds of images to the quality we expect from Microsoft ICE!" And so... that's what he did. He eventually took this kind of talent all the way to outer space.
Just be careful not to accidentally click on the VBS script before you're ready...
The necessary files can be found in the Utils folder. We need WriteSPJ.py and ICE.VBS or ICEwLayout.VBS. First, we'll put every set of images to be stitched in a separate folder, and all those folders in one parent folder. The scanner already outputs images like this for different Z heights and rotational points of view.
Next, run WriteSPJ.py with the command
python writeSPJ.py -i "PATH_TO_PARENT_FOLDER" -o "PATH_TO_OUTPUT_FOLDER" -e FILETYPE
Where filetype is jpg, png, or whatever your pics are.
Now, put the bunch of SPJ files generated in a folder named "SPJ FILES", and make another folder below that called "stitched", and lastly, the VBS script below that. It has to be two below the SPJ folder or it won't work!
Click on one of the SPJ files and note approximately how long the main steps (initial stitching and autocomplete) take. Also save the file and note where it saves, it should be in the "stitched" folder.
Edit (not click!) on the VBS script and change it to fit your conditions. This means altering the number of times it clicks runs through the files, and how long it should wait at the main steps (10-20 seconds longer than how long it takes a human making attention). These points should be right above the comments:
REM the number of SPJ files you have
REM the time it takes to do stitching plus safety
REM the time it takes to do autocomplete plus safety
Now, finally, at bedtime, click on the VBS script and watch it go! Come back the next morning to all your sweet, sweet images.
And to Microsoft, if you are reading this: Please add a batch feature to ICE or make the API more open... :(
Step 18: High Res Scanning
Yujie also made a tool to help fix a problem that occurs when you do high res scanning, since depth of field decreases --- namely, unless the object is perfectly flat, large swathes will be out of focus. One solution might be to stack your images, or do autofocus at each location. This is kind of a brute force implementation of that: You do the entire scan at many different Z heights, and then only stitch the individual sub-images that are in-focus. Focus is determined with a Gaussian blur algorithm. Essentially, as I understand it, things that are in focus will tend to have pixels that are sharply different from their neighbors, whereas blurry things will be more uniform.
Just watch the video, argh!
Step 19: 3D Model Generation
This is it.
We have pictures from all sides. Now we can just press a button and create 3D model files!
...not so fast.
It turns out that this is hard. And expensive. I never found a totally free program that I figured out how to use. People pointed me to OpenSFM, but I didn't get any results with it. The program I had some success with was 3DFZephyr, which has a free option --- up to 50 pictures, which should be enough. But actually, the biggest limitation is not the number of pictures, it's stuff like the sticky-outy-legs and shiny carapaces that insects tend to have --- combined with the fact that standard photogrammetry software is confused by how we 2D scanned our objects first. I can't really give you advice other than, read about photogrammetry, ask for help, try your best.
Also, stink bugs scan really well for some reason.
Step 20: Closing Thoughts
Despite thousands of hours of work, LadyBug has problems. A lot of problems. Yet, that means it still has a huge amount of potential! For instance, look at 3D model generation --- we have knowledge of where our object and camera is at all times, but we aren't utilizing that at all. If we take that information into consideration, it might actually be possible to implement that one-click solution we all want.
I started this project on a whim, and it snowballed into essentially half of my Master's degree. It's very common in academia to spend years building or discovering something and then have absolutely no one try replicate your work --- that's why I'm publishing in Instructable's format. I really hope that other, sorta normal people will see this project and say, "Wow, that guy is crazy, but I know a couple of friends with old PS3s, and it would be cool to 3D scan and print a bug". I would be thrilled to hear about some kid discovering a new insect...
But I also understand that this project, as it stands, is a real commitment. HOO BOY. It was an insane amount of work to write about, let alone build it once, let alone design it from scratch. You have to source all the parts, and tune your printer, and the software is clunky, and omg, soldering the mini stepper motor is a paaaaain... And I'm working on that... for instance, I keep mentioning a circuit board that will do such things as fold your laundry and whiten your teeth. It's not impossible, it just takes resources. Time, and commitment, and, well, other things.
And so to you, the reader, who I thank for making it this far: Would you support me in my quest to make LadyBug a serious tool for photographers, teachers, and scientists?
I've been saying it for over a year, but this time, I MEAN IT. The Kickstarter is coming soon.
Third Prize in the