double.py 668 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. __author__ = "Christian Heider Nielsen"
  4. __doc__ = r"""
  5. Created on 31-10-2020
  6. """
  7. import cv2
  8. from draugr.opencv_utilities import frame_generator
  9. from draugr.opencv_utilities.windows.image import show_image
  10. from draugr.visualisation.progress import progress_bar
  11. cameras = []
  12. print("open cam1")
  13. cameras += (frame_generator(cv2.VideoCapture(0)),)
  14. print("open cam2")
  15. cameras += (frame_generator(cv2.VideoCapture(1)),)
  16. print("opened")
  17. if __name__ == "__main__":
  18. for image, image2 in progress_bar(zip(*cameras)):
  19. show_image(image2)
  20. if show_image(image, wait=1):
  21. break