forked from laviii123/Btecky
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsuhit2
More file actions
20 lines (20 loc) · 659 Bytes
/
Copy pathsuhit2
File metadata and controls
20 lines (20 loc) · 659 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import cv2
cap=cv2.VideoCapture(0)
print("cap",cap)
#DIVX,XVID,MJPG,X264,WMV1,WMV2 video capturing formats
fourcc=cv2.VideoWriter_fourcc(*"XVID")
#int contain 4 parameters,name,codecc,fps,resolution
output=cv2.VideoWriter("output.avi",fourcc,20.0,(640,480))
while cap.isOpened():
ret,frame=cap.read() #ret is boolean value and frame is image
if ret==True:
cv2.imshow("frame",frame)
grey=cv2.cvtColor(frame,cv2.COLOR_RGB2GRAY)# converts to grey images
cv2.imshow("frame1",grey)
output.write(frame)
x=cv2.waitKey(25)
if x==ord('s'):
break
cap.release()
output.release()
cv2.destroyAllWindows()