Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3.  
  4.  
  5. from pyimagesearch.panorama import Stitcher
  6. import argparse
  7. import imutils
  8. import cv2
  9. import os
  10.  
  11. imageA = cv2.imread("test2.jpg") #test2.jpgを読み込む
  12. imageB = cv2.imread("test1.jpg") #test1.jpgを読み込む
  13.  
  14. stitcher = Stitcher()
  15. (preresult, vis) = stitcher.stitch([imageA, imageB], showMatches=True)
  16.  
  17. #vis = cv2.flip(vis,1)
  18. #cv2.imshow("Keypoint Matches1", vis)
  19. #cv2.imshow("preResult", preresult)
  20. #pre_resultを保存
  21. cv2.imwrite("pre_result.jpg", preresult)
  22.  
  23. imageC = cv2.imread("pre_result.jpg") #pre_result.jpgを読み込む
  24. imageD = cv2.imread("test3.jpg") #test3.jpgを読み込む
  25. imageC = cv2.flip(imageC,1) #左右反転
  26. imageD = cv2.flip(imageD,1) #左右反転
  27.  
  28. (result, vis2) = stitcher.stitch([imageC, imageD], showMatches=True)
  29. #cv2.imshow("Keypoint Matches2", vis2)
  30.  
  31. result = cv2.flip(result,1)#反転させる
  32. #cv2.imshow("Result", result)
  33. cv2.imwrite("result.jpg", result)
  34. #cv2.waitKey(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement