-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
31 lines (24 loc) · 936 Bytes
/
main.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
import cv2
import numpy as np
import argparse
from stitcher import Stitcher
parser = argparse.ArgumentParser()
parser.add_argument("--contrastThreshold", type=float, default=0.07)
parser.add_argument("--edgeThreshold", type=float, default=2.5)
parser.add_argument("instructions", type=str, help="path to instructions.json")
parser.add_argument("imagesFolder", type=str, help="path to the images folder")
args = parser.parse_args().__dict__
def main():
stitcher = Stitcher(
contrastThreshold=args["contrastThreshold"],
edgeThreshold=args["edgeThreshold"],
instructionPath=args["instructions"],
imageFolderPath=args["imagesFolder"],
)
stitcher.stitch()
cv2.imwrite("./result.jpg", stitcher.canvas, [cv2.IMWRITE_JPEG_QUALITY, 90])
cv2.imshow("Result", cv2.resize(stitcher.canvas, (1500, 1000)))
cv2.waitKey(0)
cv2.destroyAllWindows()
if __name__ == "__main__":
main()