title: Image stitching Python
body: <p>I have to stitch two or more images together using python and openCV.
  I found this code for finding keypoints and matches, but I don't know how to continue.
  Help me please!</p>
  
  <pre><code>import numpy as np
  import cv2
  
  MIN_MATCH_COUNT = 10
  
  img1 = cv2.imread('a.jpg',0)          # queryImage
  img2 = cv2.imread('b.jpg',0) # trainImage
  
  # Initiate SIFT detector
  sift = cv2.SIFT()
  
  # find the keypoints and descriptors with SIFT
  kp1, des1 = sift.detectAndCompute(img1,None)
  kp2, des2 = sift.detectAndCompute(img2,None)
  
  FLANN_INDEX_KDTREE = 0
  index_params = dict(algorithm = FLANN_INDEX_KDTREE, trees = 5)
  search_params = dict(checks = 50)
  
  flann = cv2.FlannBasedMatcher(index_params, search_params)
  
  matches = flann.knnMatch(des1,des2,k=2)
  
  # store all the good matches as per Lowe's ratio test.
  good = []
  for m,n in matches:
      if m.distance &lt; 0.7*n.distance:
          good.append(m)
  </code></pre>