settings.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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.namespaces.enums import (
  9. CameraPropertyEnum,
  10. VideoCaptureAPIEnum,
  11. )
  12. cameraNumber = 1
  13. # fourcc = cv2.VideoWriter_fourcc('M','J','P','G')
  14. cap = cv2.VideoCapture()
  15. cap.open(cameraNumber + VideoCaptureAPIEnum.dshow.value)
  16. # cap.set(cv2.CAP_PROP_FOURCC, fourcc)
  17. # cap.set(cv2.CAP_PROP_FRAME_WIDTH, 1920) # 3840
  18. # cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 1080) # 2160
  19. # cap.set(cv2.CAP_PROP_FPS, 60) # 30
  20. # cap.set(CameraPropertyEnum.FOURCC.value, cv2.VideoWriter.fourcc('Y','1','6',' '))
  21. cap.set(CameraPropertyEnum.convert_rgb.value, 0)
  22. cap.set(CameraPropertyEnum.auto_focus.value, 0)
  23. cap.set(CameraPropertyEnum.settings.value, 1)
  24. # cap.set(CameraPropertyEnum.mode.value, 0)
  25. from draugr.opencv_utilities import frame_generator
  26. from draugr.opencv_utilities.windows.image import show_image
  27. from draugr.visualisation.progress import progress_bar
  28. if __name__ == "__main__":
  29. for image in progress_bar(frame_generator(cap)):
  30. # gray = to_gray(image)
  31. # show_image(gray)
  32. if show_image(image, wait=1):
  33. break # esc to quit