Spaces:
Runtime error
Runtime error
Commit ·
92f0123
1
Parent(s): 68c15ec
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
def getCam():
|
| 3 |
+
window_name='show image'
|
| 4 |
+
cv2.namedWindow(window_name,cv2.WINDOW_NORMAL)
|
| 5 |
+
video_cap_obj=cv2.VideoCapture(0)
|
| 6 |
+
if video_cap_obj==None:
|
| 7 |
+
print('video caoture error')
|
| 8 |
+
if video_cap_obj.open(0)==False:
|
| 9 |
+
print('open error')
|
| 10 |
+
while True:
|
| 11 |
+
retval,image=video_cap_obj.read()
|
| 12 |
+
cv2.cv.ShowImage(window_name,cv2.cv.fromarray(image))
|
| 13 |
+
if cv2.waitKey(10)==27:
|
| 14 |
+
break
|
| 15 |
+
video_cap_obj.release()
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
getCam()
|