Photogrammetry made simple
By Anar on Thursday 16 February 2017, 01:24 - Software - Permalink
It's been a while since I wanted to write something about the photogrammetry solutions and pipelines that I've been testing.
Here is an attempt to cover this vast subject and try making it understandable and easy to follow for everyone...
I've always wanted to try photogrammetry to capture real life objects as 3D meshes but so far I got poor results (or no results at all).
This is because until then I didn't own a decent camera (not the most important - you can achieve decent results with just a 8Mb pixels one) but mostly because I didn't own a powerful enough computer (having lot of RAM being the key).
But I recently purchased a 32Gb RAM PC that let me explore the photogrammetry process again.
Still the photos that I took several years ago have been shot with just a 8Mb pixels camera (Nikon Coolpix L16).
What is "Photogrammetry" ?
Photogrammetry (or more strictly speaking "stereophotogrammetry") is the derivation of 3D information on points, lines and areas on objects or terrain from photographic image sequences. It's a non-contact technique which creates virtual reality 3D scenes with real-life textured models.
The process involves taking a series of photographs of an object from different angles to computationally generate a 3D model by comparing features across the photographs.
Photogrammetry 1st step
It all starts by shooting photos.
But not all the photos can be qualified, and shooting good photos for a photogrammetry project isn't the same as shooting good photos for a photo contest or exhibition.
Keep that in mind !
As a rule of thumb you must absolutely respect the "GIGO" principle (GIGO = Garbage In, Garbage Out).
If your photos are not good you can't expect good results whatever the software you will use.
So what is a "good photo" on a photogrammetric point of view ?
Things to take care of :
- a good camera : a 8Mb pixel camera (or more) with manual mode and EXIF data available
- prime "fixed" lens : 35mm, 50mm and 85mm
- photo size : the more pixels you can catch, the more dense your point-cloud will be (but computing time will increase). Always shoot your photos in RAW format if your camera can handle it. Unless choose the best JPEG resolution available.
- depth of field (DOF) : you want to have all the parts of the object you're catching in focus. Increasing your F-Stop will help to reduce blur (choose a value between 10 and 16).
- shutter speed : a fast shutter speed will reduce any motion blur from DOF (1/125 or more)
- ISO : an ISO value of 800 or lower will reduce the noise (grain)
- object covering : the goal is to capture the whole object without having too many uncovered parts. Parts that you want to capture should be seen at least on 2 photos with 40 to 60% overlap. Make sure your photo set will cover all parts of the object. So don't forget to also shoot from a bottom and top point of view. What won't be in the pictures won't be in your final mesh. Shooting more photos than needed is better than not shooting enough (especially if you can't re-shoot the object later or if the shooting conditions have changed). A 10° rotation between each photos with a fixed point of view (POI) is a good rule (so at least 36 photos for a complete 360° rotation). You might need to shoot up to 3 or more rows depending on the object. Think twice about your shooting strategy before to proceed.
- scale bar : you will do a better reconstruction if you know the object's scale. Including a scale-bar in your photos is strongly recommended. An object with known dimensions may serve as a scale.
- markers : you may place additional physical markers on the specimen. At least 3 so that each is visible in 2 photos. The markers will be used to align models calculated from separate sets of photographs (chunks) if they are required to cover the whole surface of the object.
Things to avoid :
- inconstant lighting : avoid strong contrast in your photos. When shooting outdoor you should avoid direct sunlight so it's always better to chose a cloudy day without strong light and shadows. When shooting indoor you may want to use studio lighting with soft even lighting (minimizing shadows) and strobes (necessary with fast shutter and high F-stop parameters). Shooting facing the sun (or light) is also something to avoid as it may produce lens flare and artifacts.
- moving object or background : avoid having a moving background if you can as it will save you some image masking tasks.
- reflective surfaces : if the subject is behind a window you might consider using a polarizing filter.
- moving while shooting : even a small movement while pushing the trigger of your camera may result in some motion blur. Always use a tripod whenever it's possible and a remote trigger.
- panoramic views : move the camera in relation to the specimen (or vice versa) to create parallax. Don't take panorama photos (many photographs from one camera position).
ISO value versus exposure time and f-stop is a three-way trade-off
As a resume don't forget the "GIGO" rule ! The quality of your photos is the key factor for the quality of the final model.
You will probably (and hopefully) learn from your mistakes. So don't hesitate and go ahead.
Photogrammetry computation workflow
Photogrammetry is a technology that evolves really fast and the things that I will cover here probably won't be true anymore in a few years (or even months).
Back as little as a few years ago I just couldn't successfully perform a photogrammetry project because my computer wasn't powerful enough even with only a 8Mb pixels camera.
But things are moving fast on the hardware side and a second hand 32Gb RAM computer is becoming affordable.
Some software will deal well with only 4Gb of RAM while some others won't even compute your data.
So the more RAM you will have, the more the processing will be possible, fast and acceptable.
As I can't afford to pay for a photogrammetry software, I will only cover the free and open-source solutions here.
But not pointing you at the very good commercial solutions wouldn't be fair...
So just to name a few (and if you can afford paying the price) you can consider the following:
Now for those like me who can't afford these commercial products here are a few alternatives :
- VisualSFM (I started with that a few years ago)
- PMVS / CMVS (can be used along with VisualSFM)
- MeshRecon (Windows - based on VisualSFM and can be used along with PMVS/CMVS or MVE)
- OpenMVG (Unix - probably one of the best solution by Pierre Moulon but more difficult to master)
- MVE (Unix/Windows - can be used along with OpenMVG)
- CMPMVS (CapturingReality's ancestor - see commercial products above)
- SMVS (can be used along with MVE)
- Regard3D (based on Pierre Moulon OpenMVG - new release available since yesterday - 15/02/2017)
I just can't develop and explain each of these products here (but maybe I will do it in some future posts). But most of them are very well described on Dr Falkingham's website.
Image courtesy of Dr Falkingham
There's also a bunch of Cloud-based alternatives (not tested except Memento) but mind checking the copyright of what you will be uploading before to proceed.
- Autodesk Remake (formerly Autodesk Memento - mind that the copyright will be tansferred to Autodesk)
- Autodesk 123D Catch (same remark as above about copyright consideration)
- ARC 3D (copyright considerations)
- probably others (but I won't look for them or even test them as I'm more interested in the "open-source" route)
To resume
Doing a photogrammetry 3D project is not anymore a nightmare as long as you have a decent computer (as much RAM as you can).
So don't be shy and give it a try without being afraid of making errors. You will probably do !
But our trials and errors are part of our learning curve as long as we can understand them an correct ourselves.
Just remember the one and only thing that is important : "Garbage In is Garbage Out !" (GIGO)
If you want to go any further
Photogrammetry is such a vast subject that I can't cover it all in just one post.
But many other people have done some excellent work so I let you go ahead by yourself by pointing you at their work :