This project aims to create a detailed and accurate 3D point cloud model using video footage. The process involves extracting frames from videos, generating point clouds using COLMAP, and merging these clouds using CloudCompare’s CLI. This workflow is optimized for efficient photogrammetry and enables the creation of comprehensive 3D representations.
- Video Frame Extraction: Extract frames from video files to generate images optimized for 3D point cloud creation.
- Point Cloud Generation: Use COLMAP to create point clouds from the extracted frames.
- Point Cloud Merging: Merge the generated point clouds into a single unified cloud using CloudCompare's CLI.
- Python with OpenCV library for frame extraction.
- COLMAP for point cloud creation.
- CloudCompare CLI for merging point clouds.
- Clone this repository:
git clone https://github.com/oriariel/Photogrammetry-Project.git
- Install the required Python packages:
pip install opencv-python
- Ensure COLMAP and CloudCompare CLI are installed on your system.
Run the video2Images.py tool to extract frames:
python video2Images.py <video_path> <output_dir> --step <frame_step><video_path>: Path to the input video file.<output_dir>: Directory to save extracted frames.--step: Interval between frames (e.g., every 50th frame).
Example:
python video2Images.py ./input/video.mp4 ./output/images --step 50Step 1: Create virtual environment:
python -m venv colmap-envStep 2: Activate it: • On Windows:
colmap-env\Scripts\activate• On macOS/Linux:
source colmap-env/bin/activateStep 3: Install Required Packages:
pip install numpy opencv-pythonStep 4: Run the colmap_reconstruction.py using the following command in your terminal:
python colmap_reconstruction.py <input path project> <input image path>Save the point clouds as .ply files (e.g., p1.ply, p2.ply).
Use the following command to merge the point clouds:
CloudCompare -O p1.ply -O p2.ply -ICP -MERGE_CLOUDS -C_EXPORT_FMT PLY -PLY_EXPORT_FMT ASCII -SAVE_CLOUDS FILE merged_cloud.plyThis merges the clouds generated from each video set into a unified cloud, which is saved as merged_cloud.ply.
or run the merged_clouds.py using the following command in your terminal:
python merge_clouds.py <point_cloud1.ply> <point_cloud2.ply> <merged_clouds.ply>Parameters <point_cloud1.ply>: Path to the first input point cloud file. <point_cloud2.ply>: Path to the second input point cloud file. <merged_clouds.ply>: Path where the merged point cloud will be saved.
- Successfully generated and merged 3D point clouds for further analysis and visualization.
- Verified alignment accuracy using CloudCompare's GUI and eliminated any outliers for a cleaner model.
Project Report in Overleaf: https://www.overleaf.com/read/dqjdqzsbnmbf#246981