def one_stitch(queue): stitcher = Stitcher() while not queue.empty(): filename, images = queue.get() print( f'Processing video {queue.maxsize-queue.qsize()} of {queue.maxsize}, filename {filename}', flush=True) result = stitcher.multistitch(images, manual=False, os="win") cv2.imwrite(filename, result)
from video_reader import frame_generator from panorama import Stitcher import cv2 infile = "in/hell2.mkv" outfile = "out/hell2.png" stitcher = Stitcher() images = frame_generator(infile, frames=10, width=600, image_crop=(186, 694, 5, 1905)) result = stitcher.multistitch(images, manual=False, os="win") cv2.imwrite(outfile, result)
ap.add_argument( "-f", "--frames", required=False, help="Takes every Nth frame where N is this parameter. Default is 10", default=10) ap.add_argument("-m", "--manual", required=False, help="manual fix mode, default to false", default=False) ap.add_argument( "-o", "--os", required=False, help="os. can be win or linux. determines keycodes for manual mode", default="linux") args = vars(ap.parse_args()) stitcher = Stitcher() images = frame_generator(args["video"], frames=int(args["frames"])) result = stitcher.multistitch(images, manual=args["manual"], os=args["os"]) cv2.imshow("Result", result) last_key = cv2.waitKeyEx(0) if last_key == 13: filepath = args["name"] if filepath[-4:] != ".png": filepath = filepath + ".png" cv2.imwrite(filepath, result)