-
Notifications
You must be signed in to change notification settings - Fork 7
/
main.py
51 lines (46 loc) · 1023 Bytes
/
main.py
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import cv2
import sys
sys.path.append('Module-1')
from voice import *
sys.path.append('Module-2')
from OCR import *
sys.path.append('Module-3')
from Image_Captioning import *
sys.path.append('Module-4')
from reco import *
sys.path.append('../')
mode=1
count = 0
def cam():
global mode
global count
# Load Camera
cap = cv2.VideoCapture(0)
counter=0
while True:
if(counter%5!=0):
continue
ret, frame = cap.read()
nm="frame"+str(count)+".jpg"
cv2.imwrite(nm, frame)
count+=1
if(mode==1):
voice(caption_this_image(nm))
elif(mode==2):
recognise(nm)
elif(mode==3):
ocr(nm)
cv2.imshow("frame",frame)
key = cv2.waitKey(1)
if key == 49:
mode=1
elif key == 50:
mode=2
elif key == 51:
mode=3
elif key == 27:
break
cap.release()
cv2.destroyAllWindows()
if __name__ == '__main__':
cam()