Ask Your Question

is it possible to show two video feed in one window?

asked 2018-03-29 00:53:35 -0500

usuf gravatar image

camera1 = cv2.VideoCapture(0) camera2 = cv2.VideoCapture(1)

here i fetch the video from two camera how can i show this video in one window? using "imshow" function to print only one video at the time any other options?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2018-03-29 01:04:09 -0500

berak gravatar image

updated 2018-03-29 02:35:07 -0500

you'll see, this is surprisingly easy. given, they got the same size, you can append them to a single image:

ret1, img1 =
ret2, img2 =
if ret1==False or ret2==False:
      print("could not read from cameras !")

# now, you can do this either vertical (one over the other):
final = cv2.vconcat([img1, img2])

# or horizontal (next to each other):
#final = cv2.hconcat([img1, img2])

imshow("I", final)
edit flag offensive delete link more



i run that above command but it takes the first argument only and displays img1 only...

usuf gravatar imageusuf ( 2018-03-29 01:51:18 -0500 )edit

apologies, i made a typo, see updated answer !

(you need to make a list of the 2 images first)

berak gravatar imageberak ( 2018-03-29 02:33:14 -0500 )edit

Question Tools

1 follower


Asked: 2018-03-29 00:53:35 -0500

Seen: 7,927 times

Last updated: Mar 29 '18