Photogrammetry

 Posted by at 13:42  2 Responses »
Sep 242010
 

Photo-what?

That ugly word is actually a very useful tool for reconstructing geometric information from 2D images. Using a collection of similar photographs of a given subject, you can use matrix math to recompute the 3D structure of that object from the 2D images. Not by hand, mind you. That would take way more brainpower and patience than pretty much anyone has any desire to lend to the task. Computers, however, make great photogrammetric calculators.

Why is this relevant to anything? Well, it’s pretty important when you want to accurately recreate something in the world in a 3D modeling environment and you don’t have access to A) the thing you want to create and B) a 3D scanner. Specifically, I’m talking about modeling spaceships. Most 3D hobbyists just wing it, eying the proportions and getting pretty close. But let’s be honest: when have I ever been satisfied with getting “pretty close” when I could use math to be exact?

I started out modeling a Star Destroyer last year, trying to take very accurate measurements in Photoshop and extrapolating the “right” values by averaging several of these measurements together. I was putting together what looked like a fairly accurate model. Then I read about photogrammetry. This had two effects: the first was that my progress on the Star Destroyer model ground to a halt; the second was a period of intense research into the fundamental math behind photogrammetry. This included (re-)teaching myself matrix math, learning about projection matrices1, and so on. I googled university lectures, dissertations, and dissected open-source projects to understand how this process was done.

Sadly, none of the open-source projects I found would do quite what I want. It seems that the hot thing in photogrammetry is reconstructing terrain surface detail with as many recreated vertices as the resolution of the source images would allow. I wanted to define just a handful of points each image and have a mesh reconstructed from them. From there, I would do the fine detail work on my own. So, I started writing my own program (in Python) to do it. Losing my job, getting a new job, and getting married all conspired to prevent much progress on this front, though, so it hasn’t progressed very far yet.

Assuming I can get something I’m happy with, though, it will alleviate one of the biggest sticking points I’ve always had when modeling technical things: accurate blueprints. Just about every set of blueprints for every technical thing2 I’ve tried to model has had errors in it. Not little, nitpicky errors, either, but major, mismatched proportions between orthographic views. In one image, a component would be X pixels long but in another image—from the same set of diagrams, mind you—it would be Y pixels long. In some cases, you can just split the difference and get something decent. Most of the time, these compromises compound until you’ve got an irreconcilable problem.

Anyway, this is probably one of those topics that will prompt most people who read this to smile, nod, and pat me on my math nerd head. All the same, it’s interesting to me, so maybe it’ll strike your interest to.

  1. A projection matrix describes the conversion of a 3D coordinate to a 2D coordinate through a camera lens, essentially. []
  2. Okay, okay, spaceship. []