This repository contains the implementation of a simple 3D laser scanner using off-the-shelf components. The scanner consists of a motorized turntable with a custom-designed fiducial marker and a planar marker placed behind it. The system projects a laser line on the target object, capturing the scene with a camera multiple times during rotation.
The output is a 3D point cloud representing the object's geometry.
The repository also includes code for camera calibration using a video file with a calibration chessboard marker.
# [OPTIONAL] create conda environment
conda create -n myenv python=3.11
conda activate myenv
# install requirements
pip install -r requirements.txt
project-folder/
├── camera_calibration/
│ ├── data/
│ └── markers/
| ├── output/
│ └── src/
├── point_cloud_generation/
│ ├── data/
│ └── markers/
| ├── output/
│ └── src/
|── utils/
|── README.md
└── requirements.txt
- Put the video file for camera calibration in the folder
camera_calibration/data
directory. The video should contain the calibration chessboard marker - Run the following command to calibrate the camera
python camera_calibration/src/calibrate.py
- The camera calibration parameters will be saved in the
camera_calibration/output
directory
Command Line Arguments for calibrate.py
Debug mode (display additional information)
Size of the chessboard
Scaling factor for the window size
Time interval to skip in milliseconds
Directory containing the video file
Name of the video file
Directory to save the output file
Name of the output file
It's possible to interrupt the video processing by pressing the Q key
- Put the video file for point cloud generation in the folder
point_cloud_generation/data
directory. The video should contain the back marker and the plate marker for a correct program execution - Run the following command to generate the point cloud
python point_cloud_generation/src/generate.py
- The point cloud will be saved in the
point_cloud_generation/output
directory
Command Line Arguments for generate.py
Debug mode (display additional information)
Scaling factor for the window size
Directory containing the video file
Name of the video file
Directory to save the output file
Directory containing the camera parameters file
Name of the camera parameters file
Information about the object marker (seq_string, min_pattern_len, marker_radius_cm)
Size of the back marker (width_cm, height_cm)
If debug mode is enabled, the program will display different windows:
- Shapes frame: provide more information on the object contours and the geometric shapes fitted during the video processing
- Projection frame: shows the data related to points' projections, for checking the correctness of markers' coordinate systems and their extrinsic parameter identification
- Laser frame: contains all the points detected by the procedure for fitting the laser plane
It's possible to interrupt the video processing by pressing the Q key. If SPACE is pressed, the program will pause the video processing.