# -*- coding: utf-8 -*-
# @Time    : 2017/8/15 00:19
# @Author  : play4fun
# @File    : two_camera.py
# @Software: PyCharm

"""
two_camera.py:
"""

import cv2

cap0 = cv2.VideoCapture(0)
cap1 = cv2.VideoCapture(1)
ret = cap0.set(3, 320)
ret = cap0.set(4, 240)
ret = cap1.set(3, 320)
ret = cap1.set(4, 240)

while cap0.isOpened() and cap1.isOpened():
    ret, frame0 = cap0.read()
    ret, frame1 = cap1.read()

    cv2.imshow('frame0', frame0)
    cv2.imshow('frame1', frame1)
    cv2.moveWindow('frame1', x=frame0.shape[1], y=0)

    key = cv2.waitKey(delay=10)
    if key == ord("q"):
        break

# When everything done, release the capture
cap0.release()
cap1.release()
cv2.destroyAllWindows()

@@ -151,16 +151,35 @@
 port cv2
+%0Aimport numpy as np
 %0A%0Acap0 =
@@ -365,24 +365,25 @@
 d():%0A    ret
+0
 , frame0 = c
@@ -400,16 +400,17 @@
 %0A    ret
+1
 , frame1
@@ -425,16 +425,33 @@
 read()%0A%0A
+    if ret0:%0A    
     cv2.
@@ -475,16 +475,33 @@
 frame0)%0A
+    if ret1:%0A    
     cv2.
@@ -528,16 +528,22 @@
 me1)%0A   
+     #
  cv2.mov
@@ -583,16 +583,61 @@
 1%5D, y=0)
+%0A        cv2.moveWindow('frame1', x=240, y=0)
 %0A%0A    ke
@@ -662,10 +662,9 @@
 lay=
-10
+2
 )%0A  

two_camera 2