This system provides automated camera path planning for 3D point cloud exploration. It analyzes 3D scenes, selects optimal camera viewpoints, plans collision-free paths, and generates smooth cinematic videos.
# Create virtual environment
python -m venv venv
# On Windows: venv\Scripts\activate
# On macOS/Linux: source venv/bin/activate
# Install dependencies
pip install -r requirements.txtpython src/main.py --ply path/to/your/scene.ply --out results/output_video --fps 30| Argument | Description | Default |
|---|---|---|
--ply |
Path to input PLY file (required) | - |
--out |
Output directory for results | outputs/scene_1 |
--fps |
Frames per second for output video | 24 |
Class: Scene in explorer.py
Purpose: Load and structure 3D point cloud data for efficient spatial queries.
Key Methods:
scene = Scene(ply_path, voxel_size=0.3)
scene._load_scene() # Load PLY with voxel downsampling
scene._filter_points() # Remove outliers using percentile filtering
scene._build_spatial_structure() # Build KD-tree and occupancy gridParameters:
voxel_size: Controls resolution (default: 0.3)filter_percentile: Outlier removal threshold (default: 90%)
Class: Explorer in explorer.py
Purpose: Sample and evaluate potential camera positions.
Key Methods:
explorer = Explorer(scene)
explorer.sample_candidates(num_samples_per_axis=10) # Generate viewpoints
explorer.score_candidates() # Evaluate visibility scoresSampling Candidates: Sample candidate points by dividing the space along each axis using the scene's bounding box.
Scoring Algorithm:
- Cast rays in multiple directions from each candidate
- Measure distance to object each ray 'hits' using Digital Differential Analyzer (DDA)
- Aggregate scores: Scoring function favors viewpoints where obstacles are situated between 0.5 and 10 units away, creating balanced compositions that show objects clearly without being too close or too distant.
- Sort candidates by the score
Class: PathPlanner in path_planner.py
Purpose: Generate smooth, collision-free camera paths.
Key Methods:
planner = PathPlanner(scene)
path = planner.plan_path(keypoints) # Main planning pipeline
# Individual components:
path = planner.a_star(start, end) # Basic pathfinding
path = planner.simplify_path(path) # Path complexity reduction
path = planner.smooth_path_catmull_rom(path) # SmoothingPath Planning Pipeline:
- A_/Theta_ Search: Find collision-free route in voxel space
- Path Simplification: Remove unnecessary waypoints using Ramer-Douglas-Peucker
- Spline Smoothing: Apply Catmull-Rom interpolation for smooth motion
# Visualize the planned path
plot_path(sampled_points, candidates, path)![[path_vis.png]]
1. Camera Collisions with Obstacles After path simplification and smoothing, the camera path can intersect with scene geometry. 2. Sparse Geometry Issues (Walls/Floors) Voxel occupancy detection fails for surfaces with sparse point distributions.
https://drive.google.com/drive/folders/1iJu5oi5cM4CaKqJlM2_FFEkPKH6ZtK0X?usp=sharing