This project provides a set of techniques for detecting the centroid of a laser beam in images. It leverages superpixel-based segmentation methods (Felzenszwalb, SLIC, Quickshift) to segment an image and then calculates the centroid with different approaches, offering insights into performance and accuracy.
- Superpixel Segmentation Demonstrates how to apply several segmentation algorithms to help isolate the laser beam region in images.
- Multiple Centroid Detection Methods Includes implementations using OpenCV morphological operations and Scikit-Image CCL, allowing for easy comparison of computation time and detection accuracy.
- Performance Evaluation Measures the execution time of each approach for benchmarking purposes.
- Clone the repository
git clone https://github.com/greg-ogs/Centroid-for-spot-laser.git- Navigate to the project directory
cd Centroid-for-spot-laser- Install dependencies Make sure you have Python 3.7+ environment, then run:
pip install --no-cache-dir -r requirements.txtAlternatively, you can build a dev container using the Dockerfile.
- Build the Docker image
docker build -t laser-beam-centroid .- Run the Docker container
docker run -it --rm laser-beam-centroidThis will create a reproducible environment with all required dependencies installed.
- Prepare your input image Ensure you have all the directories / classes in the image directory
- Run the script
python main.pyThis will apply the different segmentation algorithms and centroid methods, then print out the computation times for each approach.
- Modify parameters Feel free to customize paths, algorithm parameters, or other settings within the code to suit your needs.