Created
January 25, 2022 05:51
-
-
Save qaz10102030/b90f61f481a5a4cce99d8fbbcbaadf5d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import cv2 | |
| cam = cv2.VideoCapture(0 + cv2.CAP_DSHOW) | |
| cam.set(cv2.CAP_PROP_FRAME_WIDTH, 1280) | |
| cam.set(cv2.CAP_PROP_FRAME_HEIGHT, 720) | |
| cam.set(cv2.CAP_PROP_CONVERT_RGB, 0) | |
| try: | |
| print("Starting video. Press CTRL+C to exit.") | |
| while True: | |
| ret_val, im = cam.read() | |
| bRGGB = cv2.convertScaleAbs(im, 0.249023) | |
| BGRim = cv2.cvtColor(bRGGB, cv2.COLOR_BayerRG2BGR) | |
| cv2.imshow("example", BGRim) | |
| cv2.waitKey(1) | |
| except KeyboardInterrupt: | |
| cv2.destroyAllWindows() | |
| # release camera | |
| cam = cam.release() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment