import cv2 as cv
dispW=640
dispH=480
flip=0
camSet='nvarguscamerasrc ! video/x-raw(memory:NVMM), width=3264, height=2464, format=NV12, framerate=21/1 ! nvvidconv flip-method='+str(flip)+' ! video/x-raw, width='+str(dispW)+', height='+str(dispH)+', format=BGRx ! videoconvert ! video/x-raw, format=BGR ! appsink'
cam=cv.VideoCapture(camSet)
while True:
ret , frame=cam.read()
frame=cv.rectangle(frame, ( 0 , 0 ) , (20,140), ( 255,100,299 ),1 ) # 注意顺序是BGR不适RGB
frame=cv.circle(frame, ( 100 , 100 ) , 50, ( 0,100,299 ),-1 ) #width为-1时,图形为实心
fnt=cv.FONT_HERSHEY_COMPLEX
frame=cv.putText(frame, 'I DONT NEED SLEEP',(30,300) ,fnt, 1, (255,0 ,0), 2 )
frame=cv.line(frame,(10,10),(630,470),(0,0,0),4)
frame=cv.arrowedLine(frame,(10,47),(63,10),(255,0,0),2)
cv.imshow('piCam',frame)
cv.moveWindow('piCam',0,0)
if cv.waitKey(1)==ord('q'):
break
cam.release()
cv.destroyAllwindows()
OpenCV1_摄像头图像获取与编辑
于 2022-01-22 09:49:46 首次发布