This repository presents an end-to-end pipeline for human motion retargeting, starting from raw RGB images and producing a fully animated, identity-preserving 3D human avatar. The system integrates multi-view 3D reconstruction, parametric human modeling with SMPL-X, appearance transfer, and motion retargeting using real motion data.
Context: This project was developed as part of STAT 59800: 3D Computer Vision & Virtual Human Models.
- 📸 Image-based 3D reconstruction using COLMAP + PyCOLMAP (CUDA-accelerated).
- 🧍 Parametric human fitting with SMPL-X via robust multi-stage optimization.
- 🎨 Appearance transfer from reconstructed scans to SMPL-X using nearest-neighbor projection.
- 🧹 Mesh refinement including SOR, noise filtering, and Poisson reconstruction.
- 🏃 Motion retargeting utilizing MOYO motion sequences.
- 🎬 Identity preservation in final animated video outputs.
graph TD;
A[RGB Images] --> B[Foreground Masking<br/>YOLO + SAM];
B --> C[Multi-view Reconstruction<br/>COLMAP / PyCOLMAP];
C --> D[Point Cloud Refinement<br/>SOR + Noise Filtering];
D --> E[Poisson Surface Reconstruction];
E --> F[Mesh Refinement &<br/>Triangle Decimation];
F --> G[SMPL-X Fitting<br/>Multi-stage Optimization];
G --> H[Color Transfer<br/>NN Projection];
H --> I[Motion Retargeting<br/>MOYO];
I --> J[Final Animated Video];
```text
3d_virtual_humans/
├── 00_extract_frames.py # Extract frames from input video
├── 01_segment_save.py # Generate foreground masks (YOLO + SAM)
├── 02_refine_masks.py # Refine and clean binary masks
├── 03_3d_proj.py # Run COLMAP/PyCOLMAP reconstruction
├── 04_create_posson_mesh.py # Poisson surface reconstruction
├── 05_mesh_clean.py # Mesh refinement, smoothing, decimation
├── 06_mesh_to_simplx.py # Fit SMPL-X model to the clean mesh
├── 07_extract_colors_robust.py # Transfer colors from scan to SMPL-X
├── 08_motion_retarget.py # Apply MOYO motion sequences
├── 09_export_meshes.py # Export final animated meshes/video
├── download_moyo_data.py # Helper to download specific sequences
├── download_moyo.sh # Shell script for MOYO dataset
└── README.md
torchsmplxtrimeshpycolmap(Requires CUDA for dense reconstruction)open3dscikit-learn
Foreground human segmentation is achieved via a two-stage learning-based pipeline to remove background clutter and improve reconstruction quality:
- YOLO: Used for coarse human detection (bounding boxes).
- SAM (Segment Anything Model): Used for precise pixel-level masks within the bounding box.
- Engine: COLMAP / PyCOLMAP (CUDA).
- Outputs: Camera poses, sparse point clouds, and dense point clouds.
- Scale:
- Initial points: ~8.3M
- Refined points: ~1.2M
Point Cloud Refinement:
- Statistical Outlier Removal (SOR).
- Noise filtering (CloudCompare-style).
Mesh Construction:
- Method: Poisson Surface Reconstruction (depth ≈ 9).
- Result: Watertight, manifold meshes.
Mesh Optimization:
- Laplacian smoothing.
- Removal of disconnected components.
- Triangle decimation (Quadric Edge Collapse) reducing ~840K to ~200K faces.
We fit an SMPL-X model to the refined mesh using multi-stage gradient-based optimization.
| Stage | Parameters Target | Learning Rate | Iterations |
|---|---|---|---|
| 1 | Global orient, translation, scale | 0.01 | 150 |
| 2 | Shape ( |
0.01 | 250 |
| 3 | Pose (High Regularization) | 0.005 | 300 |
| 4 | Pose Refinement | 0.002 | 400 |
| 5 | All Parameters | 0.001 | 200 |
- Loss Function: Bidirectional Chamfer distance.
- Regularization: Priors applied to Shape, Pose, and Hands.
Color is transferred from the reconstructed scan to the SMPL-X mesh via Nearest-Neighbor Projection:
- Scan and SMPL-X meshes are independently centered.
- Vertex colors are normalized to
[0, 1]. -
$k$ -NN projection ($k=1$ ) is performed in 3D space.
- Advantage: Avoids complex UV mapping and remains robust to slight alignment offsets.
Motion is retargeted using sequences from the MOYO dataset:
- Pose Representation: 165D fullpose.
- Explicit Extraction: Body, hand, and jaw poses are extracted explicitly.
-
Constraints: Shape (
$\beta$ ) and scale are fixed across all frames; floor alignment is enforced via minimum vertex height.
- Hand Geometry: Fine hand and finger geometry may be incomplete due to reconstruction sparsity.
- Facial Expressions: Limited by the quality of the initial scan.
