Photogrammetry is the art of reconstructing digital 3D models using photos.
To reconstruct a 3D model of an object, photos are captured from different angles.
A set of images can be extracted from a video too. Note that
a set of photos has advantages over a set of extracted images from a video:
Photos contain meta information like focal length and sensor width.
Photos tend to be less blurry.
ffmpeg -i "$VIDEO" -r "$FPS" -qmin 1 -qscale:v 1 img_%04d.jpg
Put all photos into a folder called images
inside a named project folder:
PROJECT="my_photogrammetry_experiment"
mkdir -p "$PROJECT/images"
cp *.jpg "$PROJECT/images"
Optionally (but highly recommended), create image masks for each image.
Image masks tell colmap where to look for keypoints during feature extraction.
For an image images/0123.jpg
, the corresponding mask has to be named masks/0123.jpg.png
.
No features will be extracted in regions, where the mask is black (pixel value 0).
Execute the reconstruction:
colmap automatic_reconstructor \
--workspace_path "$PROJECT" \
--image_path "$PROJECT/images" \
--mask_path "$PROJECT/masks"
The reconstructed point cloud is written to:
$PROJECT/dense/0/fused.ply
The reconstructed mesh is written to:
$PROJECT/dense/0/meshed-poisson.ply
MeshLab can import point clouds and meshes stored in the Stanford Polygon File Format (*.ply):
File > Import Mesh...
Using the point cloud, a mesh can be computed using the following filter:
Filters > Remeshing, Simplification and Reconstruction > Surface Reconstruction: Screened Poisson
Reconstruction Depth: 12
There is also a filter for mesh simplification.
The mesh should be smoothed before simplification.
Filters > Remeshing, Simplification and Reconstruction > Simplification: Quadric Edge Collapse Decimation
Target number of faces
File > Import > Stanford PLY (.ply)
Sculpting
In the toolbar at the bottom: Smooth