This project demonstrates an image stitching algorithm using OpenCV to create a panorama from multiple images.
main.py
images/
image1.jpg
image2.jpg
image3.jpg
image4.jpg
image5.jpg
image6.jpg
image7.jpg
panorama.jpg
main.py: The main script that reads images, stitches them into a panorama, and displays the result.images/: Directory containing the input images and the output panorama.
- Python 3.6+
- OpenCV
- NumPy
- Matplotlib
Install the required Python packages using:
pip install opencv-python-headless numpy matplotlib- Place the images you want to stitch in the
images/directory. - Update the
image_fileslist inmain.pywith the filenames of the images to be stitched. - Run the script:
python main.py- The resulting panorama will be saved as
images/panorama.jpgand displayed along with the original images.
The script handles the following errors:
- Missing or unreadable images.
- Insufficient images for stitching.
- Homography estimation failure.
- Camera parameter adjustment failure.
If an error occurs, it will be printed to the console.
After running the script, the stitched panorama will look like this (example):
This project is licensed under the MIT License. See the LICENSE file for details.
