// An highlighted block
import cv2
def open_cam_onboard(width, height):
gst_str = ('nvarguscamerasrc ! '
'video/x-raw(memory:NVMM), '
'width=(int)2592, height=(int)1458, '
'format=(string)NV12, framerate=(fraction)30/1 ! '
'nvvidconv flip-method=2 ! '
'video/x-raw, width=(int){}, height=(int){}, '
'format=(string)BGRx ! '
'videoconvert ! appsink').format(width, height)
return cv2.VideoCapture(gst_str, cv2.CAP_GSTREAMER)
cap=open_cam_onboard(500,300)
while(True):
ret,frame=cap.read()
frame=cv2.flip(frame,-1) #翻转
cv2.imshow('frame',frame)
if cv2.waitKey(1) == ord('q'):
break
gst_elements = str(subprocess.check_output('gst-inspect-1.0'))
width = '1920'
height = '1080&#