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()
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)