Coder Social home page Coder Social logo

panorama's Introduction

Panorama

  • This repository contains an implementation of multiple image stitching.
  • Slow processing with high resolution images.
  • Images must be supplied in left-to-right order or vice versa.
  • Demo ->>> https://panorama4fun.herokuapp.com/

    Requirement

  • python > 3.7
  • opencv-contrib-python 4.7.0.72

    Usage

  • pip install -r requirements.txt
    python main.py -i INPUT [-o OUTPUT] [-r RESIZE] [-h]
    
    options:
      -h, --help            show this help message and exit
      
      -i INPUT, --input INPUT
                            path to input directory
      -o OUTPUT, --output OUTPUT
                            path to output directory
      -r RESIZE (0|1), --resize RESIZE
                            enter 1 to resize lower resolution
    

    Project Structure :

    	|_ main.py
    	|_Step_By_Step.ipynb
    	|_ utils.py
    	|_ features.py
    	|_ stitch.py
    	|
    	|_ data - |
    	|			|_ myhouse
    	|			|			|- 001.jpg
    	|			|			|- 002.jpg
    	|			|_ BK
    	|			|			|- H1.jpg
    	|			|			|- H2.jpg
    	|			|			|- H3.jpg
    	|			|.....etc.....
    	|_result -|
    	|          		|- myhouse.jpg
    	|          		|- BK.jpg
    	|		   	|.....etc.....
    

    To run :

    IMPORTANT!!! Images must be supplied in left-to-right order or vice versa .

  • Slow processing with high resolution images, so it must be resized before stitching
  • if you want to resize input images :
    `python main.py -i <input dir> -o <output dir> -r 1 `
    
  • Otherwise
    `python main.py -i <input dir> -o <output dir> `
    

    Outputs !!

    Stitching using Myhouse example




    Stitching using BK example




    Stitching using city example




    Stitching using parking lot example



    Stitching using building example



    References :

    [1] https://www.mathworks.com/help/vision/examples/feature-based-panoramic-image-stitching.html

    [2] https://www.pyimagesearch.com/2016/01/11/opencv-panorama-stitching/

    [3] http://ppwwyyxx.com/2016/How-to-Write-a-Panorama-Stitcher/

  • panorama's People

    Contributors

    ndvinh98 avatar

    Stargazers

     avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

    Watchers

     avatar  avatar

    panorama's Issues

    Draw Matches Error in Panorama source code Jupyter Notebook

    Hello.

    First of all, thank you for publishing your panorama source code. It was woderful and it was very helpful.

    I am having a problem with this part:

    #draw matches
    img=features.drawMatches(list_images[0],k0,list_images[1],k1,mat,matMask)
    plt.figure(figsize=(8,8))
    plt.imshow(convertResult(img))
    

    I was just trying your code first thus, I still haven't touched any part on it. However, I am receiving this error:

    error: OpenCV(4.7.0) [D:\a\opencv-python\opencv-python\opencv\modules\features2d\src\draw.cpp:228](file:///D:/a/opencv-python/opencv-python/opencv/modules/features2d/src/draw.cpp:228): error: (-201:Incorrect size of input array) matchesMask must have the same size as matches1to2 in function 'cv::drawMatches'
    

    I tried searching the solution but most of them are using C++ and not Python. Can you help me with this problem please? Greatly appreciated. Thank you.

    ValueError: could not broadcast input array from shape (4096,20480,3) into shape (4096,17823,3),Exception: Please try again with another image set!

    F:\2022\PJ\123
    IMG shape
    4096,20480,3
    4096,20480,3
    4096,20480,3

     python main.py -i F:\2022\PJ\123 -o F:\2022\PJ\out
    Processing....
    Traceback (most recent call last):
      File "D:\Panorama-master\stitch.py", line 132, in warpTwoImages
        dst_img_rz[t[1] : height_src + t[1], :width_dst] = dst_img
    ValueError: could not broadcast input array from shape (4096,20480,3) into shape (4096,17823,3)
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "main.py", line 23, in <module>
        panorama = stitch.multiStitching(list_images)
      File "D:\Panorama-master\stitch.py", line 166, in multiStitching
        right_pano, _, _, _ = warpTwoImages(src_img, dst_img)
      File "D:\Panorama-master\stitch.py", line 143, in warpTwoImages
        raise Exception("Please try again with another image set!")
    Exception: Please try again with another image set!
    

    ValueError: could not broadcast input array from shape (455,337,3) into shape (455,159,3)

    Hi @ndvinh98,

    Thank you for sharing your work with the multiple image stitching. It is undoubtedly a commendable work.

    I am trying to test your code to generate some panoramic images. I downloaded random images from google and then tested the code with those. It works for some images but doesn't work for others. For example I am using a set of 5 images which have the following shapes:

    img1.shape: (818 692 3) 
    img2.shape: (818 683 3)
    img3.shape: (818 573 3)
    img4.shape: (818 541 3)
    img5.shape: (818 617 3)
    

    and I get a resulting image with the following shape:
    result.shape: (818 2299 3)

    However, when I am using another image set of 4 images with the following shapes:

    img1.shape: (455 343 3) 
    img2.shape: (455 337 3)
    img3.shape: (455 385 3)
    img4.shape: (455 431 3)
    

    I don't get any resulting image and instead I get the following error:

    Traceback (most recent call last):
      File "/home/user/multi_stitch/stitch.py", line 133, in warpTwoImages
        dst_img_rz[t[1] : height_src + t[1], :width_dst] = dst_img
    ValueError: could not broadcast input array from shape (455,337,3) into shape (455,159,3)
    

    Looks like this issue was reported before here but apparently it doesn't seem to be related with python version as mentioned in this issue.

    I was hoping if you could provide some help here. Thanks!

    iPhone Image Compatibility?

    Hey there can't seem to find any contact info, is this only able to take in a certain dimension of photos? I am having trouble implementing iPhone images

    Recommend Projects

    • React photo React

      A declarative, efficient, and flexible JavaScript library for building user interfaces.

    • Vue.js photo Vue.js

      ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

    • Typescript photo Typescript

      TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

    • TensorFlow photo TensorFlow

      An Open Source Machine Learning Framework for Everyone

    • Django photo Django

      The Web framework for perfectionists with deadlines.

    • D3 photo D3

      Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

    Recommend Topics

    • javascript

      JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

    • web

      Some thing interesting about web. New door for the world.

    • server

      A server is a program made to process requests and deliver data to clients.

    • Machine learning

      Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

    • Game

      Some thing interesting about game, make everyone happy.

    Recommend Org

    • Facebook photo Facebook

      We are working to build community through open source technology. NB: members must have two-factor auth.

    • Microsoft photo Microsoft

      Open source projects and samples from Microsoft.

    • Google photo Google

      Google โค๏ธ Open Source for everyone.

    • D3 photo D3

      Data-Driven Documents codes.