Skip to content

Instantly share code, notes, and snippets.

@Raspberry765
Created July 26, 2017 06:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Raspberry765/46b35104c1f4f2dc3d5db73da1f56590 to your computer and use it in GitHub Desktop.
Save Raspberry765/46b35104c1f4f2dc3d5db73da1f56590 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pyimagesearch.panorama import Stitcher
import argparse
import imutils
import cv2
import os
imageA = cv2.imread("test2.jpg") #test2.jpgを読み込む
imageB = cv2.imread("test1.jpg") #test1.jpgを読み込む
stitcher = Stitcher()
(preresult, vis) = stitcher.stitch([imageA, imageB], showMatches=True)
#vis = cv2.flip(vis,1)
#cv2.imshow("Keypoint Matches1", vis)
#cv2.imshow("preResult", preresult)
#pre_resultを保存
cv2.imwrite("pre_result.jpg", preresult)
imageC = cv2.imread("pre_result.jpg") #pre_result.jpgを読み込む
imageD = cv2.imread("test3.jpg") #test3.jpgを読み込む
imageC = cv2.flip(imageC,1) #左右反転
imageD = cv2.flip(imageD,1) #左右反転
(result, vis2) = stitcher.stitch([imageC, imageD], showMatches=True)
#cv2.imshow("Keypoint Matches2", vis2)
result = cv2.flip(result,1)#反転させる
#cv2.imshow("Result", result)
cv2.imwrite("result.jpg", result)
#cv2.waitKey(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment