python视频拼接两个视频流合成一个视频流

import cv2
import numpy as np
video = "http://admin:[email protected]:8081"


##选择摄像头
videoLeftUp = cv2.VideoCapture(0)
videoRightUp = cv2.VideoCapture(video)
 
width = (int(videoLeftUp.get(cv2.CAP_PROP_FRAME_WIDTH)))
height = (int(videoLeftUp.get(cv2.CAP_PROP_FRAME_HEIGHT)))
 
while (videoLeftUp.isOpened()):
    retLeftUp, frameLeftUp = videoLeftUp.read()
    retRightUp, frameRightUp = videoRightUp.read()
 
    frameLeftUp = cv2.resize(frameLeftUp, (int(width), int(height)), interpolation=cv2.INTER_CUBIC)
    frameRightUp = cv2.resize(frameRightUp, (int(width), int(height)), interpolation=cv2.INTER_CUBIC)
 
    frameUp = np.hstack((frameLeftUp, frameRightUp))
 
    cv2.imshow('frame', frameUp)
    print('111')
    key = cv2.waitKey(10)
    if int(key) == 113:
        break
 
videoLeftUp.release()
videoRightUp.release()

猜你喜欢

转载自blog.csdn.net/babyai996/article/details/121518107