I'm trying to build a code to read the text from an image then Voice it over, and that what I already made ( shown below).
import pytesseract
import pyttsx3
from PIL import Image
engine = pyttsx3.init()
pytesseract.pytesseract.tesseract_cmd = "C:\\Program Files (x86)\\Tesseract-OCR\\tesseract.exe"
im=Image.open("E:\Capture.PNG")
engine.say(pytesseract.image_to_string(im,lang='eng'))
engine.runAndWait()
print(pytesseract.image_to_string(im,lang='eng'))
Fortunately, the code worked successfully, but, however, I want to improve it more by connecting the code to the external cam which I will use to take pictures then send it to Python to do his job. So, any suggestions to make the image path variable, instead of im=Image.open("E:\Capture.PNG"), I want the path to be dependent in the path in which my cam will send the taken image to. Thanks