Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#!/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