Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/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)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement