VisionAssist
Synthax Team 51
Synthax Team 51
import time
import pyttsx3
import cv2
import pytesseract
import tkinter as tk
pytesseract.pytesseract.tesseract_cmd = r"C:\Users\pranathi\Documents\SYNTHAX FOLDER\tesseract.exe"
vid = cv2.VideoCapture(0) #opens the camera app
while True:
# reads frame from the webcam
rt,fr = vid.read()
if not rt:
break
grey = cv2.cvtColor(fr, cv2.COLOR_BGR2GRAY) # converts frame to greyscale
txt = pytesseract.image_to_string(grey)# using Tesseract to do OCR on the frame
#print('Recognized text: ', txt)
cv2.imshow('frame', fr)
k = cv2.waitKey(100)
spkr=pyttsx3.init()
spkr.say(txt)
spkr.runAndWait()
time.sleep(0.5)
if k ==27:
break
vid.release()
cv2.destroyAllWindows()