From e8572eeb149ec2b3557f776ea3ea5ffae9db64b9 Mon Sep 17 00:00:00 2001 From: Pranav Date: Wed, 2 Mar 2022 07:30:12 +0530 Subject: [PATCH 1/2] Book_Reader#1 --- Book_Reader.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Book_Reader.py diff --git a/Book_Reader.py b/Book_Reader.py new file mode 100644 index 0000000..c4b746d --- /dev/null +++ b/Book_Reader.py @@ -0,0 +1,27 @@ +import cv2 +import pytesseract +import speech_recognition as sr # pip install speechRecognition +import pyttsx3 # pip install pyttsx3 +import time +def speak(str): + engine.say(str) + engine.runAndWait() +pytesseract.pytesseract.tesseract_cmd='C:\\Program Files\\Tesseract-OCR\\tesseract.exe' +frameWidth = 640 +frameHeight = 480 +cap = cv2.VideoCapture(0) +cap.set(3, frameWidth) +cap.set(4, frameHeight) +cap.set(10, 150) +engine = pyttsx3.init() +while True: + success, img = cap.read() + cv2.imshow("Result", img) + if cv2.waitKey(1) & 0xFF == ord('q'): + img1 = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) + cv2.imshow("Result1", img1) + print(img1) + print(pytesseract.image_to_string(img1)+"hello") + speak(pytesseract.image_to_string(img1)) + + From 97327908cb61ae4daa7fa07c03fea0fb6575b343 Mon Sep 17 00:00:00 2001 From: Pranav Date: Tue, 22 Mar 2022 14:30:50 +0530 Subject: [PATCH 2/2] commit #2 added Book_Reader in PA.py --- Book_Reader.py | 39 ++++++++++++++++++++------------------- PA.py | 6 +++++- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/Book_Reader.py b/Book_Reader.py index c4b746d..a39d419 100644 --- a/Book_Reader.py +++ b/Book_Reader.py @@ -1,27 +1,28 @@ -import cv2 -import pytesseract +import cv2 # pip install opencv-python +import pytesseract #open the url:- https://medium.com/@marioruizgonzalez.mx/how-install-tesseract-orc-and-pytesseract-on-windows-68f011ad8b9b#:~:text=How%20install%20Tesseract%20%E2%80%94%20ORC%20and%20Pytesseract%20on,in%20your%20path%3F%20...%204%20Functionality%20test.%20?msclkid=b450aef2a9bc11eca0586aca2ea2f8fa import speech_recognition as sr # pip install speechRecognition import pyttsx3 # pip install pyttsx3 import time def speak(str): engine.say(str) engine.runAndWait() -pytesseract.pytesseract.tesseract_cmd='C:\\Program Files\\Tesseract-OCR\\tesseract.exe' -frameWidth = 640 -frameHeight = 480 -cap = cv2.VideoCapture(0) -cap.set(3, frameWidth) -cap.set(4, frameHeight) -cap.set(10, 150) -engine = pyttsx3.init() -while True: - success, img = cap.read() - cv2.imshow("Result", img) - if cv2.waitKey(1) & 0xFF == ord('q'): - img1 = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) - cv2.imshow("Result1", img1) - print(img1) - print(pytesseract.image_to_string(img1)+"hello") - speak(pytesseract.image_to_string(img1)) +def book_read(): + pytesseract.pytesseract.tesseract_cmd='C:\\Program Files\\Tesseract-OCR\\tesseract.exe' + frameWidth = 640 + frameHeight = 480 + cap = cv2.VideoCapture(0) + cap.set(3, frameWidth) + cap.set(4, frameHeight) + cap.set(10, 150) + engine = pyttsx3.init() + while True: + success, img = cap.read() + cv2.imshow("Result", img) + if cv2.waitKey(1) & 0xFF == ord('q'): + img1 = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) + cv2.imshow("Result1", img1) + print(img1) + print(pytesseract.image_to_string(img1)+"hello") + speak(pytesseract.image_to_string(img1)) diff --git a/PA.py b/PA.py index a3b93d7..f037978 100644 --- a/PA.py +++ b/PA.py @@ -25,6 +25,9 @@ import winshell as winshell # pip install winshell from geopy.geocoders import Nominatim # pip install geopy and pip install geocoder from geopy import distance +import cv2 # pip install opencv-python +import pytesseract #open the url:- https://medium.com/@marioruizgonzalez.mx/how-install-tesseract-orc-and-pytesseract-on-windows-68f011ad8b9b#:~:text=How%20install%20Tesseract%20%E2%80%94%20ORC%20and%20Pytesseract%20on,in%20your%20path%3F%20...%204%20Functionality%20test.%20?msclkid=b450aef2a9bc11eca0586aca2ea2f8fa +import Book_Reader engine = pyttsx3.init() @@ -122,7 +125,8 @@ def get_command(): elif 'open notepad' in query: os.startfile("C:\\Users\\91954\\AppData\\Roaming\\Microsoft\\Windows\\" "Start Menu\\Programs\\Accessories\\Notepad") - + elif 'read book' in query: + Book_Reader.book_read() elif 'open pycharm' in query: os.startfile("C:\\Program Files\\JetBrains\\PyCharm Community Edition 2020.1.1\\bin\\pycharm64.exe")