video_stream.py 566 B

1234567891011121314151617181920212223
  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, to_gray
  9. from draugr.opencv_utilities.windows.image import show_image
  10. from draugr.visualisation.progress import progress_bar
  11. if __name__ == "__main__":
  12. for image in progress_bar(frame_generator(cv2.VideoCapture(0))):
  13. gray = to_gray(image)
  14. show_image(gray)
  15. if show_image(image, wait=1):
  16. break # esc to quit