forked from DivyanshMalhotra/HashHacks3_jsk1961998935
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stiching_code.py
31 lines (27 loc) · 1021 Bytes
/
stiching_code.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from Stitcher import stitcher
# import the necessary packages
import argparse
import imutils
import cv2
# construct the argument parse and parse the arguments
'''ap = argparse.ArgumentParser()
ap.add_argument("-f", "--first", required=True,
help="path to the first image")
ap.add_argument("-s", "--second", required=True,
help="path to the second image")
args = vars(ap.parse_args())'''
# load the two images and resize them to have a width of 400 pixels
# (for faster processing)
imageA = cv2.imread(r'C:\Users\PIYUSH\Desktop\piyush.jpg')
imageB = cv2.imread(r'C:\Users\PIYUSH\Desktop\piyush2.jpg')
imageA = imutils.resize(imageA, width=400)
imageB = imutils.resize(imageB, width=400)
# stitch the images together to create a panorama
stitcher = stitcher()
(result, vis) = stitcher.stitch([imageA, imageB], showMatches=True)
# show the images
cv2.imshow("Image A", imageA)
cv2.imshow("Image B", imageB)
cv2.imshow("Keypoint Matches", vis)
cv2.imshow("Result", result)
cv2.waitKey(0)