Prathamesh1420 commited on
Commit
32b0b5a
·
verified ·
1 Parent(s): 2542cff

Create camera.py

Browse files
Files changed (1) hide show
  1. camera.py +13 -0
camera.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import cv2
2
+
3
+ class VideoCamera(object):
4
+ def __init__(self):
5
+ self.video = cv2.VideoCapture(0)
6
+
7
+ def __del__(self):
8
+ self.video.release()
9
+
10
+ def get_frame(self):
11
+ ret, frame = self.video.read()
12
+
13
+ ret, jpeg = cv2.imencode('.jpg', frame)