-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgst_check.py
More file actions
29 lines (24 loc) · 797 Bytes
/
gst_check.py
File metadata and controls
29 lines (24 loc) · 797 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import cv2
print(cv2.getBuildInformation())
# # pipeline_str = (
# # 'nvarguscamerasrc sensor-id=0 tnr-mode=1 exposuretimerange="0 15000000" ! '
# # "video/x-raw(memory:NVMM), width=1920, height=1080, framerate=30/1 ! "
# # "nvvidconv ! video/x-raw, width=1280, height=720, format=BGRx ! "
# # "videoconvert ! video/x-raw, format=BGR ! appsink name=appsink"
# # )
cap = cv2.VideoCapture(
"v4l2src device=/dev/video0 ! videoconvert ! appsink", cv2.CAP_GSTREAMER
)
if not cap.isOpened():
print("Error: Unable to open camera")
exit()
while True:
ret, frame = cap.read()
if ret:
cv2.imshow("test_capture", frame)
else:
print("Error: Could not read frame")
break
if cv2.waitKey(1) & 0xFF == ord("q"):
break
cap.release()