I’ve taken lots of reference photos for various projects. The first time, I remember suffering a lot and having to redo a model a few times before I got a picture that worked. Just like measuring parts badly, refining your reference photo skills will save you a lot of time and effort when trying to reproduce objects in CAD. Once you have a model of an object, it’s easy to design mating parts, to reproduce the original, or even for milling the original for precise alterations.
I’m adding some parts onto a cheap food dehydrator from the local import store. I’m not certain if my project will succeed, but it’s a good project to talk about taking reference photos. The object is white, indistinct, and awkward, which makes it a difficult object to take a good photo for reference use in a CAD program. I looked around for a decent tutorial on the subject, and only found one. Maybe my Google-fu wasn’t the best that day. Either way, It was mostly for taking good orthogonal shots, and not how to optimize the picture to get dimensions out of it later.
There are a few things to note when taking a reference photo. The first is the distortion and the setup of your equipment to combat it. The second is including reference scales and surfaces to assist in producing a final model from which geometry and dimensions can be accurately taken. The last is post-processing the picture to try to fight the distortion, and also to prepare it for use in cad and modeling software.
Set-Up & Distortion:
It’s important not to try to be a good photographer, in the traditional sense, when taking a reference photo. We don’t want an interesting photo. We want a photo that’s as evenly lit, undistorted, and scaled as possible. If we took a photo of someone’s face using these methods, it would be terribly unflattering.
The first bit of equipment to help us is a camera whose lens does not distort the photo. Unfortunately, I am not a photographer so I cannot tell you what kind of lens combination is going to give you the best result. Perhaps someone can help out in the comments? However, I find that the lenses that come with regular point and shoot cameras or phones are usually pretty good for this. They are designed so that grandma (or Gerrit) can get the picture expected without having to know what fish-eye or barrel distortion is.
The real trick is just to back up from the subject. The further from the item in question, and the smaller it is in the picture, the less the overall lens distortion will affect it. Obviously, backing away from the object will lose some resolution, so it depends on what you need it for. For most applications, it is okay to lose some pixels for the sake of greater accuracy.
Next is skew and perspective errors. You want to take a photo as dead-on as possible. If successful, the only errors will be lens distortion and parts of the object getting smaller as they vanish into the horizon. A tripod isn’t necessary, but really helps. I have a three-dollar adapter for my phone that allows me to use it as a camera on a cheap tripod. It’s not silky smooth to adjust, there may be some swearing, but it will work for most things. We’ll set the camera level with the most important feature we are trying to capture. Setting it up to get the center of the object isn’t necessarily as important, because the further our point of interest gets from the middle of the lens the more distortion and perspective errors it will receive.
Lighting is also important. You can use a harsh light to some effect to show off a detail using shadows, but it is important to note the length of the shadow and the direction of the light on paper to assist later when pulling dimensions. A bright even light that doesn’t wash out the shadows on the part is best. Think of early art projects. When you shaded in a cube or sphere you wanted the smoothest gradient possible. If you over exposed the death star you would just have a white circle on a black backdrop, and all those Bothans will have died for nothing.
I use a few things to make a proper scale for my pictures. The most useful is a grid. It can be of arbitrary dimensions, as its main purpose is to help us set-up the photo and remove the distortion later in the process. Since it sits behind the object, it’s hard to tell what size the grid is without employing unnecessary trigonometry. I typically use a cutting mat that conveniently came with a grid painted on it. It is pretty easy to find a grid pattern online to print if needed. It’s nice to have large easy-to-see squares rather than small ones.
This process is not extremely accurate, but with care and luck one can sometimes get within a millimeter. If we supplement these with some caliper tricks, we can get even better. I like to take a graduated combination or machinist’s square and just set it beside the object. A wooden ruler will do as well.
It’s good to use the square to set the part upright to the table so that it’s orthogonal to the camera. I like to use a laser level to project a line from the camera to the object. This takes all the guesswork out of the equation.
- Don’t try to do it all in one photo. If you need the outline of an object. Set-up a photo to take the outline. If you need the interface on that object, set-up a photo just for that. You can always set-up more reference planes in your CAD software. It’s usually quicker and delivers a better result to take two photos, than to force one to do two different jobs.
- If there is information on the device that can be harvested without the help of the reference photo, record it separately. Don’t try to lift dimensions and information from the photo if it can be taken in a more accurate way.
- Clean the object thoroughly. I’ve wasted some time decoding a feature that was actually just dirt or oil on a part.
- If it’s a really strangely colored or glossy object and you can afford to ruin it, spray paint it a matte grey color.
- If it’s a thin, flat object, a few readers imparted this useful trick in the caliper post, a flatbed scanner will do an amazing job of reproducing it in two dimensions.
- Make sure to expose the photo for the maximum amount of greys and definition on the object. We don’t want any big highlights or big shadows. It may make the photo boring, but that’s okay.
- If the object is really big and it obscures the grid, there is a trick to still get the distortion out in the plane needed. Lets say you want the outline of an object taken at its center plane. Take a photo of the object. Now, mark the center of the object on the table, and mark the edge of the grid. Take the object away and then move the grid to the center of the object using the marked lines. Take a picture without moving the camera set-up. You now have a picture of the distortion at the center of the object. Correct the grid photo and then correct the original photo the same way to get an accurate outline.
In post processing, we will want to.
- Remove the distortion.
- Fix the lighting.
- Crop the photo properly for CAD software.
I typically use Photoshop to do my photo editing, but GIMP will work just fine. Both GIMP and Photoshop now include a camera distortion filter. You want to use this one first before moving onto the perspective errors that may have shown up in the picture. This is where the grid we placed behind the object comes in handy. The goal is to straighten any grid lines which are concave or convex. Once we have done this, we’ll have good lines for the next step.
The next step is to use the transform tools to distort the photo until all the lines are square to each other. It is likely that they are either a parallelogram, trapezoid, or strange combination of the two. If it is really extreme, you are better off retaking the photo and spending more time on set-up. If you really nailed it you can skip both these steps and that will be the photo which has the most accuracy.
The lighting in the photo may be off. Use the Levels tool to change it until we get the smooth gradient we are looking for. It may be tempting to wash out the photo, or to even it out so that the whites are white. Modern product photography has taught us that bright clean looking photos are what we strive for. This is not our goal. We are trying to extract geometrical information from the photo. What we want is a photo where the gradients of the shadows are most defined and the edges stand out clearly from the backdrop. It may look a little dark or washed out, but if you can clearly see everything it is done right. Try to think of old black and white educational photos from textbooks.
Last is cropping the photo. We want to crop as close as possible to the object as we can. I zoom in until the edge of my crop just touches the pixels of my object. We do this because we will set a dimension we want the software to size the photo to in our CAD software. If we have extra pixels bordering our object it will throw off the measurements we take.
Once you have cropped the photo, I also recommend distorting the photo to match the aspect ratio of the original object. For example, if you have taken a photo of a cylinder that is 10 inches in diameter and 15 inches tall, make sure the photo, if taken from the front, is to a perfect 2:3 ratio. If the perspective errors were removed successfully in the set-up and post-processing phases we should have a really close picture of the object at that point.
Hopefully after all the work we have a photograph that we can use in our modeling software of choice. It varies between them but the standard workflow is to make a plane and draw curves in a sketch. After that it’s a simple matter to extrude or revolve them into useful surfaces. For work that’s not in three dimensions, such as getting a board outline, you can also import the image into a vector program like Inkscape or Illustrator and trace the outline. Once you have that you can export it into a format your CAD software likes.
I hope this was useful. I’m sure many of you have solved these problems in your own way. What tricks and methods do you use to get a good reference photo?