-
Notifications
You must be signed in to change notification settings - Fork 584
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #657 from avats101/main
Added Image to Speech
- Loading branch information
Showing
3 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
USER GUIDE | ||
Setup and activate virtual environment : | ||
|
||
For Unix based systems please execute the following command to create venv and install requirements. | ||
|
||
make init | ||
source .venv/bin/activate | ||
|
||
Pre-requisites | ||
|
||
1) Python pillow (PIL) | ||
$ pip install pillow | ||
|
||
2) Python pytesseract (py package wrapper) | ||
$ pip install pytesseract | ||
|
||
3) Tesseract (OCR Tool) | ||
Download from here https://github.com/tesseract-ocr/tesseract/releases | ||
|
||
4) Python pyttsx3 (Text-to-Speech) | ||
$ pip install pyttsx3 | ||
|
||
How to run the script? | ||
|
||
$ python image_to_speech.py | ||
|
||
Once done, Speech would be produced for the given text image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import pytesseract | ||
from PIL import Image | ||
import pyttsx3 | ||
img = Image.open('Location_to_Image/text_image.png') | ||
pytesseract.pytesseract.tesseract_cmd = 'C:/Program Files/Tesseract-OCR/tesseract.exe' | ||
result = pytesseract.image_to_string(img) | ||
with open('text.txt', mode='w') as file: | ||
file.write(result) | ||
print(result) | ||
engine = pyttsx3.init() | ||
engine.say(result) | ||
engine.runAndWait() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
pytesseract | ||
pillow | ||
pyttsx3 |