3d Scan Anything Using Just a Camera

by shapespeare in Workshop > 3D Printing

757355 Views, 2917 Favorites, 0 Comments

3d Scan Anything Using Just a Camera

3d-scan-anything-with-just-camera.jpg

If you haven't been living under a rock for the last few years you have probably heard all the cool stuff that is going on with 3d printing. We are now capable of printing almost anything provided we have a 3d model to work from. There are many ways to make a 3d model, but one of the coolest is to 3d scan an existing object. With a 3d scan and the right printer you can reproduce any object at any size from a house to an earring. You can also use the scan as a starting point for a new creation. Think of everything you can do with a picture in Photoshop. Now you can do that in 3d with real stuff as well.

The most amazing thing about 3d scanning is that you probably already own the best tool there is for it. It might be in your pocket, or you may be staring at it as we speak (so to speak. . .actually I'm writing and you are reading, but you know what I mean). This tool, which will allow you to capture the world in amazing 3d, is a simple camera. Combined with a little technique and some inexpensive or even free software, your camera becomes the world's most versatile 3d scanner. Stay tuned and I'll show you how.

Throughout this instructable you will find embedded 3d scans which you can explore thanks to our friends at Sketchfab. Just click on the white triangle to start, then you can experience the scan in 3d.

If you want to learn more about 3d scanning and printing be sure to check out my podcast "3d Printing Today". Its available on iTunes and Stitcher.

How Does This Work?

giant-3d-printed-oreo.JPG
oreo-3d-scan-aligned.jpg
oreo-photo-scan.JPG

The concept is simple. You take a bunch of photos of an object you want to capture. Every part of the object must appear in at least 3 photos to be captured. The photos are fed to a program which identifies individual spots on the object and, though a combination of trigonometry and dark magic, deduces their location in 3 dimensions. By identifying enough of these spots (sometimes literally millions of them) the program is able to make a digital reconstruction of the object, suitable for amazing your friends, embedding in your latest video game, or, sometimes, 3d printing.

Shooting the photos takes a bit of practice. You don't need to be the next Ansel Adams, but it is helpful if your photography experience goes beyond shooting selfies.

The software is pretty easy to get started with. Most of the free packages don't offer many options which makes them easy to use when they work. The more sophisticated systems can take as much time and money as you want to give them, but can reward you with amazing results.

Will Any Camera Work?

Yes. That is my startlingly unqualified answer. But naturally some cameras will work better than others. The ideal camera would produce crystal clear, tack sharp, perfectly exposed, undistorted, high resolution photos under any conditions. Unfortunately we don't have such a camera yet, but we are getting close. Here are some different types of camera along with a scan made with photos shot with each type. You can click on each scan and explore it in 3d.

This old school Nikon FM2 would theoretically work, but since you would need to shoot 5 rolls of film for a decent scan I'm not about to test it out.

DSLR's

DSLR's are still the gold star standard for photography and rightly so. They offer quality, versatility and control that you won't find anywhere else. You don't need an expensive pro model to enjoy these advantages. I have shot most of my scan using a 12.3 MP Nikon D5000. Newer and more expensive models may offer higher resolution which means more data, but it also means higher processing times.

Most DSLRs now give you access to RAW sensor data which allows you to avoid Jpeg compression artifacts in your images. This is a useful feature, but only if you are trying to capture the absolute highest quality scans.

I scanned this beautiful carved panel while waiting in a hotel lobby in Orlando. I shot 49 pictures in challenging light with a Nikon D5000 with the 18-55 kit lens.

Point and Shoot

Point and shoot cameras and their mirror-less cousins have many of the advantages of DSLRs with a lower price tag. The ideal point and shoot would have a manual mode so you could really control your exposure. Canon point and shoots have the added advantage of CHDK which is an open source firmware which you can optimize to your specific needs.

I met this charming chap in the lobby of the Miami Biltmore. His job seems to be to hold up the staircase which might explain his tired look. I shot 20 pictures with a Nikon Coolpix point and shoot.

Go Pros and Other Totally Sick Action Cams

Grab yer goPro, do something totally sick, post it to youTube and you too can be famous. But can you capture your antics in 3d at the same time?

Most photogrammetry software doesn't play well with goPro. This has to do with the fisheye lens which distorts the image. Recent versions of Agisoft photoscan have a special setting for fisheye lenses which works well, but it seem to be much slower than the regular algorithm. The latest GoPros have the advantage of a built in timelapse and burst modes which allows you to shoot automatically at rates from one frame a minute to 10 frames a second. This is useful because you can mount the camera on the end of a broom handle or a painter's roller extension and get high angle shots which would be difficult otherwise.

I used the burst mode on a Hero4 Silver to shoot 10 frames a second for 3 seconds. Perhaps my expression reveals the concentration required to do this while holding my head absolutely still.

Video Cameras

Since we need lots of photos of a subject from all angles a logical question is "What about video?" Video cameras usually capture 24 pictures per second. So all we should need to do is wave the camera around the subject as if we were painting it to capture all the photos we need. The pictures are taken so rapidly that it is almost impossible to not get enough overlap between them.

It is a good idea in principle and it works in practice, just not that well. The resolution of video frames is nowhere near what still cameras produce. Most have tiny sensors and inexpensive optics which are optimized for shooting video, but they don't produce very sharp still images. There may be a future for photo scans from video especially when we start to see affordable 6k and 8k cameras which can record uncompressed images. It might also be possible to optimize software to handle huge numbers of lower resolution images.

As an experiment I made this scan using VGA resolution frame grabs from the on-board camera of a $50 quad copter. It actually works and the results aren't as bad as I had expected. The some of problems have to do with me not being a competent quad copter pilot.

Smart Phones

If you have a smart phone it may be the best place to start. Most modern phones come with a pretty deent camera and there are aftermarket camera apps which will give you better control. The real potential of the phone as scanner is in dedicated scanner apps. The power of the scanner app goes beyond just taking the photos. For instance, the 123dCatch app from Autodesk uses your phone's sensors to measure what direction you are pointing your camera and to coach you through making a good scan. Then the app up loads your photos to their server for processing. You might not want to do this on your data plan, but it could be a handy feature on wifi. A short coming of the current 123dCatch is that it doesn't save the photos to your phone (at least the android version I used didn't). If (or I should say when) something goes wrong with the scan you don't have easy access to the photos to try something else.

This is a scan of one of my anvils which I shot with a Samsung Galaxy S5 using the stock camera app. I shot 74 photos and processed them with Agisoft.

What Is the Best Camera to Use?

When you are getting started the best camera to use is the best camera you have. The DSLR is the gold standard. If you want to buy a camera for serious photo scanning, or serious photography in general, this is what you want. But remember, what it comes down to is the quality of your photos, not the quality of your camera. With the right skills and the right conditions you can take good photos with a bad camera. But if you don't know what you are doing, it is easy to take bad photos with a good camera. If you want to invest in something, invest in your skills as a photographer. The camera is only as good as the photographer behind it.

Photo scanning something difficult, like this scan I made of the eye of a needle, requires a pretty good understanding of both photography and photogrammetry. I shot 63 photos using a Nikon D5000 DSLR with a 40mm Micro NIKKOR and an extension tube.

What to Scan

wing-tip-scan-photo.JPG
wing-tip-shoe-3d-scan.jpg

When you start out pick something easy that will give you good results.

The idea subject. . .

will hold still

isn't too shiny

isn't so big that you can't easily get around it

or so small that it requires special skills and equipment to photograph it

has a lot of surface detail and not any large uniform areas

doesn't have a lot of really thin delicate parts

A shoe is a great first scan. Pick something simple and practical, nothing glittery that screams "take me to Las Vegas".

Setting Up for a Scan

cast-iron-teapot-scan.JPG

Put your subject on a stool or a box so you don't have to crawl around shooting it on the ground. I set this teapot on top of my tripod so I could shoot it comfortably. Make sure you have good lighting. If you can swing it, working outdoors on an overcast day is perfect. You get lots of nice even diffuse light. If you need to shoot indoors set up as much light as you can and make it as diffuse as possible. Point your lights at a white painted ceiling or bounce cards, or those groovy silver umbrellas. The idea is to get as much light as possible with as few shadows as possible. On-camera flash is not generally useful here. It tends to cast shadows which appear in different places in each photo. Remote strobes are fine as long as they provide a very diffuse, even light.

You are going to be shooting somewhere around a hundred photos so make sure your set up is comfortable. It is possible to shoot using a tripod, but it is so time consuming that it should be avoided if at all possible. The best plan is to get enough light going that you can shoot handheld.

Set Up Your Camera

nikon-FM2-controls.JPG

If you don't know what at least some of those knobs and buttons on your camera do, this would be a good time to learn. There are lots of good sites dedicated to this subject, written by people how know a lot more than I do so I will only touch on the basics.

ISO determines how sensitive the camera is to light. Higher values will reduce exposure times, but at the cost of increased noise. ISO400 is as high as you want to go with most cameras. You set it and forget it.

Aperture priority is the best mode to shoot with. You choose an aperture and the camera makes all the other adjustments for you. There is a balancing act between the greater depth of field that comes with smaller apertures (which are signified by larger numbers, thanks a lot whoever came up with that one) and diffraction effects which soften the image at very small apertures. For most cameras around f/11 gives you the best results.

Shutter speed plays a huge role in your quest for sharp pictures. If the exposure is longer than the reciprocal of the lens' focal length you can't hold the camera steady enough to get a sharp picture. In other words if you are shooting a 50mm lens you need to keep the shutter speed faster than 1/50th sec. Usually the only way to do this is by adding more light. As a last resort you can use a monopod or tripod to allow slower shutter speeds, but it will be very time consuming.

Taking Your Pictures

nikon-scan-photo-cluster.jpg

Unless you are extremely famous and have interns to sort hundreds of photos, you will want to make a new folder on your camera for each scan you shoot. Now, choose a starting point you will remember. This is usually looking straight on to the subject. By noting the start point you will know when you have completed a complete pass all around the object. Try to make the subject fill as much of the frame as possible. Background objects in the shot won't hurt and they can help the software locate the camera positions if there aren't enough features on the subject. The quality of your scan depends entirely on the quality of your photos. If you fill the frame with all the details of the subject you will capture those details in your scan.

The idea is to move around the subject taking photos from many different perspectives. Standing in one place and shooting a bunch of photos does nothing to capture the 3d shape. You need to move to subject. After you shoot the first picture look carefully at how it is framed. The object is to overlap adjacent exposures by 50-60%. When in doubt, overlap more. If you think you may have moved too much, go back halfway and shoot another picture. The order of the pictures doesn't matter to most software. Remember that you can always dump extra shots, but you can't make up for shots you didn't take. Once you break down your set up you are done. If you find later that you need more shots you usually have to start again from the beginning.

The Parallax Trick

scan-parallax-1 (2).JPG
scan-parallax-2.JPG

When moving between shots I find it helpful to look at the edges of the subject rather than its center. By watching the edges you observe how your movement occludes or reveals the background behind the subject. This effect is called parallax (by people who like cool words like that), and it magnifies your perception of motion. Even though the subject doesn't change very much between individual shots, the background does. If you move until you see a change in the subject you usually move too far.

More Tips on Shooting

shooting-low-tilt-screen.jpg

It is always better to have a few too many shots than a few too few. But having way too many can be a problem as well. For starters, the software must compare each picture to each other picture in the set. Even if math wasn't your favorite subject you can easily see how this could cause problems.

I generally try to capture the object as a whole by making a couple of complete revolutions around it at different angles and then I move in on areas of specific interest. When picking your angles think coverage, not comfort. Crawling around in the mud to get the low angle perspective is not much fun but you may need those shots. A DSLR with a flip out screen can really help as you can hold the camera at knee height and use the screen to frame the shots. The same is true for overhead shots.

As you make your shots pay attention to your exposure settings. If you are at a low angle, shooting up towards the sky you may want to overexpose your image an EV or two. This is because the camera's meter tends to pick up the light from the sky and under expose the image. A little over exposed is always better because you can see the details. If everything is silhouetted the software can't get much data from the shot.

Choose Your Software

agisoft-photoscan.jpg

You have a bunch of choices for processing your scans. I'll narrow it down the the 3 which are the cheapest and easiest to use.

For beginners my first choice is Autodesk Memento. It is cloud based so you don't need a super computer made of discarded Wii machines to run it. It has a good suite of tools for retouching your finished scans, it is easy to get started with, and it is free (at least for now). Autodesk's free consumer grade 123d Catch is another good option, but Memento is better.

Agisoft Photoscan is a step up from either Memento or 123d Catch. It is a step up in quality, a step up in learning curve and a step up in price. It allows you much more access under the hood. You can pull off amazing scans where the free systems think you were scanning a marshmallow. But it is a commitment. You need a real computer to run it. I process my scans on a high-end gamer laptop with 32GB of RAM which is marginal but it only overheats occasionally if you do something silly like leave it sitting on the sofa while processing a scan. Most serious users have a dedicated workstation with a whole slew of cores, a badass GPU ( preferably several) and a ridiculously large amount of RAM. If you don't just happen to have a cross between HAL and the WOPR lying around you may be better off processing your scans in "the cloud", or as I think of it, "someone else's computer".

Processing Your Images

memento-one-button.jpg

Assuming that most of you are going to take my advice and work with Autodesk Memento there isn't really much to processing your scan. It is a good idea to take a quick scan through your pictures and dump any garbage. Anything which doesn't show the subject clearly or is blurry or badly back-lit needs to go. After that just load up your images hit the go button and go shoot another scan or something else fun while you wait.

I would start with a simple scan with only a couple of dozen images for your first go. That way it will process quickly and you can experience the magic sooner. Don't expect perfect scans without a lot of practice and a lot of patience. I have been working on this for more than 2 years and my scans don't always come out, but at least I've learned 800 ways not the scan something.

Sometimes Beauty Is Only Diffuse Map Deep

leif-mesh-resolution.jpg

So now that you have taken a few scans, or at least thought about it, lets look at the qualities of a good scan. There are two basic elements to a scan, the mesh and the colored skin.

The mesh captures the physical form of the object. This is all we care about if we will be printing the object on a single color 3d printer. If this is what you have in mind then turn off those fancy colors and take a long hard critical look at your mesh. An incomplete mesh can be repaired, but if the mesh looks like a marshmallow now, it pretty much always will.

The colored skin is variously known as a color map, a diffuse map or sometimes, nonsensically, a texture. It is a regular 2d color image which is wrapped around your model. This layer is important if you want to 3d print your object in color. It is also important for online viewing, video games and animations.

Most game assets are just an amazing color map concealing a low poly blob of a mesh. This is very disappointing for the would-be 3d printer.

If you want to learn more about 3d scanning and printing please check out my podcast "3d Printing Today" available on iTunes and Stitcher radio.