Ask Your Question
0

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
1

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 = camera1.read()
ret2, img2 = camera2.read()
if ret1==False or ret2==False:
      print("could not read from cameras !")
      return

# 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)
waitKey(10)
edit flag offensive delete link more

Comments

1

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
1

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
Login/Signup to Answer

Question Tools

1 follower

Stats

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

Seen: 1,891 times

Last updated: Mar 29 '18