Last active
April 20, 2022 07:26
-
-
Save johnnylord/b5f003e62c1f4eb9c6e2ae9567c4f3d0 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 time | |
import cv2 | |
pipeline = ( | |
"nvarguscamerasrc ! " | |
"video/x-raw(memory:NVMM), " | |
"width=(int)1920, height=(int)1080, " | |
"format=(string)NV12, framerate=(fraction)30/1 ! " | |
"queue ! " | |
"nvvidconv ! " | |
"video/x-raw, " | |
"width=(int)1920, height=(int)1080, " | |
"format=(string)BGRx, framerate=(fraction)30/1 ! " | |
"videoconvert ! " | |
"video/x-raw, format=(string)BGR ! " | |
"appsink" | |
) | |
cap = cv2.VideoCapture(pipeline, cv2.CAP_GSTREAMER) | |
try: | |
while True: | |
ret, frame = cap.read() | |
if not ret: | |
break | |
print(time.strftime('%X'), frame.shape) | |
except KeyboardInterrupt as e: | |
cap.release() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment