Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from __future__ import print_function
- from imutils.video import VideoStream
- import logging
- import numpy as np
- import argparse
- import imutils
- import time
- import cv2
- cap = cv2.VideoCapture('abcTest.mp4')
- cap1 = cv2.VideoCapture('abcTest.mp4')
- # Define the codec and create VideoWriter object
- fourcc = cv2.VideoWriter_fourcc(*'MP4V')
- #out = cv2.VideoWriter('outputssImutils.mp4',fourcc, 20.0, (640,480))
- writer = None
- (h, w) = (None, None)
- zeros = None
- while(cap.isOpened()):
- ret, frame = cap.read()
- ret1, frame1 = cap1.read()
- if ret == False:
- break
- frame = imutils.resize(frame, width=300)
- frame1 = imutils.resize(frame1, width=300)
- (h, w) = frame.shape[:2]
- if writer is None:
- # store the image dimensions, initialzie the video writer,
- # and construct the zeros array
- writer = cv2.VideoWriter('acvsas.mp4', fourcc, 20,
- (w * 2, h), True)
- zeros = np.zeros((h, w), dtype="uint8")
- output = np.zeros((h , w*2, 3), dtype="uint8")
- output[0:h, 0:w] = frame
- output[0:h, w:w * 2] = frame1
- writer.write(output)
- # show the frames
- cv2.imshow("Frame", frame)
- cv2.imshow("Output", output)
- key = cv2.waitKey(1) & 0xFF
- # if the `q` key was pressed, break from the loop
- if key == ord("q"):
- break
- # Release everything if job is finished
- cap.release()
- cap1.release()
- writer.release()
- cv2.destroyAllWindows()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement