-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenCV_moveWindow.py
More file actions
30 lines (22 loc) · 849 Bytes
/
Copy pathopenCV_moveWindow.py
File metadata and controls
30 lines (22 loc) · 849 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
30
#program launches the rpi cam with jetson nano
import cv2
print(cv2.__version__)
#Setting up the camera
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 = cv2.VideoCapture(camSet)
#Read camera until q key is pressed
while True:
ret, frame = cam.read()
cv2.imshow('piCam',frame)
cv2.moveWindow('piCam', 0, 0)
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow('grayVideo', gray)
cv2.moveWindow('grayVideo', 0, 530)
if cv2.waitKey(1) == ord('q'):
break
#After q is pressed, release the camera back to the system
cam.release()
cv2.destroyAllWindows()