-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
text to speech with tesseract only working on im
- Loading branch information
Rishan123
committed
Oct 2, 2020
1 parent
e105377
commit d706ac1
Showing
7 changed files
with
29 additions
and
103 deletions.
There are no files selected for viewing
Binary file not shown.
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,7 @@ | ||
from gtts import gTTS | ||
import os | ||
|
||
tts = gTTS('hello') | ||
tts.save('hello.mp3') | ||
os.system('omxplayer /home/pi/Rishan-BOT/TTS/hello.mp3') | ||
print('hello') |
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,22 @@ | ||
# import the necessary packages | ||
import pytesseract | ||
import cv2 | ||
from gtts import gTTS | ||
import os | ||
|
||
# load the example image and convert it to grayscale | ||
image = cv2.imread('/home/pi/Rishan-BOT/computer-vision/example_01.png') | ||
config = ('-l eng --oem 1 --psm 3') | ||
|
||
image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) | ||
image = cv2.threshold(image, 0, 255, | ||
cv2.THRESH_BINARY | cv2.THRESH_OTSU)[1] | ||
|
||
text = pytesseract.image_to_string(image, config=config) | ||
tts = gTTS(text) | ||
tts.save('/home/pi/text.mp3') | ||
os.system('omxplayer /home/pi/text.mp3') | ||
|
||
print(text) | ||
cv2.imshow('OCR',image) | ||
cv2.waitKey(0) |
Empty file.