-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspeech to text.py
39 lines (31 loc) · 919 Bytes
/
speech to text.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
#import speech_recognition as sr
#filename = "100.wav"
#r = sr.Recognizer()
#with sr.AudioFile(filename) as source:
# audio_data = r.record(source)
# text = r.recognize_google(audio_data)
# print(text)
import cv2
import random
import matplotlib.pyplot as plt
import os
import pyaudio
import speech_recognition as sr
def main():
cap=cv2.VideoCapture(0)
if cap.isOpened():
ret, frame= cap.read()
print(ret)
print(frame)
else:
ret= False
img=cv2.cvtColor(frame ,cv2.COLOR_BGR2RGB)
plt.imshow(img)
plt.xticks([])
plt.yticks([])
plt.show()
output = "C:\\Users\\Abhinav\\Desktop\\mini\\test_images\\1.jpg"
cv2.imwrite(output,img)
os.system("python test.py")
if __name__=="__main__":
main()